Skip to content

Weblogic – where do I put my JDBC Driver lib?

October 8, 2010

Introduction:

We will walk through a quick example of how to resolve “weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class:” errors and learn where to install the JDBC driver libraries to fix runtime issues.

Background:

I was playing with ADF samples and had a database connection to a MySQL instance. This was achieved by adding the MySQL-Connector library during design time.

Now, when I had the sample application ready and ran a test on the local Weblogic server – I got the following errors:

<Oct 9, 2010 4:14:45 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException:
 at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:290)
 at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
 at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507)
 at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
 at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:149)
 Truncated. see log file for complete stacktrace

Caused By: weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class: com.mysql.jdbc.Driver
 at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:301)
 at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:75)
 at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:131)
 at weblogic.jdbc.common.internal.ConnectionPool.initPooledResourceFactory(ConnectionPool.java:686)
 at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:230)
 Truncated. see log file for complete stacktrace

It was clear that I was missing the MySQL-Connector libraries and had to stick it into some lib folder. But the question was which lib folder?

The Solution:

The best way to find out about your application server is to .... *hint* "logs".... yes! Read the startup logs. I agree it is sometimes hard to read when stuff is flying by so fast, so it is good practice to "grab"/"copy" from the Weblogic console and paste it into Notepad++ or your favorite text-editor.

Now, you should be looking for a few things ... where is the JVM which launched the app (i.e. bootstrap libraries) and in Weblogic server's case ...where is the domain home.

I will skip the story about how I put the jar in "c:\Oracle\Middleware\wlserver_10.3\server\lib", "c:\Oracle\Middleware\wlserver_10.3\common\lib", "c:\Oracle\Middleware\jdeveloper\lib" ... and it did not work!

What worked!

What worked was when I put it (the mysql lib jar) in the domain home as indicated in the server-startup (so you are looking at a line that is something like)

Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
Starting WLS with line:
C:\Oracle\MIDDLE~1\JDK160~1\bin\java -client ...-Ddomain.home=C:\Users\<username>\AppData\Roaming\JDEVEL~1\SYSTEM~1.60\DEFAUL~1

Notice the domain home. This is where we ought to stick the connector jar into.

 

 

Another way to look at it - nodemanager props

I also looked at the server start-up logs and the nodemanager properties to get a better idea of the server setup. As you can see the details are in the properties file here, just need to pick the right home - the logical "Domain"'s home.

"c:\Oracle\Middleware\wlserver_10.3\common\nodemanager>more nodemanager.domains"
#Domains and directories created by Configuration Wizard
#Fri Oct 08 20:18:00 EST 2010
base_domain=C\:\\Oracle\\Middleware\\user_projects\\domains\\base_domain
DefaultDomain=C\:\\Users\\<username>\\AppData\\Roaming\\JDeveloper\\system11.1.1.3.37.56.60\\DefaultDomain

I tried putting the jar in the base domain and stopped/started the server but that did not work. It only worked when I put the jar in the default domain.


About these ads

From → Uncategorized

3 Comments
  1. Girish permalink

    Thanks a lot for the tip…i was trying to set up a similar connection for Sql Server 2008 and following your advice , added the jar file to the default domain Lib..Worked like a charm..Cheers!

  2. engin permalink

    best anser for this very very thank you

Trackbacks & Pingbacks

  1. Error deploying adf application on integrated weblogic server using mysql database | Technology & Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: