Hello, there is a difference between how resources are defined in 5.0 and 5.5. In 5.0 you could provide your resource definitions right in the server.xml, but in 5.5 you need to create a separate context.xml file ($CATALINA_HOME/conf/Catalina/<hostname>/context.xml) and put resource definitions there. See this link: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
I also had this problem when migrating from 5.0 to 5.5. After I defined a separate context.xml it started to work again. Regards, -- Andrew Stepanenko, http://unf.tane.edu.ua On 9/23/06, Alan Chandler <[EMAIL PROTECTED]> wrote:
I am struggling to figure out why my Tomcat installation is failing to allow me to connect my java web application to a database. I am looking for ideas as to how to find out what is wrong. I have (what I think) is the same setup on another machine and it works fine. The only difference between these is that the working one in tomcat 5.0 and this machine is tomcat 5.5 (although I am just about and try with a 5.0 setup). I am trying with this simple piece of code - plucked from the tomcat docs. Context initCtx; try { initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource) envCtx.lookup("jdbc/akcmoney"); Connection conn = ds.getConnection(); } catch (Exception e1) { e1.printStackTrace(); } and with debug, I can see that initCtX, envCtx and ds all are assigned non null values, but the ds.getConnection() results in the following. org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I have the postgresql jdbc driver jar in $CATALINA.BASE/common/lib Server.xml contains <Context docBase="akcmoney" path="/akcmoney" reloadable="true" source="org.eclipse.jst.j2ee.server:akcmoney"> <Resource auth="Container" name="jdbc/akcmoney" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/akcmoney"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>org.postgresql.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:postgresql://127.0.0.1:5432/akcmoney</value> </parameter> <parameter> <name>username</name> <value>tomcat4</value> </parameter> <parameter> <name>password</name> <value>xxxxxxx</value> </parameter> <parameter> <name>maxActive</name> <value>20</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>-1</value> </parameter> </ResourceParams> </Context> my WEB-INF/web.xml contains this reference. <resource-ref> <description>AKCMoney Database</description> <res-ref-name>jdbc/akcmoney</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> Anyone any ideas where I am going wrong, or how to look at the contents of the nitCtX, envCtx and ds variables in the above code snippet to understand how far I have got -- Alan Chandler http://www.chandlerfamily.org.uk --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]