dcsimg
connection.createStatement() exception
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Padraig_Cooney
Posted On:   Thursday, May 20, 2004 08:12 AM

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.doSer   More>>

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().



try{

statement = con.createStatement(); //Exception thrown at this line
//rest of code in here
}catch (SQLException e){
System.out.println(e.toString());
}



Can anyone help?
Thanks.

   <<Less

Re: connection.createStatement() exception

Posted By:   Sean_Owen  
Posted On:   Thursday, May 20, 2004 11:29 AM

If the exception originates on this line, and it is a NullPointerException, then "con" is almost certainly null for some reason. Check that, and why it might be null?
About | Sitemap | Contact