File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error 500 when trying to run servlet connecting to mysql

 
B Crosthwaite
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I have wrote this piece of code to test whether I can connect to my MySQL database with a servlet.


When I run the servlet I am presented with the error 500 message, the error message reads:


Does anyone have any idea where I am going wrong?

Thanks,
-Ben
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to go through the usual procedure for finding a NullPointerException (NPE). Start by identifying the line where it occurs (35) and check that every object used in that line is not null.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, check your error logs.


These two pieces of code log an error and then continue. If either of these fails, the code later in the method doesn't make sense though. It's better to just log the error, throw a RuntimeException and stop trying.
 
B Crosthwaite
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys thanks fot the replys,

I just want to make sure of something.....

If I had set up the JDBC driver Incorrectly would I be able to complie the code in the above post?

I realise that this is a strange question considering the first post I made but I would just like to make sure I have installed the driver correctly.

Thanks,
Ben
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic