Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

connection.createStatement() exception

 
Paid O'Cuana
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've developed a website using JSP, beans, MysQL with Tomcat, Apache, mod_jk, on a development server. Everything works fine there. I've now transferred it to a live server with the same setup, but I'm gettig errors.
Specifically this one:

Error: 500
Location: /whois2.jsp
Internal Servlet Error:

javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:412)
at whois2_1._jspService(whois2_1.java:399)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:534)
at org.apache.tomcat.core.Handler.invoke(Handler.java:280)
at org.apache.tomcat.core.Handler.service(Handler.java:193)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:445)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:874)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:790)
at org.apache.tomcat.modules.server.Ajp12Interceptor.processConnection(Ajp12Interceptor.java:183)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:534)
Root cause:
java.lang.NullPointerException
at register.regBean.doWhois(regBean.java:1110)
at whois2_1._jspService(whois2_1.java:216)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:534)
at org.apache.tomcat.core.Handler.invoke(Handler.java:280)
at org.apache.tomcat.core.Handler.service(Handler.java:193)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:445)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:874)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:790)
at org.apache.tomcat.modules.server.Ajp12Interceptor.processConnection(Ajp12Interceptor.java:183)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:534)


The error occurs when I attemp to use the createStatement() method of the Connection class in java.sql (which is included). The bean is called regBean.java, method is doWhois().




Can anyone help?
Thanks.
 
Ankur Srivastava
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mostly the problem is because you haven't instantiated the connection object. Just check if the Connection object is null before the createStatement call and if it is then there is your problem.
 
Paid O'Cuana
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I forgot to include the code where I instantiated the connection object. I have done it:



MyConn() is the method that does the work in this regard.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!