Announcement Announcement Module
Collapse
No announcement yet.
SAXParser-exception after upgrading to 2.0-RC4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SAXParser-exception after upgrading to 2.0-RC4

    I just upgraded from 2.0-RC3 to 2.0-RC4 and I get the following exception when my applicationContext.xml is being loaded
    Code:
    Warning: Caught exception attempting to use SAX to load a SAX XMLReader
    Warning: Exception was: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.parsers.SAXParser
    Warning: I will print the stack trace then carry on using the default SAX parser
    java.lang.ClassCastException: com.sun.org.apache.xerces.internal.parsers.SAXParser
            at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:199)
            at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:150)
            at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
            at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
            at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
            at org.dom4j.io.SAXReader.setFeature(SAXReader.java:218)
            at org.hibernate.ejb.Ejb3Configuration.addXMLEntities(Ejb3Configuration.java:372)
            at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:316)
            at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:1
    19)
            at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(Lo
    calContainerEntityManagerFactoryBean.java:197)
            at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerF
    actoryBean.java:237)
    ------------------
    Some more errors
    ------------------
    Caused by: org.dom4j.DocumentException: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader Nested exception: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader
    First, I had a xerces-implementation on the classpath and I got the same exception. Then, as you might see from the stacktrace, I removed to use the standard JDK variant(as a test) but with no improvement.
    This worked just fine in 2.0-RC3.
    I noticed that 2.0-RC3 includes a lib lib/j2ee/xml-apis.jar(which have a SAXParser.class) but 2.0-RC4 does not.

    Any ideas?

    Cheers,
    Peter

  • #2
    Please report the issue on jira. Also try using various XML parsers in the mean time to get around the issue.
    Btw, what Hibernate EM are you using? Can you try 3.2 CR 2?

    Comment


    • #3
      Originally posted by Costin Leau
      Please report the issue on jira. Also try using various XML parsers in the mean time to get around the issue.
      Btw, what Hibernate EM are you using? Can you try 3.2 CR 2?
      Hi Costin!
      I just tested to upgrad Hibernate EM from 3.2 CR1 to 3.2 CR2 but with no result.
      Next, I will try different XML parsers and come back to you with the result.

      Cheers,
      Peter

      Comment


      • #4
        Here's the (almost) full stacktrace that may help someone to pinpoint the problem.
        Code:
        Warning: Caught exception attempting to use SAX to load a SAX XMLReader 
        Warning: Exception was: java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser
        Warning: I will print the stack trace then carry on using the default SAX parser
        Warning: Caught exception attempting to use SAX to load a SAX XMLReader 
        Warning: Exception was: java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser
        Warning: I will print the stack trace then carry on using the default SAX parser
        org.springframework.web.context.ContextLoader[ERROR] 2006-09-18 13:07:59,078 initWebApplicationContext (ContextLoader.java:205)
        **  Context initialization failed  **
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream
        Caused by: 
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream
        Caused by: 
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream
        Caused by: 
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream
        Caused by: 
        org.hibernate.MappingException: Could not parse mapping document in input stream
        	at org.hibernate.ejb.Ejb3Configuration.addXMLEntities(Ejb3Configuration.java:456)
        	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:348)
        	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
        	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:197)
        	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:237)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:957)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:924)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:415)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:850)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:624)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:411)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:850)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:624)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:411)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:198)
        	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:116)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:850)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:624)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:411)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
        	----
        	----
        Caused by: org.dom4j.DocumentException: SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader Nested exception: SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader
        	at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        	at org.dom4j.io.SAXReader.read(SAXReader.java:343)
        	at org.hibernate.ejb.Ejb3Configuration.addXMLEntities(Ejb3Configuration.java:421)
        	... 76 more
        
        Embedded error: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not parse mapping document in input stream
        SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader Nested exception: SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader
        I've also created a Jira for it.

        Cheers,
        Peter

        Comment


        • #5
          There's also a similar(well, almost a copy) thread about this. There you could find my setup.
          Unfortunately, the problem hasn't been resolved yet.

          Comment

          Working...
          X