[jboss-user] [Installation, Configuration & DEPLOYMENT] - ClassCastException while while class transfering from ear to

zebathon do-not-reply at jboss.com
Wed Jul 25 22:58:30 EDT 2007


Hello,
I'm getting ClassCastException while while class (AccountManagerBean) loading from my ear to a war. I'm pretty sure that I don't have two versions of my class floating around (which I know can cause such an exception). Any help at all would be appreciated.

Here is the code from the servlet in the war.
Object object = EJB3Finder.lookup(AccountManager.class, AccountManagerBean.JNDI_LOCAL_BINDING);
  | 
  | 		AccountManagerBean accountManager = (AccountManagerBean) object;

I'm not doing any scoped class loading. This is a default jboss4.2.1 install with no changes to the class loading mechanism. The requesting code is in a servlet class in a war. The war is in the ear.  WindowsXP.

I've confirmed by the ucl log that my class (AccountManagerBean) is being found and loaded by the ear loader, and followed immediately by the ClassCaste as shown below.
anonymous wrote : 
  | [453359,RepositoryClassLoader,http-127.0.0.1-80-1] loadClass org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45} name=com.garmin.mb.account.manager.AccountManagerBean, loadClassDepth=0
  | [453359,RepositoryClassLoader,http-127.0.0.1-80-1] Loaded class from cache, com.garmin.mb.account.manager.AccountManagerBean at 8a58a5<CodeSource: (file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/activity-1.0-SNAPSHOT.jar <no signer certificates>)>
  | [453359,RepositoryClassLoader,http-127.0.0.1-80-1] loadClass org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45} name=com.garmin.mb.account.manager.AccountManagerBean class=class com.garmin.mb.account.manager.AccountManagerBean cl=org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45}
  | [453375,RepositoryClassLoader,http-127.0.0.1-80-1] loadClass org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45} name=java.lang.jaxws.ClassCastExceptionBean, loadClassDepth=0

Here are my class loading configs in tomcat
  <attribute name="Java2ClassLoadingCompliance">false</attribute>
  |       <attribute name="UseJBossWebLoader">false</attribute>
  |       <attribute name="FilteredPackages">javax.servlet</attribute>

Here is the report for a class search via UnifiedRepository mbean in the jmx console, which proves there is only one instance correct?

anonymous wrote : com.garmin.mb.account.manager.AccountManagerBean Information
  | Repository cache version:
  | com.garmin.mb.account.manager.AccountManagerBean(8a58a5).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45}
  | ..org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45}
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/activity-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/analyzer-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/dao-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/identifier-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/measurement-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/upload-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/kml-xjc-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/commons-logging-1.0.4.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/commons-lang-2.1.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/ehcache-1.2.4RC.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/stax-api-1.0.1.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/gpx-xjc-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/axm-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/persistence-api-1.0.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/stax-1.2.0.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/axm-xjc-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/tcx-xjc-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/sql-1.0-SNAPSHOT.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/wannabecool-1.0-SNAPSHOT-exp.war/
  | ..org.jboss.system.server.NoAnnotationURLClassLoader at 5d173
  | ..sun.misc.Launcher$AppClassLoader at 92e78c
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/lib/tools.jar
  | ....file:/C:/dev/jboss-4.2.1.GA/bin/run.jar
  | ..sun.misc.Launcher$ExtClassLoader at 9fbe93
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/jre/lib/ext/dnsns.jar
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/jre/lib/ext/localedata.jar
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/jre/lib/ext/localedata.pack
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/jre/lib/ext/sunjce_provider.jar
  | ....file:/C:/Program%20Files/Java/jdk1.5.0_11/jre/lib/ext/sunpkcs11.jar
  | ++++CodeSource: (file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/activity-1.0-SNAPSHOT.jar )
  | Implemented Interfaces:
  | ++interface com.garmin.mb.account.manager.AccountManager(16e2e5)
  | ++++ClassLoader: org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45}
  | ++++CodeSource: (file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear-contents/activity-1.0-SNAPSHOT.jar )
  | 
  | ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3 at a70122{ url=file:/C:/dev/jboss-4.2.1.GA/server/default/tmp/deploy/tmp31419motionbased-1.0-SNAPSHOT.ear ,addedOrder=45}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067662#4067662

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067662



More information about the jboss-user mailing list