Oracle JDBC driver conflict

怎甘沉沦 提交于 2019-12-05 13:32:21
randominstanceOfLivingThing

I am not sure why loading from web-inf/lib will not work. Most likely the classloader's are different.

Do the first two steps for diagnosis. After that try one of the two alternatives below to fix the problem.
1) Check if the class loaders are the same by comparing the rs.getObject().getClass('RATINGOBJ').getClassLoader() and oracle.sql.ARRAY.class.getClassLoader() If you do equals between the two classloaders, it should return false as it looks that the classloaders are different. Check an explanation at ClassCastException when casting to the same class

This problem has already been reported earlier in another forum at https://forums.oracle.com/message/9330314. Moving jars around in jboss will still result in same problems.

2) Find out the source jars from where the classes are getting loaded and remove the jar that you dont need. Find the jars for the two different classes by checking
rs.getObject().getClass('RATINGOBJ').getProtectionDomain().getCodeSource().getLocation() oracle.sql.ARRAY.class.getProtectionDomain().getCodeSource().getLocation() - Determine which JAR file a class is from

Possible Solutions:

a) If you need both the jars, y'll have to move the Jar of rs.getObject().getClass('RATINGOBJ').getProtectionDomain().getCodeSource().getLocation()

and create the module as specified at http://www.javaworld.com/community/node/8184.

b) If you still cant get classes to be loaded as you expect, Specify the library in jboss server library.

c) The last solution to force classes to be loaded from a particular jar is by specifying the jar in the bootclasspath.

You should not have any JDBC driver JARs at the WEB-INF/lib level. Java EE app servers need them to be at the app server level.

Move it into the default server /lib directory and see if that's better.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!