wood burning stoves 2.0*
The moose likes JSP and the fly likes Database Connection Error with JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Database Connection Error with JSTL" Watch "Database Connection Error with JSTL" New topic
Author

Database Connection Error with JSTL

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi, I'd like to ask what's wrong with this code...




I'm getting this error...



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.adduser_jsp._jspService(adduser_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.jsp.adduser_jsp._jspx_meth_sql_query_0(adduser_jsp.java:143)
org.apache.jsp.adduser_jsp._jspService(adduser_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.


will do research while waiting for some answers... Thanks guys!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where did you put the JDBC driver?
("mysql.jar", I think it's called)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
It's in my <CATALINA_HOME>common\lib but it won't work so I also supplied a mysql.jar in my <JAVA_HOME>\jre\lib\ext still won't work so again I put one in my <APPLICATION_HOME>\WEB-INF\lib (very clever indeed) but it still won't work! Uhmmm... I won't be using the sql tags anymore but I'd still like to know the answer... If you don't mind... Thanks!
myjavaswtech blog
Greenhorn

Joined: Aug 20, 2012
Posts: 1
Timothy Sam wrote:Hi, I'd like to ask what's wrong with this code...




I'm getting this error...



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.adduser_jsp._jspService(adduser_jsp.java:105)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.jsp.adduser_jsp._jspx_meth_sql_query_0(adduser_jsp.java:143)
org.apache.jsp.adduser_jsp._jspService(adduser_jsp.java:94)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.


will do research while waiting for some answers... Thanks guys!


Problem is not with the above data source details. I think you got this error with the query execution ie. <sql:query>
Use <sql:query> tag with dataSource attribute. In your case <sql:query dataSource="${somedb}" var="--" sql="----">
 
Consider Paul's rocket mass heater.
 
subject: Database Connection Error with JSTL