Tomcat 5.5.20 and MySQL connection configuration problems

Hello,

I am a total newbie and have tried everything now. I have searched all forums but found nothing that helps me. Seriously, I give up and need help (please)!

Here's my problem:

When I startup Tomcat I get this:

2006-dec-17 22:51:24 org.apache.commons.modeler.RegistryregisterComponent

SEVERE: Null component Catalina:type=DataSource,path=/testweb,host=localhost,

class=javax.sql.DataSource,name="jdbc/test"

Here is my WEB-INF/web.xml (Updated this sentence here, wrote META-INF before...)

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/test</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

Here is my WEB-INF/Context.xml ((Updated this sentence here, wrote META-INF before...)

<Context patch="/testweb" reloadable="true" docBase="C:\Program Files\apache-tomcat-5.5.20\webapps\testweb" workDir="C:\Program Files\apache-tomcat-5.5.20\webapps\testweb">

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<ResourceLink name="jdbc/test"

global="jdbc/test"

type="javax.sql.DataSource"

maxActive="10"

maxIdle="20"

maxWait="3000"

username="root"

password="nicsoftdb123"

driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://localhost:3306/test"/>

</Context>

My <Resource...> tag in conf/server.xml

<Resource name="jdbc/test"

scope="shareable"

type="javax.sql.DataSource"

driverClassName="com.mysql.jdbc.Driver"

factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"

url="jdbc:mysql://localhost:3306/test"

username="root"

password="xxxxxxxx"

maxActive="10"

maxIdle="20"

maxWait="3000"/>

My java code:

Context initCtx =new InitialContext();

DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/test");

It clashes at the second row with

"javax.naming.NameNotFoundException: Name java:comp is not bound in this Context"

due to above problem I guess...

I use Tomcat 5.5.20

Java SE 1.5.0_06

Java J2EE 1.4_03

MySQL Community Server 5.0.27

MySQL Connector 5.0.4

Please help!

Regards,

Niklas

Message was edited by:

Nic_Soft

Message was edited by:

Nic_Soft

[3532 byte] By [Nic_Softa] at [2007-11-26 12:51:43]
# 1
Ok, did a stupid mistake for the first problem. Context.xml should be in META-INF not WEB-INF. The rest of the problem (javax.naming.NameNotFoundException: Name java:comp is not bound in this Context) still exist. Moves it to an other heading in this forum. (JDBC I guess...).
Nic_Softa at 2007-7-7 16:39:44 > top of Java-index,Core,Core APIs...