Announcement Announcement Module
Collapse
No announcement yet.
JDK Issue when loading application context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JDK Issue when loading application context

    Hi,

    I was trying to load the application context using ClassPathXmlApplicationContext in Spring 2x. I am getting an error when getting an instance of the ApplicationContext.

    Code:
    INFO: JDK 1.4+ collections available
    Jun 18, 2007 11:17:55 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [conf/jdbc-application-context.xml]
    org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [conf/jdbc-application-context.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@13d93f4] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
    Caused by: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@13d93f4] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:101)
    	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:340)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:317)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:125)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:141)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:167)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
    	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:292)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)
    	at com.jbe.spring.pg.jdbc.sql.ConnectionManager.getConnection(ConnectionManager.java:13)
    	at com.jbe.spring.pg.jdbc.test.ConnectionManagerTest.main(ConnectionManagerTest.java:8)
    I never had this problem with JDK version before.

    The application context is
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
           
           <!--  DriverManager Data Source 
           		Example of Constructor Injection
           -->
           
           <bean id = "dmDataSource" class = "org.springframework.jdbc.datasource.DriverManagerDataSource">
           	<!-- Driver Class -->
           	<constructor-arg index = "0" value = "org.postgresql.Driver"/>
           	<!--  URL -->
           	<constructor-arg index = "1" value = "jdbc:postgresql://localhost:5432" />
           	<!--  Username -->
           	<constructor-arg index = "2" value = "postgres"/>
           	<!--  Password -->
           	<constructor-arg index = "3" value = "password" />
           </bean>
           
                 <bean id = "namedParameterJdbcTemplate" class = "org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
           	<constructor-arg ref = "dmDataSource"/>
           </bean>
           
           <!--  NamedParameterJDBCTemplate -->
    </beans>

  • #2
    You probably switched to XSD recently. The default parser coming with JDK 1.4 is Crimson and it's not schema-aware. You need to use for example Xerces explicitly, i.e. put the Xerces jars into so called endorsed lib dirs.

    Jörg

    Comment


    • #3
      Let me try that. I switched from Spring 1.2 to Spring 2x recently. I was testing to see if I can get a connection running. I will try that ASAP

      Comment

      Working...
      X