473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

java.lang.ClassNotFoundException

I have added ojdbc14.jar, classes12.jar in my WEB-INF lib folder but its showing the java.lang.ClassNotFoundException:.

I have also added the jar files by right click on the project folthder and from build path add external jars. I have addedd all the jars but dont know why this error is showing up

ERROR:

Expand|Select|Wrap|Line Numbers
  1.     at java.lang.Thread.run(Unknown Source)
  2. java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
  3.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
  4.     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
  5.     at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
  6.     at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
  7.     at java.lang.Class.forName0(Native Method)
  8.     at java.lang.Class.forName(Unknown Source)
  9.     at org.apache.jsp.insert1_jsp._jspService(insert1_jsp.java:74)
  10.     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  11.     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  12.     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
  13.     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
  14.     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
  15.     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  16.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  17.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  18.     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
  19.     at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
  20.     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
  21.     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
  22.     at redirectServlet.doPost(redirectServlet.java:67)
  23.     at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
  24.     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  25.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  26.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  27.     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  28.     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  29.     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  30.     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  31.     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  32.     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
  33.     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  34.     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
  35.     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  36.     at java.lang.Thread.run(Unknown Source)
  37.  

My Java Code:

Expand|Select|Wrap|Line Numbers
  1. <%@ page  language="java"  import="java.sql.*" %>
  2. <%@ page import = "java.io.*"%>
  3.  
  4. <% 
  5.  
  6.  
  7.        String appl=request.getParameter("app");
  8.        String sel=request.getParameter("second");
  9.        String url= request.getParameter("link");
  10.  
  11.  
  12.  
  13. %>
  14.  
  15. <% 
  16.  
  17. try{
  18.      String sql ="INSERT into TEST_LINKS (ID,APPLICATION,ENTITY,URL) VALUES(TEST_LI.nextval,'"+appl+"','"+sel+"','"+url+"')";
  19.      Class.forName("oracle.jdbc.OracleDriver");
  20.  
  21.      Connection con = DriverManager.getConnection("jdbc:oracle:thin:SCOTT/tiger@myhost:1521:orcl");
  22.      int action = con.createStatement().executeUpdate(sql);
  23.      con.setAutoCommit(true);
  24.  
  25.  
  26.         if(action>=1  ){
  27.            out.println("Data inserted"); 
  28.  
  29.        } else{
  30.            out.println("Data not inserted"); 
  31.        }
  32.    }
  33.  
  34. catch(Exception e){
  35.         e.printStackTrace();
  36.     }
  37.         %>
  38.  
  39.  
Oct 31 '13 #1
2 3899
I resolved the problem, I putted jar file in web content dir and thought it is in wen-inf lib folder, and also my host name was incorrect.
Thanks anyways
Oct 31 '13 #2
r035198x
13,262 8TB
Don't write database connection logic in a JSP. Write it in a normal Java class where you can test it without starting a server and call it from a servlet. Use JSPs for presentation logic only.
Oct 31 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Anoniem | last post by:
Hi, I'm trying to start a example which comes with the midp2.0 distribution. My relevant environment variables are set in a batch file like: ...
3
by: jayattarde | last post by:
Hi, While running .jar file I get the following error. Please helpme to sort it out. ption in thread "main" java.lang.NoClassDefFoundError: while resolving class: Cutter at...
18
by: pradeep84 | last post by:
hi all, i'm using the following code and i'm getting exception in thread "main" java.lang.nullpointerexception at the line which is in bold. help me to solve this problem import...
2
by: jith87 | last post by:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Ths s the error i get whn i try to connect to mysql using jdbc driver.....Can u help me out...
3
by: Ananthu | last post by:
Hi This is my codings in order to access mysql database from java. Codings: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;
4
by: jmitch89 | last post by:
I don't why I get this error: Exception in thread "main" java.lang.NoClassDefFoundError The statement below works just fine: java -cp...
10
dmjpro
by: dmjpro | last post by:
My context.xml... <Context path="/JNDITest"> <Resource name="jdbc/dataSource" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"...
1
by: rajujrk | last post by:
Hai All, I am Having a problem in the following... import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.io.FileUtils; import...
1
mickey0
by: mickey0 | last post by:
Hello, I have a file myClass.java that contains a class like this: import mylibrary; public class myClass { ............................. } Now, I'd like to load it in the main:
1
by: James Kalmadge | last post by:
I have a test program that compiles but does not run. Here is the code which I grabbed from from a web site: import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*;...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.