lrygiel
asked on
How to remove ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xml.bind.JAXBContext?
Help Me to resolve this issue:
I am deploying war file in JBOSS server, which is processing Weblogic Queue messages .
I was implemented below code to access and unmarshal xml messages from the Queue
.------------------------- ---------- ---------- ---------- ---------- ---------- --
public void onMessage(Message message) {
textMessage = (TextMessage) message;
stringMessage = textMessage.getText();
BILGMSG bilgMsg = null;
Line 166: JAXBContext jc = JAXBContext.newInstance("c om.bopeep. gen");
Unmarshaller unmarshaller = jc.createUnmarshaller();
bilgMsg = (BILGMSG) unmarshaller.unmarshal( new StreamSource( new StringReader(stringMessage )));
-------------------------- ---------- ---------- ---------- ---------- ---------- -----
I am using import javax.xml.bind.JAXBContext ; package from JDK 1.6 and JRE6.
JBOSS - jboss-eap-5.0, Spring Listeners.
-------------------------- ---------- ---------- ---------- ---------- ---------- -----
I am getting the following exception:
2011-08-23 09:32:07,694 WARN [org.springframework.jms.l istener.De faultMessa geListener Container] (jmsListenerContainer-1) Execution of JMS message listener failed, and no ErrorHandler has been set.
java.lang.ClassCastExcepti on: com.sun.xml.bind.v2.runtim e.JAXBCont extImpl cannot be cast to javax.xml.bind.JAXBContext
at javax.xml.bind.ContextFind er.newInst ance(Conte xtFinder.j ava:149)
at javax.xml.bind.ContextFind er.find(Co ntextFinde r.java:285 )
at javax.xml.bind.JAXBContext .newInstan ce(JAXBCon text.java: 372)
at javax.xml.bind.JAXBContext .newInstan ce(JAXBCon text.java: 337)
at javax.xml.bind.JAXBContext .newInstan ce(JAXBCon text.java: 244)
at com.dnb.bopeep.jms.listene r.CobsBill ingQ.onMes sage(CobsB illingQ.ja va:166)
Note: Please see the attached file with full log. server.log server.log server.log server.log
I am deploying war file in JBOSS server, which is processing Weblogic Queue messages .
I was implemented below code to access and unmarshal xml messages from the Queue
.-------------------------
public void onMessage(Message message) {
textMessage = (TextMessage) message;
stringMessage = textMessage.getText();
BILGMSG bilgMsg = null;
Line 166: JAXBContext jc = JAXBContext.newInstance("c
Unmarshaller unmarshaller = jc.createUnmarshaller();
bilgMsg = (BILGMSG) unmarshaller.unmarshal( new StreamSource( new StringReader(stringMessage
--------------------------
I am using import javax.xml.bind.JAXBContext
JBOSS - jboss-eap-5.0, Spring Listeners.
--------------------------
I am getting the following exception:
2011-08-23 09:32:07,694 WARN [org.springframework.jms.l
java.lang.ClassCastExcepti
at javax.xml.bind.ContextFind
at javax.xml.bind.ContextFind
at javax.xml.bind.JAXBContext
at javax.xml.bind.JAXBContext
at javax.xml.bind.JAXBContext
at com.dnb.bopeep.jms.listene
Note: Please see the attached file with full log. server.log server.log server.log server.log
ASKER
Thanks for your response.
1:
Added scope jaxb-api dependency in my POM file and build the war file, but issue is not resolved.
<groupId>javax.xml.bind</g
<artifactId>jaxb-api</arti
<version>2.1</version>
<scope>compile</scope>
</dependency>
2:
But i checked in my generated war file i do not have any jaxb-api.jar file. But i found having jar in JBOSS Server, Location : C:\jboss-eap-5.0\jboss-as\
I deleted this from this folder and build war and deployed again, but issue is not resolved.
It still seems logical that the issue is in the mix between jaxb-api.jar and jaxb-impl.jar
If you look in your lib and in application specific folders and find all the jars and make sure
that they come from the same package - you'll most probably find it
If you look in your lib and in application specific folders and find all the jars and make sure
that they come from the same package - you'll most probably find it
ASKER
Yan,
Application specific, i did not find any jar with this name, i checked in POM files and Buildpath too.
We have one jar file in the JBOSS location:
C:\jboss-eap-5.0\jboss-as\
I deleted this from this folder and build war and started server, getting following Exception.
Server needs this JAR for start .
Exception:
14:29:22,383 ERROR [AbstractKernelController]
java.lang.RuntimeException
at org.jboss.classloading.spi
at org.jboss.classloading.spi
at org.jboss.classloading.spi
No you have to have such jar - if you see only one of it don't delete it.
What about jaxb-api.jar
What about jaxb-api.jar
ASKER
I added text in previous comment.
I found one, having jar in JBOSS Server, Location : C:\jboss-eap-5.0\jboss-as\
Only one i have .
I do not have this jar in application specific folders.
And just added and tested in POM file. But no use,
I am deleting this from the pom file.
<dependency>
<groupId>sun-jaxb</groupId
<artifactId>jaxb-api</arti
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</g
<artifactId>jaxb-api</arti
<version>2.1</version>
<scope>compile</scope>
</dependency>
make a copy of your jaxb-api.jar and jaxb-impl.jar files into some temp or any other folder
rename these copies to .zip and open them with winzip
Check that they are form related packages
in your error you have .JAXBContextImpl from one package and JAXBContext frok another:
com.sun.xml.bind.v2.runtim e.JAXBCont extImpl cannot be cast to javax.xml.bind.JAXBContext
rename these copies to .zip and open them with winzip
Check that they are form related packages
in your error you have .JAXBContextImpl from one package and JAXBContext frok another:
com.sun.xml.bind.v2.runtim
ASKER
from jaxb-api.war - javax\xml\bind -JAXBContect.class
from jaxb-impl.jar - com\sun\xml\bind\v2\runtim
I am attaching jars u can see.
I think EE does not allow to attach jar's
My guess is that JAXBContextImpl.class should extend JAXBContext
but there is some mixup of jars and this is not happenning
My guess is that JAXBContextImpl.class should extend JAXBContext
but there is some mixup of jars and this is not happenning
Check this (it is with weblogic, so I'm not sure the solutyion with apply, but the situation is similar)
http://old.nabble.com/ClassCastException%3A-com.sun.xml.bind.v2.runtime.JAXBContextImpl-in-WebLogic-10-td26719107.html
After I put those jars into WEB-INF/lib and restarted, I got the
following:
java.lang.ClassCastExcepti
com.sun.xml.bind.v2.runtim
It appears that after I constructed an EAR for this project, put my jars
into the EAR, and set "prefer-application-packag
this error.
Do you knwo if both these jars came form the same source?
Say, both from JBOSS installation or maybe one from JBOSS, another came with application?
Say, both from JBOSS installation or maybe one from JBOSS, another came with application?
ASKER
You are right, JAXBContextImpl.class extending JAXBContext. I saw in api in initial time.
But we have these classes in our jar files which are there in JBOSS server.
I am asking you, need to add these jars in war file?
Well, it makes sense to try; maybe there is still this class somewhere else where
we do not see it and it clashes. So put them togetehr in war, maybe it will work
we do not see it and it clashes. So put them togetehr in war, maybe it will work
ASKER
If like that, i added dependencys for both jars, and created jars in and able to see those jars in WebINF/lib folder in war file, when i unzip that war file.
I think both are same , i guess no need to add these explicitly in war file.
Yes, maybe you are right.
Could you extract those two classes with zip and post them here, just two of them.
I think EE allows to attach .class
I think EE allows to attach .class
read this:
https://forum.hibernate.org/viewtopic.php?f=9&t=1005522
eneven though t is about hibernate, but they talk about jaxb
they are saying taht JDK 1.6 has its own JAXB classes.
If so and if you are using JDK 1.6 - maybe you should remove both of them.
Have you tried this way?
Aniother option - maybe you can try to run JBOSS with JDK 1.5 with both jars present - is it possible?
ASKER
ASKER
If i remove jaxb-api.jar, nothing problem
if i delete jaxb-impl.jar, JBOSS will be efect to start, it wont start.
I tried with both deleted.
if i delete jaxb-impl.jar, JBOSS will be efect to start, it wont start.
I tried with both deleted.
Could you check if your jaxb-impl.jar conrtains com.sun.xml.bind.api.JAXBR
Then maybe post it also
ASKER
I Tried with JDK 5 and JRE 5, got same problem.
12:40:27,929 WARN [DefaultMessageListenerCon
java.lang.ClassCastExcepti
at javax.xml.bind.ContextFind
at javax.xml.bind.ContextFind
at javax.xml.bind.JAXBContext
at javax.xml.bind.JAXBContext
at javax.xml.bind.JAXBContext
at com.dnb.bopeep.jms.listene
at org.springframework.jms.li
at org.springframework.jms.li
ASKER
Your Question:Could you check if your jaxb-impl.jar conrtains com.sun.xml.bind.api.JAXBR
My Answer: YES
jaxb-impl.jar - com\sun\xml\bind\api - JAXBRIContext.class
JAXBRIContext.class
It looks like com.sun.xml.bind.v2.runtim
so if com.sun.xml.bind.api.JAXBR
it should be able to cast com.sun.xml.bind.v2.runtim
That's why I wanted to look at this com.sun.xml.bind.api.JAXBR
So let's review a litle bit, as I maybe already forgot something - so you have both jaxb-api.jar and jaxb-impl.jar coming both form the
same installation of JBOSS - one would assume that they should work with one another.
Then you have war file which comes from different sources even probably with some stuff from weblogic.
Does this war contain any jars referring to jaxb ?
ASKER
TRUE.
See the below link. Just for ref:
URL: http://www.docjar.org/docs/api/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.html
Like this :
com.sun.xml.internal.bind. v2.runtime
public final class: JAXBContextImpl [javadoc | source]
java.lang.Object
javax.xml.bind.JAXBContext
com.sun.xml.internal.bind. api.JAXBRI Context
com.sun.xml.internal.bind. v2.runtime .JAXBConte xtImpl
This class provides the implementation of JAXBContext.
See the below link. Just for ref:
URL: http://www.docjar.org/docs/api/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.html
Like this :
com.sun.xml.internal.bind.
public final class: JAXBContextImpl [javadoc | source]
java.lang.Object
javax.xml.bind.JAXBContext
com.sun.xml.internal.bind.
com.sun.xml.internal.bind.
This class provides the implementation of JAXBContext.
ASKER
I am using Eclipse to setup the app and JDK JRE 6. Implemented JMS -MessageListener,
This Listener is retriving message from the Weblogic Q. And validating, processing and storing data in the DB.
Using Maven script to build the app.
Usingmvn command : mvn clean install. (creating war file)
This war file doesnt contain any jaxb-iml or jaxb-api.jar files.
If i add dependency in pom file it will be there in war file.
Its creating war file. And we are using JBOSS -eap 5.0 server to deploy.
Maybe it is sometghing related to this:
from:
http://hg.nuxeo.org/nuxeo/nuxeo-distribution/raw-file/5.2/nuxeo-distribution-jboss/src/main/resources/jboss/readme-jboss.html
JBossAS 4.2.3.GA
JBossAS 4.2.3.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/client directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
jboss-jaxrpc.jar
jboss-jaxws.jar
jboss-jaxws-ext.jar
jboss-saaj.jar
jaxb-api.jar
Have you copied these jars?
ASKER
We have only one jar file
C:\jboss-eap-5.0\jboss-as\
and i have jaxb-iml.jar too.
But this jaxb-api.jar you copied it to JBOSS_HOME/lib/endorsed directory ?
Read the following from
http://bimalesh.blogspot.com/2007/05/jboss-jaxb-and-jdk-16.html
especially about Eclipse situation little bit below:
While using JBoss 4.0.2, JAXB 2.1 and JDK 1.6 (a.k.a J2SE 6.0) if you get a linkage error similar to one discussed here then you should put jaxb-api.jar from JAXB RI into the endorsed directory used by Jboss. Putting it under jre/lib/endorsed directory has no affect as JBoss overrides the endorsed directory with its own. Place the jaxb-api.jar into $jboss-home/lib/endorsed directory instead. It should solve the linkage problem.
JoPe said...
Let me add one more thing: If you start your JBoss from Eclipse using JBoss Tools, just putting the jaxb-api.jar into JBOSS_HOME/lib/endorsed won't help, because the JBoss Tools launch configuration ignores this directory unless you enter the VM argument -Djava.endorsed.dirs=YOUR/
1:17 AM
Anonymous said...
Thanks! This also fixed a little different problem for me. However, it was a caused by a conflict in my servlet using Jaxb as does Jboss. I was getting:
java.lang.ClassCastExcepti
I'm using Jaxb-api 2.1
10:42 PM
ASKER
Starting JBOSS from the eclipse and directly using run.bat file from the JBOSS folder.
Both are getting same problem like what we have now.
I still have a feeling taht we are somewhere close to understanding
read this from
http://metro.java.net/guide/Using_JAX_WS_2_1_with_JavaSE6.html
and i came here form this page which talks about very similar error:
https://forums.oracle.com/forums/thread.jspa?threadID=2223594
-------------------------- -
2.8. Using JAX-WS 2.1 with JavaSE6
JavaSE6 ships with JAX-WS 2.0 API in rt.jar, which causes some trouble when you try to run applications that use JAX-WS 2.1 API. This document collects information about how to solve this issue.
2.8.1. Endorsed directory
One way to fix this is to copy jaxws-api.jar and jaxb-api.jar into JRE endorsed directory, which is $JAVA_HOME/lib/endorsed (or $JDK_HOME/jre/lib/endorsed )
Some application containers, such as Glassfish, modifies the location of the endorsed directory to a different place. From inside the JVM, you can check the current location by doing System.out.println(System. getPropert y("java.en dorsed.dir s"));
Obviously you still need other JAX-WS jars in your classpath.
Please do not put all the jars to the endorsed directory. This makes it impossible for JAX-WS RI to see other classes that it needs for its operation, such as servlet classes on the server-side, or Ant classes in the tool time. As those are not loaded by the bootstrap classloader, you'll get NoClassDefError on servlet/Ant classes.
-------------------------- ---
Also read this from
the bottom of
http://weblogs.java.net/blog/ramapulavarthi/archive/2007/01/problems_using.html
-------------------------- ---------- -------
Sometimes its pretty clear what the error is, but not in all cases. JAXB 2.0 and JAX-WS 2.0 are part of JDK 6. To use JAX-WS 2.1 with JDK 6, newer versions of API jars (JAX-WS 2.1 and JAXB 2.1 API jars) need to be in bootclasspath before rt.jar. To do this you can use Java endorsed mechanism to override whats in Java platform. See http://java.sun.com/j2se/1.5.0/docs/guide/standards/ for more details on Endorsed Standards Override Mechanism.
To get around this issue, You can simply copy jaxb-api.jar, jaxws-api.jar to <java-home>/lib/endorsed Here <java-home> refers to the directory where the runtime software is installed (which is the top-level directory of the J2SE Runtime Environment or the jre directory in the JDK).
If you prefer to not change JDK, For invoking wsimport and wsgen tools in JAX-WS 2.1, you can set WSIMPORT_OPTS=-Djava.endor sed.dirs=% JAXWS_HOME %/lib & WSGEN_OPTS=-Djava.endorsed .dirs=%JAX WS_HOME%/l ib, where JAXWS_HOME points to JAX-WS 2.1 installation.
If you use ant tasks, you can pass -Djava.endorsed.dirs=%JAXW S_HOME%/li b as jvmarg while calling wsimport and wsgen ant tasks. For this to work, you need to set fork="true" attribute of wsimport and wsgen ant tasks.
-------------------------- ---------- ---------- -------
read this from
http://metro.java.net/guide/Using_JAX_WS_2_1_with_JavaSE6.html
and i came here form this page which talks about very similar error:
https://forums.oracle.com/forums/thread.jspa?threadID=2223594
--------------------------
2.8. Using JAX-WS 2.1 with JavaSE6
JavaSE6 ships with JAX-WS 2.0 API in rt.jar, which causes some trouble when you try to run applications that use JAX-WS 2.1 API. This document collects information about how to solve this issue.
2.8.1. Endorsed directory
One way to fix this is to copy jaxws-api.jar and jaxb-api.jar into JRE endorsed directory, which is $JAVA_HOME/lib/endorsed (or $JDK_HOME/jre/lib/endorsed
Some application containers, such as Glassfish, modifies the location of the endorsed directory to a different place. From inside the JVM, you can check the current location by doing System.out.println(System.
Obviously you still need other JAX-WS jars in your classpath.
Please do not put all the jars to the endorsed directory. This makes it impossible for JAX-WS RI to see other classes that it needs for its operation, such as servlet classes on the server-side, or Ant classes in the tool time. As those are not loaded by the bootstrap classloader, you'll get NoClassDefError on servlet/Ant classes.
--------------------------
Also read this from
the bottom of
http://weblogs.java.net/blog/ramapulavarthi/archive/2007/01/problems_using.html
--------------------------
Sometimes its pretty clear what the error is, but not in all cases. JAXB 2.0 and JAX-WS 2.0 are part of JDK 6. To use JAX-WS 2.1 with JDK 6, newer versions of API jars (JAX-WS 2.1 and JAXB 2.1 API jars) need to be in bootclasspath before rt.jar. To do this you can use Java endorsed mechanism to override whats in Java platform. See http://java.sun.com/j2se/1.5.0/docs/guide/standards/ for more details on Endorsed Standards Override Mechanism.
To get around this issue, You can simply copy jaxb-api.jar, jaxws-api.jar to <java-home>/lib/endorsed Here <java-home> refers to the directory where the runtime software is installed (which is the top-level directory of the J2SE Runtime Environment or the jre directory in the JDK).
If you prefer to not change JDK, For invoking wsimport and wsgen tools in JAX-WS 2.1, you can set WSIMPORT_OPTS=-Djava.endor
If you use ant tasks, you can pass -Djava.endorsed.dirs=%JAXW
--------------------------
Also read this general useful info about what to do when you want to override some classes
which are sitting in rt.jar by the newer versions:
http://download.oracle.com/javase/6/docs/technotes/guides/standards/
ASKER
I did not installed any JAX-WS 2.1 separately. Just i add JAVA-HOME and JBOSS-HOME in the classpath.
I coudnt find any like $JAVA_HOME/lib/endorsed (or $JDK_HOME/jre/lib/endorsed
If installed JAX-WS 2.1 then i can set
WSIMPORT_OPTS=-Djava.endor
Could you tell where JAX-WS jars will be rside.
ASKER
One thing i want to say.
I tested with war file which is created by relese guys. That war is generated with same source and build using Hudson. I took that war file deployed in my local JBOSS server and passed messages to Queues In WL in my local. Wonder it was working fine, i did not see any issues, able to process Queue message and processed and stored data in the database.
Here In production or DEV environment they changed folder structure in JBOSS server.
Could you guess any thing wrong in change the folder structure?
I am using default folder structure only.
I don't think you need to install anything. And you don't have any lib/endorsed folder because you didn't need to override anytjing in your standard libraryt bbefore. I think you need to create endorsed folder in JAVA_HOME/lib and copy to that folder jaxb-api from your JBOiSS locattion. Then resytart JBOSS and try
if it is working fine, what may be the pproblem with changed folder structure? Don't think it matters.
ASKER
created endorsed folder in JAVA_HOME/lib and copy to that folder jaxb-api and next copied jaxb-impl,jar too.
C:\Program Files\Java\jdk1.6.0_26\lib
But got the sme exception.
ASKER
Yan,
Still issue is not resolved, could you give any direction to solve the issue,
Thanks
Still issue is not resolved, could you give any direction to solve the issue,
Thanks
This war appliaction - is it something that you wrote youself, or did you get it from someone?
Is it processing WebLogic messages - just works as the client?
If you wrote it - maybe you can extrct those parts and make just simple client application of it
and see if it works. In this way you'll disconnecte from JBoss depndencies and we can check
which jars are working and which are not. With that knowledge it would probably be better to trty to
figure out what to do on the server
If you wrote it - maybe you can extrct those parts and make just simple client application of it
and see if it works. In this way you'll disconnecte from JBoss depndencies and we can check
which jars are working and which are not. With that knowledge it would probably be better to trty to
figure out what to do on the server
ASKER
This is JAVA Web application, implemented and checked in subversion, I am as a new guy wants to setup app on my system. So i took source from the subversion and created WAR in my local with MAVEN build tool. No issues to create war. Then i am deploying in My local JBOSS server. This app reading Queue mesaages from Weblogic Q(Which is also in my local). App reading Message properly and printing the message in the console. After that needs to unmarshal using JAXBContect class.
that JAXBContect line166 giving the problem.
Ref Code:
public void onMessage(Message message) {
textMessage = (TextMessage) message;
stringMessage = textMessage.getText();
BILGMSG bilgMsg = null;
Line 166: JAXBContext jc = JAXBContext.newInstance("c
Unmarshaller unmarshaller = jc.createUnmarshaller();
bilgMsg = (BILGMSG) unmarshaller.unmarshal( new StreamSource( new StringReader(stringMessage
error:
java.lang.ClassCastExcepti
Please see the full error log in above responses.
2nd Response:
We are using JBOSS server specific DataSource connection creation, using xxx-ds.xml file.and using properties files for setup Weblogic server address and Queue names. These properties files are configuring in spring.xml file.
<bean class="org.springframework
<constructor-arg>
<bean class="org.springframework
<property name="jndiName" value="external/config/dnb
</bean>
</constructor-arg>
</bean>
<bean class="org.springframework
<constructor-arg>
<bean class="org.springframework
<property name="jndiName" value="external/config/dnb
</bean>
</constructor-arg>
</bean>
Note: Same way doing in production, but production war file deployed in my local JBOSS server and accesses Queues from My local WL Queues. Its fine, no issues.
I am using pure xml format message, getting this as string and unmarshling using JAXBContext.like
stringMessage = textMessage.getText();
bilgMsg = (BILGMSG) unmarshaller.unmarshal( new StreamSource( new StringReader(stringMessage
I di dnot get your point like (If you wrote it ), could ypou tell me clearly?
Thanks
No, if you downloaded the source, then my suggestion would be not appropriate.
Didi you see this thread:
http://www.eclipse.org/forums/index.php/m/719379/
There is no confirmation of resolution, still you ca try some suggestions
ASKER
Yan,
Could you help me where can i find DomainClass.class.getClass
Just i added in my code like
JAXBContext jc = JAXBContext.newInstance("c
But DomainClass.classnot gound, could you tell need to download any jar or?
Thnaks
Maybe you can try this.class.getClassLoader( ) ?
ASKER
I am sorry,
this.class, getting class identifier expecting. Showing error.
Sorry, I guess, this will work (I mean will not write this latest error):
this.getClass().getClassLo ader()
this.getClass().getClassLo
ASKER
Hi Yan,
I used like below
JAXBContext jc = JAXBContext.newInstance("c om.bopeep. gen", this.getClass().getClassLo ader());
but got the same exception.
I used like below
JAXBContext jc = JAXBContext.newInstance("c
but got the same exception.
I was thinking you are using JBoss, but the log files you posted are talking something about Catalina and Tomcat
So you are running Tomcat and JBoss?
in this link
http://www.java.net/node/693919
which describes similar ClassCast excepton
I read:
-------------
Yes, seems like standalone JAXB RI is being picked up whereas JAX-WS is still used from JDK.
Can you use JDK 6u14 that has JAX-WS 2.1.6 RI directly without the endorsed mechanism?
-------------
Which minor version of JDK6 are you using?
So you are running Tomcat and JBoss?
in this link
http://www.java.net/node/693919
which describes similar ClassCast excepton
I read:
-------------
Yes, seems like standalone JAXB RI is being picked up whereas JAX-WS is still used from JDK.
Can you use JDK 6u14 that has JAX-WS 2.1.6 RI directly without the endorsed mechanism?
-------------
Which minor version of JDK6 are you using?
ASKER
Hi Yan,
I am not using Catalina, i did not find any word in my log file like " Catalina".
Yesterday only i tried to deploy on Tomcat, but i did not send any log file regarding that.
If you want i can send today JBOSS log file
I am using jdk1.6.0_26 and jre6.
I am trying to use JDK 6u14 (Which you suggested)
Thanks
No, I think jdk1.6.0_26 is later than JDK 6u14
so you don't need to change -I understan their remark that you should not be on earlier JDK, but later should be OK.
These are the lines form the very first log file you posted bove - you see it has a lot of words about Tomcat, Cataklina, etdc
(by the way I could have seen there that you are using 1.6.0_26
2011-08-23 09:31:41,452 INFO [org.apache.catalina.core. AprLifecyc leListener ] (main) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_26\bin ;C:\Window s\Sun\Java \bin;C:\Wi ndows\syst em32;C:\Wi ndows;C:\P rogram Files\Serena\Dimensions 12.1\CM\prog64;C:\Program Files\Serena\Dimensions 12.1\CM\prog;C:\Program Files\Serena\Dimensions 12.1\CM\prog\Microsoft.VC9 0.MFC;C:\P rogram Files\Serena\Dimensions 12.1\CM\prog\Microsoft.VC9 0.CRT;C:\P rogram Files\Serena\Dimensions 12.1\CM\prog\Microsoft.VC9 0.ATL;C:\W indows\sys tem32;C:\W indows;C:\ Windows\Sy stem32\Wbe m;C:\Windo ws\System3 2\WindowsP owerShell\ v1.0\;C:\P rogram Files\Common Files\Ulead Systems\MPEG;C:\Program Files\RSA Security\RSA SecurID Software Token\;C:\Program Files\Lenovo\Access Connections\;C:\SWTOOLS\Re adyApps;C: \Program Files\Common Files\Lenovo;C:\Program Files\Intel\WiFi\bin\;C:\P rogram Files\Common Files\Intel\WirelessCommon \;C:\Progr am Files\Java\jdk1.6.0_26/bin ;C:\jboss- eap-5.0\jb oss-as/bin ;C:\apache -maven-2.2 .1/bin;C:\ Program Files\Intel\WiFi\bin\;C:\P rogram Files\Common Files\Intel\WirelessCommon \;.
2011-08-23 09:31:41,499 INFO [org.apache.coyote.http11. Http11Prot ocol] (main) Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
2011-08-23 09:31:41,499 INFO [org.apache.coyote.ajp.Ajp Protocol] (main) Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
2011-08-23 09:31:41,530 INFO [org.apache.catalina.core. StandardSe rvice] (main) Starting service jboss.web
2011-08-23 09:31:41,546 INFO [org.apache.catalina.core. StandardEn gine] (main) Starting Servlet Engine: JBoss Web/2.1.3
so you don't need to change -I understan their remark that you should not be on earlier JDK, but later should be OK.
These are the lines form the very first log file you posted bove - you see it has a lot of words about Tomcat, Cataklina, etdc
(by the way I could have seen there that you are using 1.6.0_26
2011-08-23 09:31:41,452 INFO [org.apache.catalina.core.
2011-08-23 09:31:41,499 INFO [org.apache.coyote.http11.
2011-08-23 09:31:41,499 INFO [org.apache.coyote.ajp.Ajp
2011-08-23 09:31:41,530 INFO [org.apache.catalina.core.
2011-08-23 09:31:41,546 INFO [org.apache.catalina.core.
ASKER
Yan,
I set claspath C:\Program Files\Java\jdk1.6.0_14.
But no difference, getting same issue.
Thanks
ASKER
I am sorry, i did not see ur comment.
Ignore the previous message.
Ignore the previous message.
Do you know why you have catalina, tomcat there?
ASKER
Yes Yan. I am sorry. You are rite.
But i am not explicitly configured any related to tomcat or catalina.
But i am not explicitly configured any related to tomcat or catalina.
ASKER
I am sorry yan, i have no idea about those.
I compare these postings of yours:
>I tested with war file which is created by relese guys. That war is generated with same source and build using Hudson. I took that war file deployed in my local JBOSS server and >passed messages to Queues In WL in my local. Wonder it was working fine, i did not see any issues, able to process Queue message and processed and stored data in the database.
and
>So i took source from the subversion and created WAR in my local with MAVEN build tool. No issues to create war. Then i am deploying in My local JBOSS server
So when you take their WAR and deploy, everything runs smoothly
and when you compile yourself and create your WAR and deploy it in the same server - it fails - correct?
If so, can't you extract both wars in two separate places and compare and try to see what is the difference?
ASKER
Hi Yan,
Idid the same, no difference between those two wars. same jar files are having both WAR files.
Thanks
Idid the same, no difference between those two wars. same jar files are having both WAR files.
Thanks
But is it true that with one WAR it is working and with another one it is not working?
Is there some other difference?
Is there some other difference?
ASKER
i only compare list of jars in both war files and both are same, i did not compare in side jars.
i have to do that and i will try
thanks
i have to do that and i will try
thanks
well compare and if you don't see anything special "cross-breed" or better to say "chimerize" them - take you jaxb jars form the good one and put them into
the bad one instead of those you have there (of course keep a copy of everything).
the bad one instead of those you have there (of course keep a copy of everything).
ASKER
Yan,
I did compare, i found size of few jars are loacl is different than production jars.
One more thing, ojdbc size also huge difference is there.
all prject jars are little diffrence is there.
ojdbc6-0.0.1-SNAPSHOT.jar - local size 1988,051 and prod 3217,836
Could you guess both should be the same size, because prod and local using same source.
Thanks
I did compare, i found size of few jars are loacl is different than production jars.
One more thing, ojdbc size also huge difference is there.
all prject jars are little diffrence is there.
ojdbc6-0.0.1-SNAPSHOT.jar - local size 1988,051 and prod 3217,836
Could you guess both should be the same size, because prod and local using same source.
Thanks
ojdbc is not something which you compile I guess - it is some different version
of jdbc driver form oracle - ?
Are those controversioal jars - jaxb related different?
of jdbc driver form oracle - ?
Are those controversioal jars - jaxb related different?
ASKER
No,
i am not importing any JAXB related Jars explicitly, just using JBOSS inbuilt jars like jaxb-impl.jar and jaxb-api.jar, etc.. and JDK 1.6. Which i am using JaxbContext is from JDK api.
import javax.xml.bind.JAXBContext ;
import javax.xml.bind.JAXBExcepti on;
JAXBContext jc = JAXBContext.newInstance("c om.dnb.bop eep.gen");
i am not importing any JAXB related Jars explicitly, just using JBOSS inbuilt jars like jaxb-impl.jar and jaxb-api.jar, etc.. and JDK 1.6. Which i am using JaxbContext is from JDK api.
import javax.xml.bind.JAXBContext
import javax.xml.bind.JAXBExcepti
JAXBContext jc = JAXBContext.newInstance("c
That nmeans that in both cases you are usinf the same jaxb but in one case it works and in anothr throws this classCast exception ?
ASKER
Yes, you r rite.
That's strange - maybe there are still somewhere in the classpath other versions of these classes of which we don't suspect.
Maybe you can use stuff from this page (read also reamark at the bottom - maybe it will work)
http://snippets.dzone.com/posts/show/3472
and you can put it in your code and try to printout the location of jar file
from which both of these guys (JAXBConrtext and JAXBContextImpl) are coming?
ASKER
i checked classpath in JBOSS run.bat file. Compared with prod JBOSS image, Both are having same files. I checked System Environment variables. JBOSS_HOME, JAVA_HOME and M_HOME are added.
ASKER
JAXBConrtext is comming from JAVA api and JAXBContextImpl (com.sun.xml.bind.v2.runti
What that means?
JAXBConrtext is comming from JAVA api
JAXBConrtext is comming from JAVA api
Is it rt.jar?
ASKER
yes
And how do you know from where each comes ?
ASKER
According to exception i searched in google with com.sun.xml.bind.v2.runtim e.JAXBCont extImpl class, this class is there in jaxb-impl.jar.
And JAXBContext class is from rt.jar, this class belongs to this jar only, because if i delete import it is showing class not found exception.
C:\Program Files\Java\jdk1.6.0_26\jre \lib>rt.ja r
When i start run.bat from the JBOSS, its calling JBOSS_HOME and CLASSPATH
from the command promt:
Calling C:\jboss-eap-5.0\jboss-as\ bin\run.co nf.bat
========================== ========== ========== ========== ========== ========== ===
JBoss Bootstrap Environment
JBOSS_HOME: C:\jboss-eap-5.0\jboss-as
JAVA: C:\Program Files\Java\jdk1.6.0_26\bin \java
JAVA_OPTS: -Dprogram.name=run.bat -Xms128M -Xmx512M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInt erval=3600 000 -Dsun.rmi.dgc.server.gcInt erval=3600 000 -Dorg.jboss.resolver.warni ng=true -server
CLASSPATH: C:\Program Files\Java\jdk1.6.0_26\lib \tools.jar ;C:\jboss- eap-5.0\jb oss-as\bin \run.jar
And JAXBContext class is from rt.jar, this class belongs to this jar only, because if i delete import it is showing class not found exception.
C:\Program Files\Java\jdk1.6.0_26\jre
When i start run.bat from the JBOSS, its calling JBOSS_HOME and CLASSPATH
from the command promt:
Calling C:\jboss-eap-5.0\jboss-as\
==========================
JBoss Bootstrap Environment
JBOSS_HOME: C:\jboss-eap-5.0\jboss-as
JAVA: C:\Program Files\Java\jdk1.6.0_26\bin
JAVA_OPTS: -Dprogram.name=run.bat -Xms128M -Xmx512M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInt
CLASSPATH: C:\Program Files\Java\jdk1.6.0_26\lib
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If i remove jaxb-impl.jar from the jboss , if you try to start this server will throw an exception.
Meens will not be start the server.
I am implementing code to print thaose jar clasees path.
It is strange that this lib/endorsed mechanism which should override
the stuff from rt.jar does not seem to work for you.
Anyway if we could print from where it comes it will allow us to undersatnd better
the stuff from rt.jar does not seem to work for you.
Anyway if we could print from where it comes it will allow us to undersatnd better
ASKER
Example code(http://snippets.dzone.com/posts/show/3472)
implemented in my calss, but that is giving location name where we are using JAXBContext class
C:/jboss-eap-5.0/jboss-as/
I am trying to print zar file name. if you any idea or example code just forward it to me.
ASKER
Yan,
I found from where JAXBContext is calling. this is not calling form rt.jar, caling from the different place.
that is from :
JAXBContext JAR*********************** ********** ********** *****jar:f ile:/C:/jb oss-eap-5. 0/jboss-as /server/de fault/depl oy/bopeep- billing-wa r.war!/WEB -INF/lib/w lfullclien t-no-javax -10.3.jar
I did unzar war file: C:\Users\parisac\Desktop\D ocs\WAR\Lo cal War\WEB-INF\lib > in this we have list of jar files. one is wlfullclient-no-javax-10.3 .jar (this is added in buildpath for the project)
I unzar wlfullclient-no-javax-10.3 .jar , that i pound that call in below location.
C:\Users\parisac\Desktop\D ocs\WAR\Lo cal War\New folder\javax\xml\bind>JAXB Context.cl ass is there.
I found from where JAXBContext is calling. this is not calling form rt.jar, caling from the different place.
that is from :
JAXBContext JAR***********************
I did unzar war file: C:\Users\parisac\Desktop\D
I unzar wlfullclient-no-javax-10.3
C:\Users\parisac\Desktop\D
So we somehow need to have both of them should come form the same origin say both from JBoss or both from JDK.
It looks like both coming form JBoss but not from complemnantry jaxb-impl.jar and jaxb-api.jar which were created together - perhaps that is the problem?
It looks like both coming form JBoss but not from complemnantry jaxb-impl.jar and jaxb-api.jar which were created together - perhaps that is the problem?
ASKER
Hi Yan,
Good News after long time.
Finally able to process the message and store the data in the database.
Thank you so much, You are really GENIUS, Your help is very appriciated.
I am explaining the problem and solution in next message.
Thank You.
Good News after long time.
Finally able to process the message and store the data in the database.
Thank you so much, You are really GENIUS, Your help is very appriciated.
I am explaining the problem and solution in next message.
Thank You.
Great news!
Sure, please, explain, when you have a moment.
Sure, please, explain, when you have a moment.
ASKER
Hi Yan,
You know i took source from the subversion. In local i am using Eclipse IDE. Imported list of dependency projects into the eclipse. I set the required build path for few projects. I am using MAVEN build tool to build the project. In war project pom file set the list of dependencies. One of those is
<dependency>
<groupId>weblogic.wlfullcl ient</grou pId>
<artifactId>wlfullclient-n o-javax</a rtifactId>
<version>10.3</version>
</dependency>
And remaining are related to Spring, Ojdbc, Log4j, etc...
when i build initiallly it shows missing dependencies. those are Ojdbc and weblogic.wlfullclient. So i spoke to my Admin guys, they told need to download manually. So i did that and installed using explicit commands like :
-> mvn install:install-file -DgroupId=weblogic.wlfullc lient -DartifactId=wlfullclient- no-javax -Dversion=10.3 -Dpackaging=jar -Dfile=C:\Libs\weblogic\wl fullclient .jar
So dependency problem is solved. Then i set build path based on the exceptions.
When romoved all exceptions and able to build the war file. Here is the problem. When i deployed war file in JBOSS server and trying to start the server thrown exception like
-> java.lang.ClassCastExcepti on: com.sun.xml.bind.v2.runtim e.JAXBCont extImpl cannot be cast to javax.xml.bind.JAXBContext .
Then i spoke to release guys to get the solution, and i got the production war file and deployed in local JBOSS server its wonder , it works fine. So i thought issue with the source and jars. But not able to figure it out.
Then started chating with you to get the help. Then you know what we did.
Finally i came to know few jars size is diffenrent than production jars. You gave on link to get the code to find JAXBContext class is calling from which jar.
Code and New link:
http://www.jugpadova.it/articles/2005/11/13/from-which-jar-a-class-was-loaded
Class cls = JAXBContext.class;
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation();
System.out.println("JAXBCo ntext JAR*********************** ********** ********** *****"+loc );
Identified jar and unzip that jars (local and production)
Local : C:\Users\parisac\Desktop\D ocs\WAR\Lo cal War\New folder\javax
Production : C:\Users\parisac\Desktop\D ocs\WAR\pr oduction War \New folder - NO JAVAX folder in this .
This is the root cause to the problem. I thought getting exception with this. Then i replaced my local wlfullclient-no-javax-10.3 .jar with production jar.
Problem is solved.
Thank You Yan. You spent valuable time.
You know i took source from the subversion. In local i am using Eclipse IDE. Imported list of dependency projects into the eclipse. I set the required build path for few projects. I am using MAVEN build tool to build the project. In war project pom file set the list of dependencies. One of those is
<dependency>
<groupId>weblogic.wlfullcl
<artifactId>wlfullclient-n
<version>10.3</version>
</dependency>
And remaining are related to Spring, Ojdbc, Log4j, etc...
when i build initiallly it shows missing dependencies. those are Ojdbc and weblogic.wlfullclient. So i spoke to my Admin guys, they told need to download manually. So i did that and installed using explicit commands like :
-> mvn install:install-file -DgroupId=weblogic.wlfullc
So dependency problem is solved. Then i set build path based on the exceptions.
When romoved all exceptions and able to build the war file. Here is the problem. When i deployed war file in JBOSS server and trying to start the server thrown exception like
-> java.lang.ClassCastExcepti
Then i spoke to release guys to get the solution, and i got the production war file and deployed in local JBOSS server its wonder , it works fine. So i thought issue with the source and jars. But not able to figure it out.
Then started chating with you to get the help. Then you know what we did.
Finally i came to know few jars size is diffenrent than production jars. You gave on link to get the code to find JAXBContext class is calling from which jar.
Code and New link:
http://www.jugpadova.it/articles/2005/11/13/from-which-jar-a-class-was-loaded
Class cls = JAXBContext.class;
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation();
System.out.println("JAXBCo
Identified jar and unzip that jars (local and production)
Local : C:\Users\parisac\Desktop\D
Production : C:\Users\parisac\Desktop\D
This is the root cause to the problem. I thought getting exception with this. Then i replaced my local wlfullclient-no-javax-10.3
Problem is solved.
Thank You Yan. You spent valuable time.
ASKER
Missing output in previous message:
Code and New link:
http://www.jugpadova.it/articles/2005/11/13/from-which-jar-a-class-was-loaded
Class cls = JAXBContext.class;
ProtectionDomain pDomain = cls.getProtectionDomain();
CodeSource cSource = pDomain.getCodeSource();
URL loc = cSource.getLocation();
System.out.println("JAXBCo
Output :
JAXBContext JAR***********************
Great!
Thanks a lot for summarizing all this. This would be useful, especially this thing where we printed locations of the jars. Folks often have clashes of the classes coming froim different sources and this seems to be a good way to find a resolution of some of such issues.
Best of luck!
Thanks a lot for summarizing all this. This would be useful, especially this thing where we printed locations of the jars. Folks often have clashes of the classes coming froim different sources and this seems to be a good way to find a resolution of some of such issues.
Best of luck!
ASKER
Probably the longest thread I have ever seen on EE, thanks to YAN's persistance was able to work through the probelm to the solutions. A+++ and 5000 point if I could give them.
Thanks for the kind words.
EE should make an amendment in their rules and allow the Asker for the long threads to add 100 points, say, per each 25 Asker's posts.
EE should make an amendment in their rules and allow the Asker for the long threads to add 100 points, say, per each 25 Asker's posts.
Maybe this could be of some help:
http://forum.springsource.org/showthread.php?47947-ClassCastException-with-JAXB-on-JBoss
I finally figured it out. There are so many things included in JBoss that dependency management becomes really tricky there. In fact, in the default configuration, there is a jbossws.sar application which includes jaxb-api and jaxb-impl.
So if we deploy the application with jaxb-api in it, there is a NullPointerException caused by a ClassCastException because ContextImpl is an instance of the server-wide Context, and not an instance of the application-local Context interface.
So the solution is just to scope jaxb-api dependency as provided and we're all set.
and this:
http://terrycmartin.blogspot.com/2009/05/jboss-seam-rss-feeds-on-jboss-as-423.html
Terry C. Martin
Thursday, May 14, 2009
JBoss Seam RSS Feeds on JBoss AS 4.2.3
I need to keep this short cuz I'm ready to go to bed. Ran into this error:
jboss com.sun.xml.bind.v2.runtim
when I tried to click on a link on my Seam app that links to an RSS page I created. This app with its RSS functionality worked just fine on my dev box, but prod gave me that error. Lemme cut to the chase... I ended up removing jaxb-api.jar from my war file (I unzipped it, removed the file, then zipped it back up and redeployed it) and that fixed the problem. Apparently, I had some other jaxb lib in my JBoss AS classpath... somewhere... causing that trouble. Incidentally, I was running the same version of JBoss AS on dev & prod and same JVM too. I don't even feel like searching around for the conflicting jaxb lib right now... just wanted to jot this note down cuz I'll almost CERTAINLY forget i encountered this issue before.