tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvosbu...@aol.com
Subject Re: Trouble loading MS SQl Server database driver in Tomcat 7.0.37
Date Tue, 02 Apr 2013 15:37:24 GMT
Neven,

After fixing the case sensitive properties in my context.xml resource element per Konstantin
that error disappeared from the catalina.out log. I now get this error when trying to navigate
through the site. Note. Some of the pages sometimes load but without the data driven elements
and others just display this error. I don't get anything in Catalina.out except messages like
these.
HOME >> reinitializing data
ABOUT US >> reinitializing data

I'm looking at the Tomcat docs to see if maybe I need to up the logging level to get a more
descriptive error of what is happening here.



type Exception report
message Servlet execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this
request.
exception 
javax.servlet.ServletException: Servlet execution threw an exception

root cause 
java.lang.NoClassDefFoundError: Could not initialize class com.systemsmadesimple.hibernate.HibernateUtil
	com.systemsmadesimple.hibernate.DatabaseManager.getAdHocData(DatabaseManager.java:171)
	com.systemsmadesimple.struts.action.ServicesAction.execute(ServicesAction.java:48)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


I tried to use your test app but kept getting some error messages back like these. I don't
know if I missed something when creating the .jsp file or if there is just some missing code.



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

An error occurred at line: 8 in the jsp file: /test.jsp
javax.sql.Connection cannot be resolved to a type
5: <pre>
6: <%
7:     javax.naming.InitialContext naming = null;
8:     javax.sql.Connection connection = null;
9:     try {
10:         naming = new javax.naming.InitialContext();
11:         datasource = (DataSource)naming.lookup("java:comp/env/jdbc/smswebdb");


An error occurred at line: 11 in the jsp file: /test.jsp
datasource cannot be resolved to a variable
8:     javax.sql.Connection connection = null;
9:     try {
10:         naming = new javax.naming.InitialContext();
11:         datasource = (DataSource)naming.lookup("java:comp/env/jdbc/smswebdb");
12:         connection = datasource.getConnection();
13:         connection.close();
14:         out.println("Connection has successfully obtained from datasource.connection="
+ connection);


An error occurred at line: 11 in the jsp file: /test.jsp
DataSource cannot be resolved to a type
8:     javax.sql.Connection connection = null;
9:     try {
10:         naming = new javax.naming.InitialContext();
11:         datasource = (DataSource)naming.lookup("java:comp/env/jdbc/smswebdb");
12:         connection = datasource.getConnection();
13:         connection.close();
14:         out.println("Connection has successfully obtained from datasource.connection="
+ connection);


An error occurred at line: 12 in the jsp file: /test.jsp
datasource cannot be resolved
9:     try {
10:         naming = new javax.naming.InitialContext();
11:         datasource = (DataSource)naming.lookup("java:comp/env/jdbc/smswebdb");
12:         connection = datasource.getConnection();
13:         connection.close();
14:         out.println("Connection has successfully obtained from datasource.connection="
+ connection);
15:     } catch (javax.naming.NamingException ne) {


An error occurred at line: 18 in the jsp file: /test.jsp
javax.sql.SQLException cannot be resolved to a type
15:     } catch (javax.naming.NamingException ne) {
16:         ne.printStackTrace();
17:         out.println("Datasource is not bound to JNDI: " + ne);
18:     } catch (javax.sql.SQLException sqle) {
19:         sqle.printStackTrace();
20:         out.println("Problem with a SQL connection: " + sqle);
21:     } catch (Exception e) {


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

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

Apache Tomcat/7.0.37

Thank You for any help you or anyone else can provide.

David

 
 

 

-----Original Message-----
From: Neven Cvetkovic <neven.cvetkovic@gmail.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Mon, Apr 1, 2013 8:23 pm
Subject: Re: Trouble loading MS SQl Server database driver in Tomcat 7.0.37


Excellent point Mark.

David, you have to decide how your database connections are managed:




 

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