Hi,
here is some more informations about JNDI, PostgreSQL, etc:
I wrote, I had the same problem, and here is my solution:
Create in your development environment (Eclipse, NetBeans, Midnight
Commander...) the META-INF/context.xml with the following content:
<Context>
<Resource ....... />
</Context>
Add to your WEB-INF/web.xml the <resource-ref /> tag.
Create WAR file containing all the required files (incl.
META-INF/context.xml!!!)
and deplay it.
Tomcat, during deploy, looks for the META-INF/context.xml and copies
it into ${CATALINA_HOME}/conf/Catalina/localhost/[app_name].xml.
Here is my files:
META-INF/context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource auth="Container" description="Test database connection"
name="jdbc/testDB" type="javax.sql.DataSource" password="test"
driverClassName="org.postgresql.Driver" maxIdle="20"
maxWait="5000"
validationQuery="" username="test"
url="jdbc:postgresql://127.0.0.1:5432/test" maxActive="20" />
</Context>
===
WEB-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Pokus</display-name>
<servlet>
<description></description>
<display-name>Test</display-name>
<servlet-name>Test</servlet-name>
<servlet-class>test.Test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>jdbc/testDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>
Unshareable
</res-sharing-scope>
</resource-ref>
</web-app>
===
Hope to helps you!
I found it here:
http://www.theserverside.com/discussions/thread.tss?thread_id=29795#156653
Have a nice day!
PETR
On 1/31/06, Lothar Krenzien <[EMAIL PROTECTED]> wrote:
>
> Hi Petr,
>
> thanks for your answer. That exactly the configuration I have. But after
> playing around I got success by removing the line
>
> <Listener className="org.apache.catalina.core.AprLifecycleListener" />
>
> from the server.xml. Even I don't know what it means ;)
>
>
> Lothar
>
> "Tomcat Users List" <[email protected]> schrieb am 31.01.06 17:55:29:
> >
> > Hi,
> >
> > I have the following problem. I found this solution:
> >
> > There is in the server.xml the Resource tag describing your
> > dataSource. Move this element into the Context element in the same xml
> > file (at the bottom).
> >
> > See http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
> > section `JDBC Data Sources'
> >
> > Have a nice time
> >
> > PETR
> >
> >
> > On 1/31/06, Lothar Krenzien <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > after switching from Tomcat 5.5.9 to 5.5.15 I get the following error :
> > >
> > > 2006-01-31 16:43:38,130 [INFO ] QueryLogger.*** error.
> > > 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.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:298)
> > > at
> > > org.objectstyle.cayenne.access.DataDomainQueryAction.performQuery(DataDomainQueryAction.java:107)
> > > at
> > > org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:643)
> > > at
> > > org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1100)
> > > at
> > > org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.java:207)
> > > at
> > > org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1068)
> > > at
> > > org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:173)
> > > at
> > > org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:93)
> > > at
> > > org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1200)
> > > at com.sr2.back.dao.UserDAO.getAvailableRoles(UserDAO.java:168)
> > > ....
> > >
> > > Caused by: java.sql.SQLException: No suitable driver
> > > at java.sql.DriverManager.getDriver(DriverManager.java:243)
> > > at
> > > org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
> > >
> > >
> > > I have copied the settings and libraries from the old (5.5.9) tomcat
> > > version to the new (5.5.19) version. And there *is* a JDBC driver in the
> > > commons/lib dir. I'm not sure is it a tomcat or cayenne problem. So I
> > > will post it here and in the cayenne group. But database access seems to
> > > work anyway. Additionally I've just realized that the UserDAO class is
> > > called twice and the second one it works without an error. So where does
> > > Tomcat searching for the database ? Normally it should passed per JNDI.
> > >
> > >
> > > Thanks, Lothar
> > > ______________________________________________________________________
> > > XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
> > > Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>