java.lang.NoClassDefFoundError When Placing JDBC Driver or Application-Dependent JARs in <DOMAIN_HOME>/lib Directory (Doc ID 1328300.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle Weblogic Server - Version: 10.3.3 to 10.3.5
Information in this document applies to any platform.

Symptoms

When initializing application (during deployment phase) or modules like JDBC Datasource, the following error occurs (in this example, it is a database connection initialization of an application using Hibernate that was failing):

Caused by: java.lang.NoClassDefFoundError: com/mypackage/MyClass
at weblogic.jdbc.wrapper.DatabaseMetaData_com_mypackage_MyClass.getDatabaseProductName(Unknown Source)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:87)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory (LocalSessionFactoryBean.java:860)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory (LocalSessionFactoryBean.java:779)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet (AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1417)

The same "NoClassDefFoundError" can occur while initializing applications (other than database/datasource) when those applications are dependent on external jar files that are added to the <DOMAIN_HOME>\lib directory.

Steps to reproduce the issue:

  1. Have database server running.
  2. Remove the database driver from the WLS installation (WL_HOME/server/lib).
  3. Place the driver jar in <MyDomain>/lib directory.
  4. Start the servers.
  5. Create a datasource.
  6. Access to the datasource from an application.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms