tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lucas Vickers <lucasvick...@gmail.com>
Subject Re: Tomcat 6 database pooling causes HttpServlet class not found exception
Date Sun, 19 Jul 2009 00:14:48 GMT
Odd,
I did not explicitly enable the security manager, but this makes sense.  I
try logging directly from my servlet (by doing a stack trace into a log
file), which seems to be causing this issue.

thanks!



On Sat, Jul 18, 2009 at 6:13 PM, David Smith <dns4@cornell.edu> wrote:

> Oh... and I see it looks like you have the JVM's security manager turned
> on.  Have you made any adjustments to conf/catalina.policy?  What's in
> your logs when your webapp is started?
>
> --David
>
> David Smith wrote:
> > I really doubt the database pooling is causing the issue.  More likely
> > your deployment is doing something to remove the servlet-api.jar or
> > duplicating it somewhere.  What do you have in tomcat's lib directory
> > and in your webapp's WEB-INF/lib directory?
> >
> > --David
> >
> > Lucas Vickers wrote:
> >
> >> Hello,
> >> I am trying to configure DB pooling in Tomcat 6.  The combination of the
> >> elements below causes the exception:
> >> java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
> >>
> >> I have followed the directions on
> >>
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
> >> thoroughly so I am confused.  The only thing I am doing a little
> different
> >> is I have placed my db resource in the conf/context.xml , but I have
> also
> >> seen the same issue when placed in my META-INF/context.xml
> >>
> >> Any ideas will be greatly appreciated!
> >>
> >> I think it's the entry in context.xml that causes the issue.
> >>
> >> ** conf/context.xml:
> >>
> >>     <Resource
> >>          name="jdbc/tabscorp_tabsdb"
> >>          auth="Container"
> >>          type="javax.sql.DataSource"
> >>          maxActive="100" maxIdle="30" maxWait="10000"
> >>          username="login" password="pass"
> >>          driverClassName="com.mysql.jdbc.Driver"
> >>          logAbandoned="true" removeAbandoned="true"
> >>          removeAbandonedTimeout="60"
> >>          url="jdbc:mysql://localhost:3306/mydb?autoReconnect=true"/>
> >>
> >> ** webapp/tabs/WEB-INF/web.xml:
> >>
> >>     <resource-ref>
> >>       <description>TABS DB Connection</description>
> >>       <res-ref-name>jdbc/tabscorp_tabsdb</res-ref-name>
> >>       <res-type>javax.sql.DataSource</res-type>
> >>       <res-auth>Container</res-auth>
> >>     </resource-ref>
> >>
> >>
> >>
> >> ** Java code:
> >>                     //use the pool
> >>                     InitialContext cxt = new InitialContext();
> >>                     if ( cxt == null ) {
> >>                          throw new Exception("InitialContext is NULL");
> >>                     }
> >>
> >>                     DataSource ds = (DataSource) cxt.lookup(
> >> "java:/comp/env/jdbc/tabscorp_tabsdb" );
> >>                     if ( ds == null ) {
> >>                          throw new Exception("Data source not found");
> >>                     }
> >>
> >>                     Connection conn = ds.getConnection();
> >>                     stmt = connection.createStatement();
> >>
> >>
> >> ** Full Exception:
> >>
> >> 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: Error allocating a servlet instance
> >>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> >>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
> >>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
> >>     java.lang.Thread.run(Thread.java:619)
> >>
> >> root cause
> >>
> >> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
> >>     java.lang.ClassLoader.defineClass1(Native Method)
> >>     java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> >>
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> >>     java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> >>     java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> >>     java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> >>     java.security.AccessController.doPrivileged(Native Method)
> >>     java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >>     sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >>
> >>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
> >>
> >>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> >>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> >>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
> >>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
> >>     java.lang.Thread.run(Thread.java:619)
> >>
> >> root cause
> >>
> >> java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
> >>     java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >>     java.security.AccessController.doPrivileged(Native Method)
> >>     java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >>     sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >>     java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> >>     java.lang.ClassLoader.defineClass1(Native Method)
> >>     java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> >>
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> >>     java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> >>     java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> >>     java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> >>     java.security.AccessController.doPrivileged(Native Method)
> >>     java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >>     sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >>     java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >>
> >>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
> >>
> >>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> >>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> >>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
> >>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >>
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
> >>     java.lang.Thread.run(Thread.java:619)
> >>
> >> note The full stack trace of the root cause is available in the Apache
> >> Tomcat/6.0.20 logs.
> >> Apache Tomcat/6.0.20
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
>
> --
> David Smith
> Programmer/Analyst
> College of Agriculture and Life Sciences
> Cornell University
> B32 Morrison Hall
> Ithaca, NY 14853
> Phone: (607) 255-4334
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message