• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

basic jsp question

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am just starting out in jsp. I have a jsp page that depends on a connection pooling class (which is not a jsp page or a servlet, just a class file). I put the jsp page in the same directory as the .class file of the connection pool. But when I invoke the jsp page, I get an error message that says the connection pool cannot be found. Is there something I have to do to get this helper class working with the jsp file? Here is the error message:
Error: 500
Location: /src/ProjectStatus.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:65: Class src.ConnectionPool not found.
ConnectionPool connPool = null;
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:67: Class src.ConnectionPool not found.
connPool = new ConnectionPool(jdbcDriver, dbURL, "projects", "projects");
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:79: Undefined variable: dbConn
dbConn = connectionPool.getConnection();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:79: Undefined variable or class name: connectionPool
dbConn = connectionPool.getConnection();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:80: Class src.Statement not found.
Statement stmt = dbConn.createStatement();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:80: Undefined variable or class name: dbConn
Statement stmt = dbConn.createStatement();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:84: Class src.ResultSet not found.
ResultSet rs = stmt.executeQuery(getProjects);
^
7 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at com.borland.jbuilder.webserverglue.tomcat.jsp.JspLoaderEcho.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:484)

Thanks in advance
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeff
check whether ur classpath contains jasper.jar that will be in tomcat_home\lib
Hope this answer helps u
swapna
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,
If you want to use a connectin pool mechanism in your JSP file, the class or package or jar should be in the classpath of the JSP container you are using.
for example in the case of JRUN it should be under {run root}
/servers/lib.
Cheers
Binu
or {run root}/lib.

Originally posted by Jeff Sunder:
Hi,
I am just starting out in jsp. I have a jsp page that depends on a connection pooling class (which is not a jsp page or a servlet, just a class file). I put the jsp page in the same directory as the .class file of the connection pool. But when I invoke the jsp page, I get an error message that says the connection pool cannot be found. Is there something I have to do to get this helper class working with the jsp file? Here is the error message:
Error: 500
Location: /src/ProjectStatus.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:65: Class src.ConnectionPool not found.
ConnectionPool connPool = null;
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:67: Class src.ConnectionPool not found.
connPool = new ConnectionPool(jdbcDriver, dbURL, "projects", "projects");
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:79: Undefined variable: dbConn
dbConn = connectionPool.getConnection();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:79: Undefined variable or class name: connectionPool
dbConn = connectionPool.getConnection();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:80: Class src.Statement not found.
Statement stmt = dbConn.createStatement();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:80: Undefined variable or class name: dbConn
Statement stmt = dbConn.createStatement();
^
C:\Documents and Settings\sbarkho\jbproject\UI_Projects\work\localhost_8080\_0002fsrc_0002fProjectStatus_0002ejspProjectStatus_jsp_0.java:84: Class src.ResultSet not found.
ResultSet rs = stmt.executeQuery(getProjects);
^
7 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at com.borland.jbuilder.webserverglue.tomcat.jsp.JspLoaderEcho.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:484)

Thanks in advance


 
Jeff Sunder
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If my jsp page and the connection pool helper class are in the same directory, should the jsp container be able to find the helper class right?
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no, the default directory for helper classes is the same as for servlets usually under web-inf/classes directory
 
Jeff Sunder
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marcos, now I get it. But now how do I get the JSP page to recognize or find the helper class?
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic