You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris Wolf <cw...@gmail.com> on 2013/05/03 22:14:49 UTC

Class Cast error upon deploying Camel web app

Has anyone seen this error?  I'm trying to deploy on JBoss6.  I was
able to deploy before without issues.  I guess
it's some kind of "classloader-Hell" issue due to JEE weirdness.

Caused by: java.lang.ClassCastException:
org.apache.xerces.dom.DeferredElementNSImpl cannot be cast to
org.w3c.dom.Element
	at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:100) [:2.2]
	at com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:156)
[:2.2]
	at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:127) [:2.2]
	at org.apache.camel.spring.handler.CamelNamespaceHandler.parseUsingJaxb(CamelNamespaceHandler.java:166)
[:2.10.4]
	at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:306)
[:2.10.4]
	at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
[:

Re: Class Cast error upon deploying Camel web app

Posted by Chris Wolf <cw...@gmail.com>.
Actually, I forgot the baked-in xerces/xalan are in namespace javax.xml, but
the standalone xerces/xalan are in org.apache.

In any case, I added some other components which caused Maven to
pull in xalan-2.7.0 and there was already xalan-2.7.1 proved by JBoss,
so I added exclusions in the pom.xml

Thanks,


Chris

On Fri, May 3, 2013 at 8:28 PM, Chris Wolf <cw...@gmail.com> wrote:
> Thanks, I tried that and now the error as shown below.
>
> Note that jboss6 was built with jdk-1.5, so it comes with it's own
> xerces/xalan, so I'm
> thinking there's a class with the JRE baked-in xerces/xalan (I'm running with
> jre-1.6).  On the other hand, I have been able to deploy successfully
> before and I did
> even without the special camel-jboss classloader.  So do I need that?
>
>
> 20:18:03,218 INFO
> org.springframework.beans.factory.BeanDefinitionStoreException:
> Unexpected exception parsing XML document from ServletContext resource
> [/WEB-INF/applicationContext.xml]; nested exception is
> java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
>  [STDOUT]
> [...]
> Caused by: java.lang.ClassCastException:
> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
> javax.xml.parsers.DocumentBuilderFactory
>         at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown
> Source) [:1.6.0_29]
>         at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:89)
> [:3.1.0.RELEASE]
>         at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70)
> [:3.1.0.RELEASE]
>         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
> [:3.1.0.RELEASE]
>
> On Fri, May 3, 2013 at 5:15 PM, Babak Vahdat
> <ba...@swissonline.ch> wrote:
>> Hi
>>
>> I assume the JAXB version being provided by JBoss 6 is pretty outdated and
>> not really compliant with Camel 2.10.4 as JBoss 6 is from end 2010.
>>
>> Do you have any jaxb-impl inside your WAR/EAR being included? If not maybe
>> try to add the following dependency inside the POM of your Web-App so that
>> jaxb-impl-2.1.13.jar gets included into your WEB-INF/lib folder of your WAR
>> getting precedence to the one from JBoss AS.
>>
>> <dependency>
>>   <groupId>com.sun.xml.bind</groupId>
>>   <artifactId>jaxb-impl</artifactId>
>>   <version>2.1.13</version>
>> </dependency>
>>
>> Babak
>>
>>
>> Chris Wolf wrote
>>> Has anyone seen this error?  I'm trying to deploy on JBoss6.  I was
>>> able to deploy before without issues.  I guess
>>> it's some kind of "classloader-Hell" issue due to JEE weirdness.
>>>
>>> Caused by: java.lang.ClassCastException:
>>> org.apache.xerces.dom.DeferredElementNSImpl cannot be cast to
>>> org.w3c.dom.Element
>>>       at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:100)
>>> [:2.2]
>>>       at
>>> com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:156)
>>> [:2.2]
>>>       at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:127)
>>> [:2.2]
>>>       at
>>> org.apache.camel.spring.handler.CamelNamespaceHandler.parseUsingJaxb(CamelNamespaceHandler.java:166)
>>> [:2.10.4]
>>>       at
>>> org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:306)
>>> [:2.10.4]
>>>       at
>>> org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
>>> [:3.1.0.RELEASE]
>>>       at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
>>> [:
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Class-Cast-error-upon-deploying-Camel-web-app-tp5732000p5732001.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Class Cast error upon deploying Camel web app

Posted by Chris Wolf <cw...@gmail.com>.
Thanks, I tried that and now the error as shown below.

Note that jboss6 was built with jdk-1.5, so it comes with it's own
xerces/xalan, so I'm
thinking there's a class with the JRE baked-in xerces/xalan (I'm running with
jre-1.6).  On the other hand, I have been able to deploy successfully
before and I did
even without the special camel-jboss classloader.  So do I need that?


20:18:03,218 INFO
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory
 [STDOUT]
[...]
Caused by: java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory
	at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown
Source) [:1.6.0_29]
	at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:89)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70)
[:3.1.0.RELEASE]
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
[:3.1.0.RELEASE]

On Fri, May 3, 2013 at 5:15 PM, Babak Vahdat
<ba...@swissonline.ch> wrote:
> Hi
>
> I assume the JAXB version being provided by JBoss 6 is pretty outdated and
> not really compliant with Camel 2.10.4 as JBoss 6 is from end 2010.
>
> Do you have any jaxb-impl inside your WAR/EAR being included? If not maybe
> try to add the following dependency inside the POM of your Web-App so that
> jaxb-impl-2.1.13.jar gets included into your WEB-INF/lib folder of your WAR
> getting precedence to the one from JBoss AS.
>
> <dependency>
>   <groupId>com.sun.xml.bind</groupId>
>   <artifactId>jaxb-impl</artifactId>
>   <version>2.1.13</version>
> </dependency>
>
> Babak
>
>
> Chris Wolf wrote
>> Has anyone seen this error?  I'm trying to deploy on JBoss6.  I was
>> able to deploy before without issues.  I guess
>> it's some kind of "classloader-Hell" issue due to JEE weirdness.
>>
>> Caused by: java.lang.ClassCastException:
>> org.apache.xerces.dom.DeferredElementNSImpl cannot be cast to
>> org.w3c.dom.Element
>>       at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:100)
>> [:2.2]
>>       at
>> com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:156)
>> [:2.2]
>>       at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:127)
>> [:2.2]
>>       at
>> org.apache.camel.spring.handler.CamelNamespaceHandler.parseUsingJaxb(CamelNamespaceHandler.java:166)
>> [:2.10.4]
>>       at
>> org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:306)
>> [:2.10.4]
>>       at
>> org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
>> [:3.1.0.RELEASE]
>>       at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
>> [:
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Class-Cast-error-upon-deploying-Camel-web-app-tp5732000p5732001.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Class Cast error upon deploying Camel web app

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

I assume the JAXB version being provided by JBoss 6 is pretty outdated and
not really compliant with Camel 2.10.4 as JBoss 6 is from end 2010.

Do you have any jaxb-impl inside your WAR/EAR being included? If not maybe
try to add the following dependency inside the POM of your Web-App so that
jaxb-impl-2.1.13.jar gets included into your WEB-INF/lib folder of your WAR
getting precedence to the one from JBoss AS.

<dependency>
  <groupId>com.sun.xml.bind</groupId>
  <artifactId>jaxb-impl</artifactId>
  <version>2.1.13</version>
</dependency>

Babak


Chris Wolf wrote
> Has anyone seen this error?  I'm trying to deploy on JBoss6.  I was
> able to deploy before without issues.  I guess
> it's some kind of "classloader-Hell" issue due to JEE weirdness.
> 
> Caused by: java.lang.ClassCastException:
> org.apache.xerces.dom.DeferredElementNSImpl cannot be cast to
> org.w3c.dom.Element
> 	at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:100)
> [:2.2]
> 	at
> com.sun.xml.bind.v2.runtime.BinderImpl.associativeUnmarshal(BinderImpl.java:156)
> [:2.2]
> 	at com.sun.xml.bind.v2.runtime.BinderImpl.unmarshal(BinderImpl.java:127)
> [:2.2]
> 	at
> org.apache.camel.spring.handler.CamelNamespaceHandler.parseUsingJaxb(CamelNamespaceHandler.java:166)
> [:2.10.4]
> 	at
> org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:306)
> [:2.10.4]
> 	at
> org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
> [:3.1.0.RELEASE]
> 	at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
> [:





--
View this message in context: http://camel.465427.n5.nabble.com/Class-Cast-error-upon-deploying-Camel-web-app-tp5732000p5732001.html
Sent from the Camel - Users mailing list archive at Nabble.com.