ClassNotFoundException: oracle.jdbc.driver.OracleDriver - jboss seam deploy issue

dkim18
dkim18 used Ask the Experts™
on
Hi Experts,

I am in the middle of developing a small jboss seam project. I deployed ear file on test server(linux), but have this error.

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
      at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
      at org.hibernate.loader.Loader.doQuery(Loader.java:673)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.doList(Loader.java:2220)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
      at org.hibernate.loader.Loader.list(Loader.java:2099)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
      ... 89 more
Caused by: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver)))
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
      at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
      ... 103 more
Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver))
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:613)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
      ... 105 more
Caused by: org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:298)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
      ... 113 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:242)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:283)
      ... 114 more

 
++++++++++++

It worked fine on my local machine. I added I added ojdbc14.jar under /usr/local/jboss-as/jboss-4.2.3.GA/server/default/lib , but didn't help.
I transferred xxxx-ds.xml file under /usr/local/jboss-as/jboss-4.2.3.GA/server/default/deploy as well.

The web app works when displaying login page, but when it needs to talk to oracle db, it fails.
Any ideas?

thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Are the rights set up correctly on the file?  Doe the user running the JBoss app have access to that file?  It should need only read access.

Are there any firewall concerns between your new environment and the Oracle DB?

Is Oracle configured to allow connections from this machine?

Is the user name password correct?

Do you have the correct connection URL?  Make sure you are not using localhost.

Author

Commented:
Are the rights set up correctly on the file?  Doe the user running the JBoss app have access to that file?  It should need only read access.
>>yes. the EAR file contains everything.

Are there any firewall concerns between your new environment and the Oracle DB?
>>no

Is Oracle configured to allow connections from this machine?
>>The dev of the external website is on this box and talk to oracle with no problems. So, it should work.

Is the user name password correct?
>>yes, it works from my local machine.

Do you have the correct connection URL?  Make sure you are not using localhost.
>>yes, the login page works fine.
a_b
Top Expert 2009

Commented:
Are you sure that you are using the defauly config of jboss and not the all config? What is the ide that you are using?
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Author

Commented:
what are the differences between the default config and all config? I am using eclipse ganymede.
a_b
Top Expert 2009

Commented:
All is used for clustering and advanced jboss configs. Can you press Ctrl+Shift+T in the ide and see if you can locate the class OracleDriver, if yes then see what is location?

Author

Commented:
Ok, I typed "oracle" and I see many ojdbc14.jar locations. For this project, I see the location as "project_name/lib/ojdbc14.jar" as "OracleTye", "OrackeTypeADT", etc...

Author

Commented:
Another word:
OracleType=project_name/lib/ojdbc14.jar
...
OracleTypeADT=project_name/lib/ojdbc14.jar
...
...
a_b
Top Expert 2009

Commented:
project_name - is that the name of the project or some variable?

Author

Commented:
yes, it is the project name.
Commented:
linux admin restarted jboss and the issue has been resolved.
Hi ,
 
 I too faced the same error . Add classes12.jar / classes12.zip   files present in the java/lib folder in the classpath . then it will start working.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial