tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allan Lawrie <lawrieal...@yahoo.com>
Subject A few problems setting up JDBC using 4.1.24 (win2k)
Date Fri, 13 Jun 2003 14:14:10 GMT
When I access this URL:

http://localhost:8080/tests/test.jsp

Which contains a modified version of the JDBC test app
for MySQL.

I get this error:

org.apache.jasper.JasperException: Unable to compile
class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
    [javac] Since fork is true, ignoring compiler
setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler
setting.
    [javac] C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\tests\test_jsp.java:48:
cannot resolve symbol
    [javac] symbol  : class mytest  
    [javac] location: package foo
    [javac]     foo.mytest tst = new foo.mytest();
    [javac]        ^
    [javac] C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\tests\test_jsp.java:48:
cannot resolve symbol
    [javac] symbol  : class mytest  
    [javac] location: package foo
    [javac]     foo.mytest tst = new foo.mytest();
    [javac]                             ^
    [javac] 2 errors

I have mytest.java in WEB-INF/classes/foo but I cannot
compile it. The compiler cannot find javax.sql.* I
have the EE and SE JDKs installed. Is tomcat supposed
to try to compile this? Otherwise, what needs to be
set up to compile the thing?

mytest.java looks like this:

package foo;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;


public class mytest {

  String foo = "Not Connected";
  String bar = "";
    
  public void init() {
    try{
      Context ctx = new InitialContext();
      if(ctx == null ) 
          throw new Exception("Boom - No Context");

      DataSource ds = 
            (DataSource)ctx.lookup(
               "java:comp/env/jdbc/testcase");

      if (ds != null) {
        Connection conn = ds.getConnection();
              
        if(conn != null)  {
            foo = "Got Connection "+conn.toString();
            Statement stmt = conn.createStatement();
            ResultSet rst = 
                stmt.executeQuery(
                  "select ref,title from cases where
id=4");
            if(rst.next()) {
               foo=rst.getString(1);
               bar=rst.getString(2);
            }
            conn.close();
        }
      }
    }catch(Exception e) {
      e.printStackTrace();
    }
 }

 public String getFoo() { return foo; }
 public String getBar() { return bar;}
}

The java compiler complains about javax.sql and the
DataSource class.

ALSO, When I use the admin tool and look at the /tests
context (where I have set up a MySQL datasource), I
get this error when trying to look at the datasource
(There is no problem with a shared datasource):

ype Exception report

message

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

exception

org.apache.jasper.JasperException: Exception
retrieving attribute 'driverClassName'
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1759)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1759)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:479)

root cause

javax.servlet.ServletException: Exception retrieving
attribute 'driverClassName'
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
	at
org.apache.jsp.listDataSources_jsp._jspService(listDataSources_jsp.java:498)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1759)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1759)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:479)

Apache Tomcat/4.1.24


The MySQL jar file is in server/lib common/lib and my
application lib directory.


Err, help? I'm doing something wrong/stupid.

Allan.




__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message