Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Help! Class not found java.lang.class
Help! Class not found java.lang.class [message #725876] Fri, 16 September 2011 04:00 Go to next message
Vo Son Ha is currently offline Vo Son HaFriend
Messages: 1
Registered: September 2011
Junior Member

		String url="jdbc:mysql://localhost:3306/loginexample";
		  try{
		   Class.forName("com.mysql.jdbc.Driver");
		   Connection con=(Connection) DriverManager.getConnection(url, "root", "root");
		   Statement st=(Statement) con.createStatement();
		   ResultSet rss=st.executeQuery("select * from users");
		   int i =0;
		   while(rss.next())
		   {
		    String user=rss.getString(2);
		    System.out.println(user);
		   }
		  }catch(SQLException e)
		        {
		            System.out.println("loi select");
		            e.printStackTrace();
		           
		      }
		         catch(ClassNotFoundException e)
		         {

		        	 System.out.println("loi ket noi driver");
		        	 e.printStackTrace();
		         }
		 
		 }


Bug

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at com.myworld.datausers.users(datausers.java:26)
	at com.myworld.Controller.doPost(Controller.java:42)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)loi ket noi driver

	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Somebody help me!!! Crying or Very Sad
Re: Help! Class not found java.lang.class [message #726087 is a reply to message #725876] Fri, 16 September 2011 14:06 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3268
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 15-Sep-11 22:01, Vo Son Ha wrote:
> [snip]
> Somebody help me!!! :cry:


You don't say how you get into this position. You're missing MySQL's
JDBC driver, that's all. I can offer this article that will tell you
what to do:

http://www.javahotchocolate.com/tutorials/jdbc.html
Previous Topic:You may have mapped two namespaces with elements of the same name to the same package name
Next Topic:Creating WTP project in code - Setting project location
Goto Forum:
  


Current Time: Mon Dec 22 02:05:16 GMT 2014

Powered by FUDForum. Page generated in 0.01676 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software