ClassCast Exception in JBoss AS 6... HELP T_T
rjbfigueroa Sep 6, 2010 3:47 PMHi. We have encountered an exception with the code that we have. When looking at the logs, it seems that there should be no error theoretically. Besides, the code was working with the previous versions (5,4,3) ... Was there something changed in AS 6 that might have affected this ?
Here is the code together with the log:
Object obj = lookupHome(SecurityManagerHome.JNDI_NAME, SecurityManagerHome.class);
System.out.println("****** SecurityManagerHome.class classloader [ "+SecurityManagerHome.class.getClassLoader().getClass().getName()+"]" );
System.out.println("****** obj instanceof "+obj.getClass().getName()+" ["+obj.getClass().getClassLoader().getClass().getName()+"]" );
Class[] intfcs = obj.getClass().getInterfaces();
if (intfcs!=null && intfcs.length>0){
for (int i =0 ; i<intfcs.length; i++){
System.out.println(i+": "+intfcs[i].getName());
}
}
SecurityManagerHome ret = (SecurityManagerHome)lookupHome(SecurityManagerHome.JNDI_NAME, SecurityManagerHome.class);
Corresponding Log:
2010-09-06 08:18:38,465 DEBUG [org.apache.axis.SOAPPart] (http-0.0.0.0-8180-1) Exit: SOAPPart::getAsSOAPEnvelope
2010-09-06 08:18:38,479 INFO [STDOUT] (http-0.0.0.0-8180-1) ****** SecurityManagerHome.class classloader [ org.jboss.classloader.spi.base.BaseClassLoader]
2010-09-06 08:18:38,480 INFO [STDOUT] (http-0.0.0.0-8180-1) ****** obj instanceof $Proxy225 [org.jboss.classloader.spi.base.BaseClassLoader]
2010-09-06 08:18:38,481 INFO [STDOUT] (http-0.0.0.0-8180-1) 0: com.xxxxx.xxxxx.SecurityManagerHome
2010-09-06 08:18:38,481 INFO [STDOUT] (http-0.0.0.0-8180-1) 1: javax.ejb.Handle
2010-09-06 08:18:38,481 ERROR [STDERR] (http-0.0.0.0-8180-1) java.lang.ClassCastException: $Proxy225 cannot be cast to com.xxxxx.xxxxx.SecurityManagerHome
2010-09-06 08:18:38,482 ERROR [STDERR] (http-0.0.0.0-8180-1) at com.xxxx.xxxxx.ServerManager.getSecurityManager(ServerManager.java:74)