tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sam wun" <sw2...@gmx.com>
Subject Re: Re: Re: Can't execute servlet project
Date Wed, 03 Sep 2008 01:43:22 GMT
I found there are some xml file in the conf/ directory:

linux:~/tomcat/apache-tomcat-5.5.26/conf # ls
.   Catalina    catalina.policy      logging.properties  
server.xml        web.xml
..  DBTest.xml  catalina.properties  server-minimal.xml  
tomcat-users.xml
linux:~/tomcat/apache-tomcat-5.5.26/conf #

do I need to remove DBTest.xml and web.xml here?

Thanks

Sam



> ----- Original Message -----
> From: sam wun
> Sent: 03/09/08 11:13 am
> To: Tomcat Users List
> Subject: Re: Re: Can't execute servlet project
> 
> After moved the context.xml file to 
> /tomcat/apache-tomcat-5.5.26/conf/Catalina/localhost/
> 
> with the content changed to:
> 
> <Context>
> 
>     <!-- Default set of monitored resources -->
>     <WatchedResource>WEB-INF/web.xml</WatchedResource>
> 
>     <!-- Uncomment this to disable session persistence across Tomcat 
> restarts -->
>     <!--
>     <Manager pathname="" />
>     -->
>    <Resource name="jdbc/TestDB" auth="Container" 
> type="javax.sql.DataSource"
>                maxActive="100" maxIdle="30" maxWait="10000"
>                username="javauser" password="javadude" 
> driverClassName="com.mysql.jdbc.Driver"
>                url="jdbc:mysql://localhost:3306/javatest"  
> validationQuery="select 1" />
> </Context>
> (I have the exact db, table and username/password created like this).
> 
> And I have removed the context.xml file in webapps/DBTest/WEB-INF/lib/
> 
> My testdb.jsp in /tomcat/apache-tomcat-5.5.26/webapps/DBTest looks is 
> shown 
> below:
> 
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> 
> <sql:query var="rs" dataSource="jdbc/TestDB">
> select id, foo, bar from testdata
> </sql:query>
> 
> <html>
>   <head>
>     <title>DB Test</title>
>   </head>
>   <body>
> 
>   <h2>Results</h2>
> 
> <c:forEach var="row" items="${rs.rows}">
>     Foo ${row.foo}<br/>
>     Bar ${row.bar}<br/>
> </c:forEach>
> 
>   </body>
> </html>
> 
> 
> 
> Then shudown and restarted tomcat server.
> 
> 
> I m still getting the DataSource Invalid errors:
> 
> 
> 
> HTTP Status 500 - 
> 
> type Exception report
> 
> message 
> 
> description The server encountered an internal error () that prevented it 
> from fulfilling this request.
> 
> exception org.apache.jasper.JasperException: Unable to get connection, 
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: 
> Cannot 
> create JDBC driver of class '' for connect URL 'null'"
> 
> 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
> 
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 
> root cause javax.servlet.ServletException: Unable to get connection, 
> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: 
> Cannot 
> create JDBC driver of class '' for connect URL 'null'"
> 
> 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> 
> 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> 	org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> 	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> 
> ...
> 
> 
> 
> 
> 
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 
> > ----- Original Message -----
> > From: David Smith
> > Sent: 03/09/08 03:06 am
> > To: Tomcat Users List
> > Subject: Re: Can't execute servlet project
> > 
> > >
> > > Here is the mysql-connector jar file I got in the common/lib 
> directory:
> > >
> > > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > > mysql-connector-java-5.1.3-rc-bin.jar
> > >
> > >
> > >
> > > Is thsi the correct mysql jar file?
> > >   
> > Yes ... looks good.  Just be sure this is the only place you have a 
> > mysql JDBC driver installed.  There should not be one in 
> > webapps/DBTest/WEB-INF/lib if it exists here.
> > 
> > > This is the only context.xml file I got in the tomcat (5.5.26) 
> > directory:
> > >
> > > /tomcat/apache-tomcat-5.5.26/conf/context.xml: ...
> > That is the universal one.  The context xml file should be either in 
> > your webapp's META-INF folder named context.xml or in tomcat's 
> > conf/Catalina/localhost named DBTest.xml.  It only contains a <Context 
> > ... > xml element and it's contents.  Something like:
> > 
> > <Context >
> >    <Resource name="jdbc/TestDB" auth="Container" 
> > type="javax.sql.DataSource"
> >                maxActive="100" maxIdle="30" maxWait="10000"
> >                username="javauser" password="javadude" 
> > driverClassName="com.mysql.jdbc.Driver"
> >                url="jdbc:mysql://localhost:3306/javatest"  
> > validationQuery="select 1" />
> > </Context>
> > 
> > Obviously replace the username, password, and URL with what's 
> > appropriate to your database environment.
> > 
> > You can read more on this at 
> > 
> > 
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> > 
> > --David
> > 
> > sam wun wrote:
> > > Here is the mysql-connector jar file I got in the common/lib 
> directory:
> > >
> > > linux:~/tomcat/apache-tomcat-5.5.26/common/lib # ls mysql*
> > > mysql-connector-java-5.1.3-rc-bin.jar
> > >
> > >
> > >
> > > Is thsi the correct mysql jar file?
> > >
> > >
> > >
> > > Thanks
> > >
> > > Sam
> > >
> > >
> > >
> > >
> > >
> > >   
> > >> ----- Original Message -----
> > >> From: David Smith
> > >> Sent: 03/09/08 01:49 am
> > >> To: Tomcat Users List
> > >> Subject: Re: Can't execute servlet project
> > >>
> > >> DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: 
> > >> Cannot create JDBC driver of class '' for connect URL 'null'"
> > >>
> > >> This error typically indicates the JNDI db pool hasn't been setup 
> > >> correctly.  Some config option isn't setup.  What's in this webapp's 
> > >> context xml file?  Also what's in it's WEB-INF/web.xml?  Lastly, you 
> > >> should have your database driver jar file in tomcat's common/lib 
> (for 
> > >> tomcat v 5.5) or /lib (tomcat v 6). 
> > >>
> > >> You can also take a look at tomcat's JDBC Datasource howto's on the 
> > >> tomcat website for your version of tomcat which offer a lot of help.
> > >>
> > >> --David
> > >>
> > >> sam wun wrote:
> > >>     
> > >>> Thanks David,
> > >>>
> > >>>
> > >>>
> > >>> After copied the jstl and standard dot jar files into the 
> directory:
> > >>>
> > >>> linux:~/tomcat/apache-tomcat-5.5.26/webapps/DBTest/WEB-INF/lib # ls
> > >>> .  ..  jstl.jar  mysql-connector-java-5.1.3-rc-bin.jar  
> standard.jar
> > >>>
> > >>>
> > >>>
> > >>> I got the following different errors:
> > >>>
> > >>> (In line 4, what is jdbc/TestDB? I have database called javatest, 
> and 
> > >>>       
> > >> table 
> > >>     
> > >>> testdata. Should I rename it to jdbc/javatest?
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> HTTP Status 500 - 
> > >>>
> > >>> type Exception report
> > >>>
> > >>> message 
> > >>>
> > >>> description The server encountered an internal error () that 
> > prevented 
> > >>>       
> > >> it 
> > >>     
> > >>> from fulfilling this request.
> > >>>
> > >>> exception org.apache.jasper.JasperException: Exception in JSP: 
> > >>> /testdb.jsp:4
> > >>>
> > >>> 1: <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"

> %>
> > >>> 2: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
> > >>> 3: 
> > >>> 4: <sql:query var="rs" dataSource="jdbc/TestDB">
> > >>> 5: select id, foo, bar from testdata
> > >>> 6: </sql:query>
> > >>> 7: 
> > >>>
> > >>>
> > >>> Stacktrace:
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
> > >>     
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
> > >>     
> > >>> 	
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> > >>     
> > >>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> > >>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>
> > >>> root cause javax.servlet.ServletException: Unable to get 
> connection, 
> > >>> DataSource invalid: 
> "org.apache.tomcat.dbcp.dbcp.SQLNestedException: 
> > >>>       
> > >> Cannot 
> > >>     
> > >>> create JDBC driver of class '' for connect URL 'null'"
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
> > >>     
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
> > >>     
> > >>> 	org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:82)
> > >>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > >>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> > >>     
> > >>> 	
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> > >>     
> > >>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> > >>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>
> > >>> root cause javax.servlet.jsp.JspException: Unable to get 
> connection, 
> > >>> DataSource invalid: 
> "org.apache.tomcat.dbcp.dbcp.SQLNestedException: 
> > >>>       
> > >> Cannot 
> > >>     
> > >>> create JDBC driver of class '' for connect URL 'null'"
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
> > >>     
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
> > >>     
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jsp.testdb_jsp._jspx_meth_sql_005fquery_005f0(testdb_jsp.java:101)
> > >>     
> > >>> 	org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:58)
> > >>> 	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> > >>> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>> 	
> > >>>
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
> > >>     
> > >>> 	
> > >>>       
> > >> 
> > 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
> > >>     
> > >>> 	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 
>   
> >   
> > >>>       
> > >>   
> > >>     
> > >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>   
> > >>>       
> > 
> > 
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > 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