[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - jsp exception shuts down jboss
kistler59
do-not-reply at jboss.com
Wed Sep 20 16:40:48 EDT 2006
Yup, just like the subject said.
Here's what I was trying to do and what happened.
I'm using jboss-4.0.3SP1
I need to configure a security domain to authenticate using a mysql database - this is another beast by itself that I am having some trouble with.
So first I want to make sure I have our datasource setup properly - so as many other examples do - I try to make a servlet to do so. However, this exception is not datasource related - it occurs before we even try to establish a connection.
So i wrote a little servlet that contained:
anonymous wrote : <%
| javax.naming.InitialContext ctxt = new javax.naming.InitialContext();
| javax.sql.DataSource ds = (javax.sql.DataSource) ctxt.lookup("java:MySqlDS");
| java.sql.Connection con = ds.getConnection();
| %>
|
I was getting this message with the exception:
javax.servlet.ServletException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)))
so I tried adding:
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (ClassNotFoundException cnfe) {
out.println("Couldn't find the driver!");
out.println("Let's print a stack trace, and exit.");
cnfe.printStackTrace();
System.exit(1);
} catch(Exception e){
e.printStackTrace();
}
before trying to create the initialcontext
This is where the fun starts!
Now, when I try to load the servlet (through tomcat) when Class.forName is called - this happens...
anonymous wrote :
| 2006-09-20 14:24:46,524 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/usr/local/jboss-4.0.3SP1/server/default/deploy/test.war
| 2006-09-20 14:26:03,089 INFO [STDOUT] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
| 2006-09-20 14:26:03,090 INFO [STDOUT] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:150)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:71)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at java.lang.Class.forName0(Native Method)
| 2006-09-20 14:26:03,090 INFO [STDOUT] at java.lang.Class.forName(Class.java:164)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:62)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 2006-09-20 14:26:03,091 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
| 2006-09-20 14:26:03,092 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| 2006-09-20 14:26:03,093 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| 2006-09-20 14:26:03,094 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
| 2006-09-20 14:26:03,094 DEBUG [org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread] Notified to shutdown
| 2006-09-20 14:26:03,094 INFO [org.jboss.system.server.Server] Runtime shutdown hook called, forceHalt: true
| 2006-09-20 14:26:03,094 INFO [org.jboss.system.server.Server] JBoss SHUTDOWN: Undeploying all packages
| 2006-09-20 14:26:03,095 DEBUG [org.jboss.deployment.MainDeployer] Undeploying file:/usr/local/jboss-4.0.3SP1/server/default/deploy/test.war
| 2006-09-20 14:26:03,095 DEBUG [org.jboss.system.ServiceController] stopping service: jboss.web.deployment:war=test.war,id=-1398078873
| 2006-09-20 14:26:03,095 DEBUG [org.jboss.system.ServiceController] stopping dependent services for: jboss.web.deployment:war=test.war,id=-1398078873 dependent services are: []
| 2006-09-20 14:26:03,095 DEBUG [org.jboss.web.WebModule] Stopping jboss.web.deployment:war=test.war,id=-1398078873
| 2006-09-20 14:26:03,095 INFO [org.jboss.web.tomcat.tc5.TomcatDeployer] undeploy, ctxPath=/test, warUrl=.../tmp/deploy/tmp46355test.war/
| 2006-09-20 14:26:03,096 INFO [org.apache.catalina.core.StandardWrapper] Waiting for 1 instance(s) to be deallocated
| 2006-09-20 14:26:04,116 INFO [org.apache.catalina.core.StandardWrapper] Waiting for 1 instance(s) to be deallocated
| 2006-09-20 14:26:05,136 INFO [org.apache.catalina.core.StandardWrapper] Waiting for 1 instance(s) to be deallocated
|
Gotta Love it. This very well may be because of a classloader issue on my own part - but I assume this is not intended behavior.
If this is simply one of those dumb classloader issues - where do I need to put the appropriate mysql jar?
-Keith
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973082#3973082
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973082
More information about the jboss-user
mailing list