Results 1 to 3 of 3
  1. #1
    kunalgaurav18 is offline Member
    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    Default Getting ClassNotFoundException error.

    I am working in eclipse and using Jboss-server4.2. Even after adding external mysql-connector jar in build path I am getting the error classnotfoundexception. Even I have tried to place mysql-connector jar inside /web-inf/lib folder.
    My-Code looks like
    Java Code:
    public class Auth extends HttpServlet {
    	private static final long serialVersionUID = 1L;
     
    	/**
    	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    	 */
     
    	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    		// TODO Auto-generated method stub
    		response.setContentType("text/HTML");
    		PrintWriter out = response.getWriter();
    		String uname = request.getParameter("uname");
    		String pass = request.getParameter("pass") ;
    		try{
    			Class.forName("com.mysql.jdbc.Driver");
    			   out.println("Driver Loaded");
     
    			Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/j2ee","root","root");
    				out.println("Connction Established");
     
    			PreparedStatement pr = con.prepareStatement("insert into user values(?,?)");
    			 pr.setString(1, uname);
    			 pr.setString(2, pass);
    			 int x = pr.executeUpdate();
    			 if(x>0)
    			 {
    				 out.println("Success");
    				 out.println(uname + " thanks!!");
    				 out.println("Your password: "+ pass);
    			 }
    			 else
    				 out.println("Failed");
     
     
    		}
    		catch(SQLException e){
    			out.println(e);
    		}
    		catch(ClassNotFoundException f){
    			out.println(f);
    		}
     
     
    	}
     
    }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,569
    Rep Power
    12

    Default Re: Getting ClassNotFoundException error.

    Also at javaprogrammingforums.com

    Please, if you are going to start a discussion at multiple places it is polite to post links at each to the others. That way everyone taking part in the discussion knows what else is being said. Be aware that some people will not respond to cross posts for fear wasting their time on something that has been dealt with elsewhere. (It is also not good form to post the same thing to two different forums within the same site. Again, it just causes confusion for those taking part.)

  3. #3
    kunalgaurav18 is offline Member
    Join Date
    Oct 2012
    Posts
    6
    Rep Power
    0

    Default Re: Getting ClassNotFoundException error.

    Quote Originally Posted by pbrockway2 View Post
    Also at javaprogrammingforums.com

    Please, if you are going to start a discussion at multiple places it is polite to post links at each to the others. That way everyone taking part in the discussion knows what else is being said. Be aware that some people will not respond to cross posts for fear wasting their time on something that has been dealt with elsewhere. (It is also not good form to post the same thing to two different forums within the same site. Again, it just causes confusion for those taking part.)
    Alright.... I will take care next time.

Similar Threads

  1. ClassNotFoundException
    By pachmarhi in forum New To Java
    Replies: 1
    Last Post: 09-29-2012, 03:55 PM
  2. Error -- java.lang.ClassNotFoundException
    By dewitrydan in forum New To Java
    Replies: 18
    Last Post: 03-02-2012, 05:25 PM
  3. Replies: 0
    Last Post: 11-06-2011, 01:18 AM
  4. ClassNotFoundException error for a class that exists
    By dahaka2011 in forum Sun Java Wireless Toolkit
    Replies: 1
    Last Post: 04-01-2011, 03:44 AM
  5. [SOLVED] ClassNotFoundException Error
    By dan0 in forum Java Applets
    Replies: 2
    Last Post: 03-03-2009, 09:00 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •