Oracle Weblogic adding jars to the classpath?

JonH picture JonH · Jun 19, 2012 · Viewed 37.1k times · Source

How do you add jars to the class path for Oracle 10.3.5...As I understood it, there is a bug (or incorrect info) with the documentation (readme) that states that any jars placed in the $DOMAIN_HOME/lib directory would be added to the classpath dynamically...but in the real documentation for 10.3.3 it states that these files dont get added to the classpath anymore...

so here I am trying to find out -- how do you add jars to the classpath...I have tried changing the commonEnv.sh and am currently looking for the setDomainEnv.sh (but cant find it as of yet) and none of these things have worked to add this jar to the classpath...

my whole problem is that i added datasources to my server...and I am trying to add the DB2 jar to the environment so that it can be used...funny thing is that after adding the jar in the $DOMAIN_HOME/lib I was able to get rid of a connection error in the admin console when trying to test the connection to the database...and that all seems to work but now im getting a class definition error...

]] Root cause of ServletException.
java.lang.NoClassDefFoundError: com/ibm/db2/jcc/DB2Connection
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Connection
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    Truncated. see log file for complete stacktrace

idk what else to try - i searched for some answers but seemingly all of them are old and outdated...

Answer

Jeff West picture Jeff West · Jun 19, 2012

$DOMAIN/lib should work fine, but not dynamically. You have to restart. However, handling JAR files for data source drivers is likely different.

Just curious - have you confirmed the jar file(s) contain he class in question?

Also try: http://docs.oracle.com/cd/E17904_01/web.1111/e13753/db2.htm