Database Connection Error In Jsp.
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shrikant_Katti
Posted On:   Tuesday, August 7, 2001 10:40 PM

I am trying to connect to database Through JSP. We are using Tomcat on Linux. And we are getting this error.What is the reason behind this error? Because on local machine on Javawebserver it runs fine. The code for connection is Connection con=null; try { Class.forName("org.gjt.mm.mysql.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/general","root",""); } catch(ClassNotFoundException e) { System.out.println(e); } catch(SQLException ee) { System.out.println(ee); } The Error is : Error: 500 Location: /examples/vi   More>>

I am trying to connect to database Through JSP. We are using Tomcat on Linux. And we are getting this error.What is the reason behind this error? Because on local machine on Javawebserver it runs fine. The code for connection is




Connection con=null;
try
{
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/general","root","");
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException ee)
{
System.out.println(ee);
}




The Error is :

			
Error: 500
Location: /examples/vind.jsp
Internal Servlet Error:

javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java, Compiled Code)
at _0002fvind_0002ejspvind_jsp_4._jspService(_0002fvind_0002ejspvind_jsp_4.java, Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java, Compiled Code)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java, Compiled Code)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)

Root cause:
java.lang.NullPointerException
at _0002fvind_0002ejspvind_jsp_4._jspService(_0002fvind_0002ejspvind_jsp_4.java, Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java, Compiled Code)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java, Compiled Code)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled Code)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java, Compiled Code)
   <<Less

Re: Database Connection Error In Jsp.

Posted By:   Alex_Chaffee  
Posted On:   Thursday, August 9, 2001 10:40 AM

Learn how to read a stack trace. Also, please put raw code dumps inside
 tags.


The problem is that somewhere in your JSP you're dereferencing a null pointer. That's what the line

java.lang.NullPointerException
at _0002fvind_0002ejspvind_jsp_4._jspService(_0002fvind_0002ejspvind_jsp_4.java, Compiled Code)
means. Search the JSP FAQ for information on debugging JSPs.

Re: Database Connection Error In Jsp.

Posted By:   Naveed_Azhar  
Posted On:   Tuesday, August 7, 2001 11:07 PM

Hello there

Visit the URL

http://www.jguru.com/forums/view.jsp?EID=468910


You can replace

echo %windir% > windlocation.txt


with

echo %COMPUTERNAME% > windlocation.txt

or with

echo %USERNAME% > windlocation.txt


Naveed Azhar

naveed@hotmail.com
About | Sitemap | Contact