JNDI datasource
I have both the manager and admin up and running. In the admin, I have no datasources under the admin menu. I am attempting to get a datasource showing up here. Can someone walk me through step by step in doing this. I am running tomcat 5.5.12. I have tried the tutorial but have had no luck. Thanks, D
RE: JNDI datasource
went through this and received following error: org.apache.jasper.JasperException: Exception in JSP: /test.jsp:41: %@ 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:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 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:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:81) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 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.test_jsp._jspx_meth_sql_query_0(org.apache.jsp.test_jsp:100) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:58) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs. Caldarale, Charles R [EMAIL PROTECTED] wrote: From: (e==mc²)? [mailto:[EMAIL PROTECTED] Subject: Re: JNDI datasource just a tip why dont you try creating a datasource manually since neuer Tomcat version dont provide the admin application you will be then confortable with laater versions and you will dig into knowing things better ? http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html The OP is running 5.5.12, so the 4.1 doc is not necessarily applicable. The correct links for his level would be: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JNDI datasource
actually - got it - Thanks for the tutorial - I had incorrectly named a folder .. got foo and bar and hello and 12345 working - first jdbc - woohoothanks all David [EMAIL PROTECTED] wrote: Would You send me your server.xml, context.xml and web.xml? György Tomcat Users List schrieb am 07.03.06 16:49:39: went through this and received following error: org.apache.jasper.JasperException: Exception in JSP: /test.jsp:4 1: 2: 3: 4: 5: select id, foo, bar from testdata 6: 7: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 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:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:81) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 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.test_jsp._jspx_meth_sql_query_0(org.apache.jsp.test_jsp:100) org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:58) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs. Caldarale, Charles R wrote: From: (e==mc²)? [mailto:[EMAIL PROTECTED] Subject: Re: JNDI datasource just a tip why dont you try creating a datasource manually since neuer Tomcat version dont provide the admin application you will be then confortable with laater versions and you will dig into knowing things better ? http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html The OP is running 5.5.12, so the 4.1 doc is not necessarily applicable. The correct links for his level would be: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mit freundlichen Grüßen Dr. György Kelemen Email: [EMAIL PROTECTED] Mobil: 0173 534 5668 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: first jdbc tomcat application
I'm running Tomcat 5.5 - The mysql port is 3306 - I made that change to the server.xml file jdbc:mysql://localhost:3306/everycitizen Still get the same result - page not found or Cannot create JDBC driver of class '' for connect URL 'null' . Amila Suriarachchi [EMAIL PROTECTED] wrote: On 2/26/06, David McMinn wrote: I had not added an error-page tag to the web.xml - The default behavior would be a stack trace which would be fine w/ me - In my jsp, I have @ page errorPage=errorpg.jsp.. I don't get a stack trace but I get a page w/ this messageCannot create JDBC driver of class '' for connect URL 'null' . Here is my original posting. I'm stepping through the example Professional Apache Tomcat 5 book by Wrox in Chapter 14 - I have set up the mysql database and confirmed it works and set up the tomcat server and confirmed that I can see my index.jsppage. When I try to go to http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp I get a standard The page cannot be displayed page. I've included all my steps below. Anyone that can help is most appreciated. Thanks in advance.Dave Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml just before the . Password is blotted out. javax.sql.Datasource name=jdbc/WroxTC5 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/everycitizen what is the port u run the mysql server? the default is 3306 jdbc:mysql://localhost:3306/test?autoReconnect=true username=everyuser password=everypass maxActive=20 maxIdle=3 maxWait=100/ 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the entry after the last env-entry. jdbc/WroxTC5 javax.sql.DataSource Container 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % JDBC JNDI Resource Test InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % while (rset.next()) { % rset.close(); stmt.close(); conn.close(); initCtx.close(); % and the errorpg is: An error has occurred Glen Mazza wrote: David McMinn escribió: Unfortunately the logs don't say anything - I just get a page not found. If I take that out (and all subsequent jsp) it works fine. So right up to that point the jsp page renders fine - When I include that one more line, it blows up. I'm still looking but if someone knows please chime in. Thanks, OK, then, perhaps the error page to forward to *that you have defined in the webapp's web.xml file) doesn't exist. TC is trying to forward to that error page, can't find it, and hence returns the page not found error. Glen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
jdbc tomcat
I'm running Tomcat 5.5 and trying to do a very simple jdbc connection a single table. I have set up tomcat to run on port 8070 and the mysql database on the default 3306 port. It's the connection statement in the jsp that is blowing up - If I take that out, it works fine. I'm getting page not found or Cannot create JDBC driver of class '' for connect URL 'null' . Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml javax.sql.Datasource name=jdbc/WroxTC5 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/everycitizen username=everyuser password=% maxActive=20 maxIdle=3 maxWait=100/ 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the entry after the last env-entry. jdbc/WroxTC5 javax.sql.DataSource Container 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % JDBC JNDI Resource Test InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % while (rset.next()) { % rset.close(); stmt.close(); conn.close(); initCtx.close(); %
Re: jdbc tomcat
no change - same situation. Mike Sabroff [EMAIL PROTECTED] wrote: When I do this from a program or bean or servlet, i make the connection a true url: url=jdbc:mysql://localhost:3306/everycitizen?username=everyuserpassword=% I dont know if it is different in the server.xml as I have never tried this, but why should it be? I have been fooled by thinking logically b4 and I know that things are different in different setups, but it's worth a try, huh? Mike David McMinn wrote: I'm running Tomcat 5.5 and trying to do a very simple jdbc connection a single table. I have set up tomcat to run on port 8070 and the mysql database on the default 3306 port. It's the connection statement in the jsp that is blowing up - If I take that out, it works fine. I'm getting page not found or Cannot create JDBC driver of class '' for connect URL 'null' . Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml javax.sql.Datasource name=jdbc/WroxTC5 driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/everycitizen username=everyuser password=% maxActive=20 maxIdle=3 maxWait=100/ 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the entry after the last env-entry. jdbc/WroxTC5 javax.sql.DataSource Container 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % JDBC JNDI Resource Test InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % while (rset.next()) { % rset.close(); stmt.close(); conn.close(); initCtx.close(); % -- Mike Sabroff Web Services Developer [EMAIL PROTECTED] 920-568-8379 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cannot create JDBC driver of class '' for connect URL 'null'
Tomcat Server 5.5.15 - I searched for solutions and most mention a Context element in the server.xml. I only have a DefaultContext tag within with I have my resouce tag: DefaultContext Resource auth=Container driverClassName=com.mysql.jdbc.Driver logAbandoned=true maxActive=100 maxIdle=30 maxWait=1 name=jdbc/wroxTC5 password=everypass removeAbandoned=true removeAbandonedTimeout=300 type=javax.sql.DataSource url=jdbc:mysql://localhost:3306/everycitizen?autoReconnect=true username=everyuser / /DefaultContext The actual failure is on the connection = ds.getConnection(); line in the jsp if that helps any. SEVERE: Servlet.service() for servlet jsp threw exception org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at org.apache.jsp.wroxjdbc.JDBCTest_jsp._jspService(org.apache.jsp.wroxjdbc.JDBCTest_jsp:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:831) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203) at java.lang.Thread.run(Unknown Source) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(Unknown Source) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 21 more
Re: first jdbc tomcat application
I had not added an error-page tag to the web.xml - The default behavior would be a stack trace which would be fine w/ me - In my jsp, I have @ page errorPage=errorpg.jsp.. I don't get a stack trace but I get a page w/ this messageCannot create JDBC driver of class '' for connect URL 'null' . Here is my original posting. I'm stepping through the example Professional Apache Tomcat 5 book by Wrox in Chapter 14 - I have set up the mysql database and confirmed it works and set up the tomcat server and confirmed that I can see my index.jsp page. When I try to go to http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp I get a standard The page cannot be displayed page. I've included all my steps below. Anyone that can help is most appreciated. Thanks in advance.Dave Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml just before the /Host tag. Password is blotted out. !-- added by DM 2/22/2006 -- DefaultContext Resource name=jdbc/WroxTC5 auth=Container type=javax.sql.Datasource driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/everycitizen username=everyuser password=everypass maxActive=20 maxIdle=3 maxWait=100/ /DefaultContext 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the /web-app entry after the last env-entry. resource-ref res-ref-namejdbc/WroxTC5/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: html head %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % /head h1JDBC JNDI Resource Test/h1 % InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % table width = '600' border='1' tr th align='left'/th /tr % while (rset.next()) { % trtd %=rset.getInt(0)%/td/tr % } rset.close(); stmt.close(); conn.close(); initCtx.close(); % /table /html and the errorpg is: html %@ page isErrorPage=true % h1 An error has occurred /h1 %= exception.getMessage() % /html Glen Mazza [EMAIL PROTECTED] wrote: David McMinn escribió: Unfortunately the logs don't say anything - I just get a page not found. If I take that out (and all subsequent jsp) it works fine. So right up to that point the jsp page renders fine - When I include that one more line, it blows up. I'm still looking but if someone knows please chime in. Thanks, OK, then, perhaps the error page to forward to *that you have defined in the webapp's web.xml file) doesn't exist. TC is trying to forward to that error page, can't find it, and hence returns the page not found error. Glen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
First JDBC tomcat app
I'm stepping through the example Professional Apache Tomcat 5 book by Wrox in Chapter 14 - I have set up the mysql database and confirmed it works and set up the tomcat server and confirmed that I can see my index.jsp page. When I try to go to http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp I get a standard The page cannot be displayed page. I've included all my steps below. Anyone that can help is most appreciated. Thanks in advance.Dave Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml just before the /Host tag. Password is blotted out. !-- added by DM 2/22/2006 -- DefaultContext Resource name=jdbc/WroxTC5 auth=Container type=javax.sql.Datasource driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/everycitizen username=everyuser password=everypass maxActive=20 maxIdle=3 maxWait=100/ /DefaultContext 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the /web-app entry after the last env-entry. resource-ref res-ref-namejdbc/WroxTC5/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: html head %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % /head h1JDBC JNDI Resource Test/h1 % InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % table width = '600' border='1' tr th align='left'/th /tr % while (rset.next()) { % trtd %=rset.getInt(0)%/td/tr % } rset.close(); stmt.close(); conn.close(); initCtx.close(); % /table /html and the errorpg is: html %@ page isErrorPage=true % h1 An error has occurred /h1 %= exception.getMessage() % /html
RE: first jdbc tomcat application
8070 works - i changed because i had a conflict w/ 8080 - Based on Roberts response (below) - I've narrowed it down to this statement in the jsp Connection conn = ds.getConnection(); Unfortunately the logs don't say anything - I just get a page not found. If I take that out (and all subsequent jsp) it works fine. So right up to that point the jsp page renders fine - When I include that one more line, it blows up. I'm still looking but if someone knows please chime in. Thanks, Dave What do the logs say? Have you tried connecting to MySQL outside of Tomcat? Does that work? Can you get the page to display without the JDBC stuff in it? /robert Samara, Fadi N Mr ACSIM/ASPEX [EMAIL PROTECTED] wrote: Classification: UNCLASSIFIED Caveats: NONE That's what I was thinking, but it could easily be changed and he indicated that he was successfully able to bring up Tomcat's index page. So I am not sure this is an issue. Fadi -Original Message- From: Glen Mazza [mailto:[EMAIL PROTECTED] Sent: Friday, February 24, 2006 1:07 PM To: Tomcat Users List Subject: Re: first jdbc tomcat application David McMinn wrote: When I try to go to http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp I get a standard The page cannot be displayed page. Port wrong? It is 8080 by default. Glen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Classification: UNCLASSIFIED Caveats: NONE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
first jdbc tomcat application
I'm stepping through the example Professional Apache Tomcat 5 book by Wrox in Chapter 14 - I have set up the mysql database and confirmed it works and set up the tomcat server and confirmed that I can see my index.jsp page. When I try to go to http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp I get a standard The page cannot be displayed page. I've included all my steps below. Anyone that can help is most appreciated. Thanks in advance.Dave Steps I have done 1) Created a DB called everycitizen and a table called test with a column called pk. Created user everyuser w/ a password and granted Select privileges to that user. 2) Copied the mysql-connector-java-3.1.12-bin.jar into $CATALINA_HOME/common/lib. 3)Added the following to the $CATALINA_HOME/conf/server.xml just before the /Host tag. Password is blotted out. !-- added by DM 2/22/2006 -- DefaultContext Resource name=jdbc/WroxTC5 auth=Container type=javax.sql.Datasource/ ResourceParams name=jdbc/WroxTC5 parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/everycitizen/value /parameter parameter nameusername/name valueeveryuser/value /parameter parameter namepassword/name value*/value /parameter parameter namemaxActive/name ; value20/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /DefaultContext 4) Added the following to the $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom just before the /web-app entry after the last env-entry. resource-ref res-ref-namejdbc/WroxTC5/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 5) Added the JDBCTest.jsp file and the errorpg.jsp file to $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the wroxjdbc folder. The JDBC Test is: html head %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, java.io.*, javax.naming.InitialContext, javax.naming.Context % /head body h1JDBC JNDI Resource Test/h1 % InitialContext initCtx = new InitialContext(); DataSource ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from test;); % table width = '600' border='1' tr th align='left'/th /tr % while (rset.next()) { % trtd %=rset.getInt(0)%/td/tr % } rset.close(); stmt.close(); conn.close(); initCtx.close(); % /table /body /html and the errorpg is: html body %@ page isErrorPage=true % h1 An error has occurred /h1 %= exception.getMessage() % /body /html