Monday 15 March 2010

spring - ClassCastException: Can't cast oracle.sql.ARRAY to oracle.sql.ARRAY in JBoss 7.1.1.Final -



spring - ClassCastException: Can't cast oracle.sql.ARRAY to oracle.sql.ARRAY in JBoss 7.1.1.Final -

demoapp spring integration project deployed in jboss 7.1.1.final

the result returned stored procedure contains object of oracle.sql.array (object referring ojdbc jar of jboss module)

and tried converting oracle.sql.array throwing exception

code:

url resultjarlocation= resultmap.get("returnobj").getclass().getprotectiondomain().getcodesource().getlocation(); url appjarlocation = oracle.sql.array.class.getprotectiondomain().getcodesource().getlocation(); system.out.println("resultjarlocation : " + resultjarlocation); system.out.println("appjarlocation : " + appjarlocation); oracle.sql.array returnobj=(oracle.sql.array)resultmap.get("returnobj");

exception:

org.springframework.messaging.messagehandlingexception: java.lang.classcastexception: oracle.sql.array cannot cast oracle.sql.array

the application array class referring ojdbc jar in deployed application. result set array class referreing ojdbc jar jboss module sys output:

resultjarlocation : jar:file:/<jboss_home>/modules/com/oracle/ojdbc6/main/ojdbc6.jar appjarlocation : vfs:/<jboss_home>/bin/content/demoapp.war/web-inf/lib/ojdbc6.jar

you trying cast between classes loaded different classloaders. jvm distinguishes classes not name , bundle classloader used. in other words, jvm perspective trying cast string long; cannot. think can configuration. set either same classloader used, or classloaders in same hierarchy, take advantage of delegation.

i not familiar jboss (especially current versions) know has (or used have in past) different classloading strategy other application servers. checking documentation on classloading first option.

spring oracle oracle11g jboss7.x classloader

No comments:

Post a Comment