Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class not found exception

 
saima kanwal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to put your JDBC driver (JAR file) in your web application classpath. Where did you put it ?
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is jar file with the JDBC driver located?
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
Sachin Chandra
Greenhorn
Posts: 7
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks

Sachin CR
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic