aspose file tools*
The moose likes JDBC and the fly likes class not found exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "class not found exception" Watch "class not found exception" New topic
Author

class not found exception

saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
I am getting this exception:

javax.servlet.ServletException: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
com.jamesholmes.abc.SearchAction.execute(SearchAction.java:24)
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.

I am using Struts 1.3.10 , oracle XE, and Tomcat-6.0.24. I am unable to access the data base because of this exception. My Action class is as follows:


There is a strange thing about it: previously I have been accessing the same database with the same statements for connection through a JSP, and I am able to access it and there is no such exception. (this JSP is not a part of the struts appplication that I discussed earlier, but it is using the same oracle XE database using the same connection statements , but in scriptlets. My JSP is as follows:



One thing to add here is that I have ojdbc14.jar and ojdbc14_g.jar in somewhere in lib directory of oracle XE that came with oracle XE itself.Is there any other driver to add in order to get conected to the database?


Anyone please solve my problem,i will be grateful.


SCJP 6.0 (86%) SCWCD 5 (94%)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You need to put your JDBC driver (JAR file) in your web application classpath. Where did you put it ?


[My Blog]
All roads lead to JavaRanch
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Where is jar file with the JDBC driver located?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10



Misha Ver wrote:Where is jar file with the JDBC driver located?
Hi Misha.
Please create new thread. We are solving Saima's issue here.


I had misread Misha's remark as a new question, but it is most likely a suggestion for the original poster.


OCUP UML fundamental and ITIL foundation
youtube channel
Sachin Chandra
Greenhorn

Joined: Jun 19, 2009
Posts: 7
Hi,

Add the ojdbc * .jar files in the lib directory of the server.

Thanks

Sachin CR
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Jan Cumps wrote:

Misha Ver wrote:Where is jar file with the JDBC driver located?
Hi Misha.
Please create new thread. We are solving Saima's issue here.


I had misread Misha's remark as a new question, but it is most likely a suggestion for the original poster.


Of course it is suggestion to Saima to check configuration. My post would sound odd as a new question.
saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
oh thanks guys. its now working . My ojdbc was in oracle folder. Now I have put it in my app's lib folder and its working as you people suggested.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class not found exception