wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Servlet jdbc problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Servlet jdbc problem" Watch "Servlet jdbc problem" New topic
Author

Servlet jdbc problem

david colais
Greenhorn

Joined: Nov 15, 2010
Posts: 29
Hi guys... i have written a servlet program which performs a simple query from the datbase and displays the results.But my servlet is returning java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDrive exception.
But if i perform the same database operation from a normal .java file i am getting the results.Please help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Where did you place the jar file with the drive class?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
david colais
Greenhorn

Joined: Nov 15, 2010
Posts: 29
I have pasted my classes12.jar file in the webcontent/web-inf/lib directory.But my .java programs work fine.
Please help.....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

The problem is that the folder must be named WEB-INF, not web-inf.
david colais
Greenhorn

Joined: Nov 15, 2010
Posts: 29
Sorry for not typing it correctly:
I have pasted in WebContent/WEB-INF/lib
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Is that the WEB-INF (please read AvoidRedHerrings) for the web app in question?

And, are you using container-managed connection pooling? And, what container are you using?

Tomcat, for example, requires that the driver jar for connection-managed pooling be placed in the central Tomcat /lib folder.
david colais
Greenhorn

Joined: Nov 15, 2010
Posts: 29
I am using JBoss 4.0.2...
I dont know whether i have to place the jar file in the WebContent/WEB-INF/lib path or not.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Bear Bibeault wrote:And, are you using container-managed connection pooling?
david colais
Greenhorn

Joined: Nov 15, 2010
Posts: 29
Sorry i have no idea if it uses container-managed connection pooling.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Inspecting the code, it doesn't look like you are, so placing the jar/zip in WEB-INF/lib should be sufficient.

But there might be jBoss nuances that I don't know about, so I've moved this to the JBoss forum for the JBoss-savvy to have a gander at it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

P.S. You have already verified that the oracle.jdbc.driver.OracleDriver class is in the jar file, right?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

I have pasted in WebContent/WEB-INF/lib

Are you working from an IDE? Are you experting the IDE to deploy your app? If so, did you double-check that the IDE did indeed copy the JDBC JAR file as part of the deployed application?

P.S. You should really use a connection pool and manage the database connection directly in your servlet.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet jdbc problem
 
Similar Threads
problem while executing the JAR written using ANT
Not able to navigate the user to another jsp in servlets using RequestDispatcher
java don't compile my servlet.
user authentication and dao
Problems getting Tomcat to work without Eclipse IDE