You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Caldarale, Charles R" <Ch...@unisys.com> on 2009/03/03 19:32:49 UTC

RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

> From: Stanley Wong [mailto:wong@pcigeomatics.com]
> Subject: RE: FW: Cannot create JDBC driver of class '' for
> connect URL 'null'
>
> The layout looked like this, except I did place the
> postgres driver in the lib directory. In additions,
> I place the postgre driver in both [tomcat home]/lib
> and [tomcat home]/lib/common

Don't ever do that.  If you're using Tomcat's connection pooling, JDBC driver jars should be placed in [tomcat_home]/lib ONLY.  Remove it from all the other places you erroneously put it.

> |    - lib
> |        - common

Unless you've done some serious reconfiguration of Tomcat (and you shouldn't), there's no such directory as lib/common.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Stanley Wong [mailto:wong@pcigeomatics.com]
> Subject: RE: FW: Cannot create JDBC driver of class '' for
> connect URL 'null'
>
> My typo. The layout should look like this:

Same comment still applies - there is no [tomcat_home]/common directory, and you shouldn't create one.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Pid <p...@pidster.com>.
Stanley Wong wrote:
> I have other application installed that do the direct JDBC connection. 
> 
> To simplify it, I have two applications in the Tomcat. 
> 	App1: Use the direct JDBC connection. 
> 	App2: Use the JNDI. 
> 
> Therefore App1 has the postgreSQL in its lib folder. 
> 
> Is it the issue that App2 fails to get the JNDI-JDBC connection from
> Tomcat?

Can you first confirm that you've only got the driver in ONE place:
 tomcat/lib?

When you've done that restart the server and check to see if both of
your applications work.

If they don't work, then ask here again, but *only* if you've followed
Chuck & David's advice to remove the driver from two of the three locations.

p




> Stanley 
> 
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Tuesday, March 03, 2009 1:55 PM
> To: Tomcat Users List
> Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
> 'null'
> 
> Stanley Wong wrote:
>> My typo. The layout should look like this:
>>
>> |[tomcat home]
>> |    - conf
>> |        - server.xml
>> |    - webapps
>> |        - someApp (case IS important!)
>> |            - META-INF
>> |                - context.xml
>> |            - (various jsps/static files)
>> |            - WEB-INF
>> |                - web.xml
>> |                - lib
>> |                    - (the postgres driver is HERE)
>> |    - lib
>> |        - postgres driver
>> |    - common
>> |        - lib
>> |            - postgres driver
>>
>>   
> Just to emphasize what Chuck is trying to say, tomcat's lib directory
> and your webapp's lib directory are mutually exclusive.  If a jar exists
> in one, it cannot exist in the other.  In your case, the postgresql
> driver should ONLY be in tomcat's lib directory and in no other tomcat
> directories, including other webapps this tomcat installation might be
> hosting.
> 
> --David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
Thanks for the help. 

I followed David's suggestions to install Tomcat on another machine and
the JNDI JDBC works finally. 

The Tomcat version from the original machine should miss something that
causes the failure of JNDI-JDBC. 

Stanley 

-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Wednesday, March 04, 2009 12:12 PM
To: Tomcat Users List
Subject: RE: Cannot create JDBC driver of class '' for connect URL
'null'


at last count there are 16 different supported drivers for Postgres
http://jdbc.postgresql.org/download.html#current

which driver are you implementing?

BTW here the url should be
jdbc:postgresql://host:port/database

contents of %POSTGRES_HOME%/data/postgresql.conf:

listen_addresses = 'localhost'        # what IP address(es) to listen
on; 
                    # comma-separated list of addresses;
                    # defaults to 'localhost', '*' = all
                    # (change requires restart)
port = 5432
assuming the host and port are identical the URL should be..
jdbc:postgresql://localhost:5432/databaseask your DBA what the name of
the DB is..
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission. 




> Date: Wed, 4 Mar 2009 10:56:52 -0500
> From: dns4@cornell.edu
> To: users@tomcat.apache.org
> Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
'null'
> 
> Stanley Wong wrote:
> > Thanks, David. 
> >
> > Unfortunately, it still fails. 
> >
> > Does it have other tools that we may use to get more clues? 
> >
> > Thank you,
> >
> > Stanley 
> >
> >   
> Unfortunately I'm out of ideas at this point.  Everything in front of
me
> suggests this should be working at this point.  If I were you, I would
> go through the JNDI howto on tomcat's website step by step in a
parallel
> webapp and see if you can get the examples there to work.  After
getting
> that to work, compare what you have with that to see where the
> differences are.  I've done this setup many, many times and have
> consistently been able to get it working almost from the first try.
> 
> One last thought -- looking back through the thread, I can't see where
> this might have been mentioned, but is this tomcat install a genuine
> tomcat from tomcat.apache.org or is this a third party repackage?  If
> it's a third party repackage (possibly from a linux vendor), try your
> webapp with a genuine tomcat downloaded from tomcat.apache.org.  If
that
> fixes anything, you might want to either replace the third party
package
> or contact people maintaining your linux distribution for help.
> 
> --David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Windows Live(tm) Groups: Create an online spot for your favorite groups
to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Martin Gainty <mg...@hotmail.com>.
at last count there are 16 different supported drivers for Postgres
http://jdbc.postgresql.org/download.html#current

which driver are you implementing?

BTW here the url should be
jdbc:postgresql://host:port/database

contents of %POSTGRES_HOME%/data/postgresql.conf:

listen_addresses = 'localhost'        # what IP address(es) to listen on; 
                    # comma-separated list of addresses;
                    # defaults to 'localhost', '*' = all
                    # (change requires restart)
port = 5432
assuming the host and port are identical the URL should be..
jdbc:postgresql://localhost:5432/databaseask your DBA what the name of the DB is..
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Wed, 4 Mar 2009 10:56:52 -0500
> From: dns4@cornell.edu
> To: users@tomcat.apache.org
> Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'
> 
> Stanley Wong wrote:
> > Thanks, David. 
> >
> > Unfortunately, it still fails. 
> >
> > Does it have other tools that we may use to get more clues? 
> >
> > Thank you,
> >
> > Stanley 
> >
> >   
> Unfortunately I'm out of ideas at this point.  Everything in front of me
> suggests this should be working at this point.  If I were you, I would
> go through the JNDI howto on tomcat's website step by step in a parallel
> webapp and see if you can get the examples there to work.  After getting
> that to work, compare what you have with that to see where the
> differences are.  I've done this setup many, many times and have
> consistently been able to get it working almost from the first try.
> 
> One last thought -- looking back through the thread, I can't see where
> this might have been mentioned, but is this tomcat install a genuine
> tomcat from tomcat.apache.org or is this a third party repackage?  If
> it's a third party repackage (possibly from a linux vendor), try your
> webapp with a genuine tomcat downloaded from tomcat.apache.org.  If that
> fixes anything, you might want to either replace the third party package
> or contact people maintaining your linux distribution for help.
> 
> --David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Windows Liveā„¢ Groups: Create an online spot for your favorite groups to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009

RE: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
I know very little about UminnServer. We just pick a GIS handy. 

We use javascripts to interact with GoogleEarth Server. Certainly GWT
can do the jobs, but we use pure javascripts instead.

Mostly we interact with Google Map API. There are tons of sample codes
in Google Map API website that provide good examples.

Stanley  

-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, March 07, 2009 10:06 AM
To: Tomcat Users List
Subject: RE: Cannot create JDBC driver of class '' for connect URL
'null'


Hello Wong-

Now that your PostGIS Datasource and JDBCRealm configurations are
correct..a few questions
do you prefer GoogleEarth over the UMinn MapServer?
Can you use GWT Ajax tools to construct pages to interact with
GoogleEarth Server?
Does GoogleEarth have any tutorials available?

Thanks
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission. 




> Subject: RE: FW: Cannot create JDBC driver of class '' for connect URL
'null'
> Date: Wed, 4 Mar 2009 11:02:26 -0500
> From: wong@pcigeomatics.com
> To: users@tomcat.apache.org
> 
> Thank you. In fact, I did follow it step-by-step. The someApp is the
> actual app that I use. 
> 
> And, the server that I use is the one with Google Earth Enterprise. It
> is possible that some settings may have been overidden. 
> 
> Thanks for your help!!
> 
> Stanley 
> 
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Wednesday, March 04, 2009 10:57 AM
> To: Tomcat Users List
> Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
> 'null'
> 
> Stanley Wong wrote:
> > Thanks, David. 
> >
> > Unfortunately, it still fails. 
> >
> > Does it have other tools that we may use to get more clues? 
> >
> > Thank you,
> >
> > Stanley 
> >
> >   
> Unfortunately I'm out of ideas at this point.  Everything in front of
me
> suggests this should be working at this point.  If I were you, I would
> go through the JNDI howto on tomcat's website step by step in a
parallel
> webapp and see if you can get the examples there to work.  After
getting
> that to work, compare what you have with that to see where the
> differences are.  I've done this setup many, many times and have
> consistently been able to get it working almost from the first try.
> 
> One last thought -- looking back through the thread, I can't see where
> this might have been mentioned, but is this tomcat install a genuine
> tomcat from tomcat.apache.org or is this a third party repackage?  If
> it's a third party repackage (possibly from a linux vendor), try your
> webapp with a genuine tomcat downloaded from tomcat.apache.org.  If
that
> fixes anything, you might want to either replace the third party
package
> or contact people maintaining your linux distribution for help.
> 
> --David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Hotmail(r) is up to 70% faster. Now good news travels really fast. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_0320
09


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Martin Gainty <mg...@hotmail.com>.
Hello Wong-

Now that your PostGIS Datasource and JDBCRealm configurations are correct..a few questions
do you prefer GoogleEarth over the UMinn MapServer?
Can you use GWT Ajax tools to construct pages to interact with GoogleEarth Server?
Does GoogleEarth have any tutorials available?

Thanks
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Subject: RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'
> Date: Wed, 4 Mar 2009 11:02:26 -0500
> From: wong@pcigeomatics.com
> To: users@tomcat.apache.org
> 
> Thank you. In fact, I did follow it step-by-step. The someApp is the
> actual app that I use. 
> 
> And, the server that I use is the one with Google Earth Enterprise. It
> is possible that some settings may have been overidden. 
> 
> Thanks for your help!!
> 
> Stanley 
> 
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Wednesday, March 04, 2009 10:57 AM
> To: Tomcat Users List
> Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
> 'null'
> 
> Stanley Wong wrote:
> > Thanks, David. 
> >
> > Unfortunately, it still fails. 
> >
> > Does it have other tools that we may use to get more clues? 
> >
> > Thank you,
> >
> > Stanley 
> >
> >   
> Unfortunately I'm out of ideas at this point.  Everything in front of me
> suggests this should be working at this point.  If I were you, I would
> go through the JNDI howto on tomcat's website step by step in a parallel
> webapp and see if you can get the examples there to work.  After getting
> that to work, compare what you have with that to see where the
> differences are.  I've done this setup many, many times and have
> consistently been able to get it working almost from the first try.
> 
> One last thought -- looking back through the thread, I can't see where
> this might have been mentioned, but is this tomcat install a genuine
> tomcat from tomcat.apache.org or is this a third party repackage?  If
> it's a third party repackage (possibly from a linux vendor), try your
> webapp with a genuine tomcat downloaded from tomcat.apache.org.  If that
> fixes anything, you might want to either replace the third party package
> or contact people maintaining your linux distribution for help.
> 
> --David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
HotmailĀ® is up to 70% faster. Now good news travels really fast. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009

RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
Thank you. In fact, I did follow it step-by-step. The someApp is the
actual app that I use. 

And, the server that I use is the one with Google Earth Enterprise. It
is possible that some settings may have been overidden. 

Thanks for your help!!

Stanley 

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Wednesday, March 04, 2009 10:57 AM
To: Tomcat Users List
Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
'null'

Stanley Wong wrote:
> Thanks, David. 
>
> Unfortunately, it still fails. 
>
> Does it have other tools that we may use to get more clues? 
>
> Thank you,
>
> Stanley 
>
>   
Unfortunately I'm out of ideas at this point.  Everything in front of me
suggests this should be working at this point.  If I were you, I would
go through the JNDI howto on tomcat's website step by step in a parallel
webapp and see if you can get the examples there to work.  After getting
that to work, compare what you have with that to see where the
differences are.  I've done this setup many, many times and have
consistently been able to get it working almost from the first try.

One last thought -- looking back through the thread, I can't see where
this might have been mentioned, but is this tomcat install a genuine
tomcat from tomcat.apache.org or is this a third party repackage?  If
it's a third party repackage (possibly from a linux vendor), try your
webapp with a genuine tomcat downloaded from tomcat.apache.org.  If that
fixes anything, you might want to either replace the third party package
or contact people maintaining your linux distribution for help.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by David Smith <dn...@cornell.edu>.
Stanley Wong wrote:
> Thanks, David. 
>
> Unfortunately, it still fails. 
>
> Does it have other tools that we may use to get more clues? 
>
> Thank you,
>
> Stanley 
>
>   
Unfortunately I'm out of ideas at this point.  Everything in front of me
suggests this should be working at this point.  If I were you, I would
go through the JNDI howto on tomcat's website step by step in a parallel
webapp and see if you can get the examples there to work.  After getting
that to work, compare what you have with that to see where the
differences are.  I've done this setup many, many times and have
consistently been able to get it working almost from the first try.

One last thought -- looking back through the thread, I can't see where
this might have been mentioned, but is this tomcat install a genuine
tomcat from tomcat.apache.org or is this a third party repackage?  If
it's a third party repackage (possibly from a linux vendor), try your
webapp with a genuine tomcat downloaded from tomcat.apache.org.  If that
fixes anything, you might want to either replace the third party package
or contact people maintaining your linux distribution for help.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
Thanks, David. 

Unfortunately, it still fails. 

Does it have other tools that we may use to get more clues? 

Thank you,

Stanley 

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Tuesday, March 03, 2009 7:50 PM
To: Tomcat Users List
Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
'null'

Stanley Wong wrote:
> I took away the postgres jar file from the application/WEB-INF/lib
> folder.
>
> Unfortunately, I still encounter the error. 
>
> I look into the log files. The deployment seems successful. 
>
> I tracked the errors for days, and still could not get a clue. 
>
> Please help me to give me some insights.
>
> Thank you.
>
> Stanley
>
>
>
> All files are attached again below. 
>
> META-INF\context.xml
> ====================
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path="/someApp" docBase="someApp"
>    crossContext="true" reloadable="true" debug="1">
>
> <Resource name="jdbc/postgres" auth="Container"
>           type="javax.sql.DataSource"
> driverClassName="org.postgresql.Driver"
>           url="jdbc:postgresql://127.0.0.1:5432/testdb"
>           username="gepguser" password="password" maxActive="20"
> maxIdle="10" maxWait="-1"/>
> </Context>
>
> WEB-INF\web.xml
> ===============
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>   	<resource-ref>
> 		<description>postgreSQL Datasource example</description>
> 		<res-ref-name>jdbc/postgres</res-ref-name>
> 		<res-type>javax.sql.DataSource</res-type>
> 		<res-auth>Container</res-auth>
> 	</resource-ref>
> </webapp>
>
> server.xml
> ==========
> <?xml version='1.0' encoding='utf-8'?>
> <Server port="8005" shutdown="SHUTDOWN">
>
>   <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>   <Listener className="org.apache.catalina.core.JasperListener" />
>   <Listener
> className="org.apache.catalina.mbeans.ServerLifecycleListener" />
>   <Listener
>
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> />
>
>   <GlobalNamingResources>
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and
saved"
>  
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
>   <Service name="Catalina">
>   
>     <Connector port="8009" enableLookups="false" protocol="AJP/1.3"
> redirectPort="8443" maxPostSize="0" />
>
>     <Engine name="Catalina" defaultHost="localhost">
>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>
>       </Host>
>     </Engine>
>   </Service>
> </Server>
>
> The call:
>
> 		Context initCtx;
> 		try {
> 			initCtx = new InitialContext();
> 			DataSource ds = (DataSource) initCtx
> 	
> .lookup("java:comp/env/jdbc/postgres");
>
> 			conn = ds.getConnection();
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   
Ok ... this is a really stupid error and so small I missed it several
times until I did a thorough comparison between your stuff and the docs
at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.h
tml.

Change "java:comp/env/jdbc/postgres" to "java:/comp/env/jdbc/postgres"
in your java code performing the lookup.  Notice the '/' character
between the colon and word 'comp'?  In your posted java code, it's
missing.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by David Smith <dn...@cornell.edu>.
Stanley Wong wrote:
> I took away the postgres jar file from the application/WEB-INF/lib
> folder.
>
> Unfortunately, I still encounter the error. 
>
> I look into the log files. The deployment seems successful. 
>
> I tracked the errors for days, and still could not get a clue. 
>
> Please help me to give me some insights.
>
> Thank you.
>
> Stanley
>
>
>
> All files are attached again below. 
>
> META-INF\context.xml
> ====================
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path="/someApp" docBase="someApp"
>    crossContext="true" reloadable="true" debug="1">
>
> <Resource name="jdbc/postgres" auth="Container"
>           type="javax.sql.DataSource"
> driverClassName="org.postgresql.Driver"
>           url="jdbc:postgresql://127.0.0.1:5432/testdb"
>           username="gepguser" password="password" maxActive="20"
> maxIdle="10" maxWait="-1"/>
> </Context>
>
> WEB-INF\web.xml
> ===============
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>   	<resource-ref>
> 		<description>postgreSQL Datasource example</description>
> 		<res-ref-name>jdbc/postgres</res-ref-name>
> 		<res-type>javax.sql.DataSource</res-type>
> 		<res-auth>Container</res-auth>
> 	</resource-ref>
> </webapp>
>
> server.xml
> ==========
> <?xml version='1.0' encoding='utf-8'?>
> <Server port="8005" shutdown="SHUTDOWN">
>
>   <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>   <Listener className="org.apache.catalina.core.JasperListener" />
>   <Listener
> className="org.apache.catalina.mbeans.ServerLifecycleListener" />
>   <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> />
>
>   <GlobalNamingResources>
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
>  
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
>   <Service name="Catalina">
>   
>     <Connector port="8009" enableLookups="false" protocol="AJP/1.3"
> redirectPort="8443" maxPostSize="0" />
>
>     <Engine name="Catalina" defaultHost="localhost">
>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>
>       </Host>
>     </Engine>
>   </Service>
> </Server>
>
> The call:
>
> 		Context initCtx;
> 		try {
> 			initCtx = new InitialContext();
> 			DataSource ds = (DataSource) initCtx
> 	
> .lookup("java:comp/env/jdbc/postgres");
>
> 			conn = ds.getConnection();
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   
Ok ... this is a really stupid error and so small I missed it several
times until I did a thorough comparison between your stuff and the docs
at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html.

Change "java:comp/env/jdbc/postgres" to "java:/comp/env/jdbc/postgres"
in your java code performing the lookup.  Notice the '/' character
between the colon and word 'comp'?  In your posted java code, it's missing.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
I took away the postgres jar file from the application/WEB-INF/lib
folder.

Unfortunately, I still encounter the error. 

I look into the log files. The deployment seems successful. 

I tracked the errors for days, and still could not get a clue. 

Please help me to give me some insights.

Thank you.

Stanley



All files are attached again below. 

META-INF\context.xml
====================
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/someApp" docBase="someApp"
   crossContext="true" reloadable="true" debug="1">

<Resource name="jdbc/postgres" auth="Container"
          type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://127.0.0.1:5432/testdb"
          username="gepguser" password="password" maxActive="20"
maxIdle="10" maxWait="-1"/>
</Context>

WEB-INF\web.xml
===============
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
  	<resource-ref>
		<description>postgreSQL Datasource example</description>
		<res-ref-name>jdbc/postgres</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
</webapp>

server.xml
==========
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
 
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
  
    <Connector port="8009" enableLookups="false" protocol="AJP/1.3"
redirectPort="8443" maxPostSize="0" />

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

      </Host>
    </Engine>
  </Service>
</Server>

The call:

		Context initCtx;
		try {
			initCtx = new InitialContext();
			DataSource ds = (DataSource) initCtx
	
.lookup("java:comp/env/jdbc/postgres");

			conn = ds.getConnection();


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by David Smith <dn...@cornell.edu>.
Stanley Wong wrote:
> I have other application installed that do the direct JDBC connection. 
>
> To simplify it, I have two applications in the Tomcat. 
> 	App1: Use the direct JDBC connection. 
> 	App2: Use the JNDI. 
>
> Therefore App1 has the postgreSQL in its lib folder. 
>
> Is it the issue that App2 fails to get the JNDI-JDBC connection from
> Tomcat?
>
> Stanley 
>
>   
You are lucky you haven't had a problem yet with that setup so far.  It
typically causes a conflict and weird errors to have any jar file in
both tomcat's lib folder and a webapp's lib folder.  Remove the
postgresql driver jar in App1 and it will still work because it'll start
using the one in tomcat's lib folder.

The error you are getting *typically* is the result of a mismatch of
jndi names between all the different places it's entered, but not
always.  It's also frequently caused by <Context ... ></Context> xml
fragments in server.xml or tomcat's conf/[Engine name]/[Host name]
(typically conf/Catalina/localhost) overriding the one in your webapp's
META-INF/context.xml file.

One last thought while I'm typing here ... take a look at your logs
around the time tomcat starts to see if there's anything in there that
might be related.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
I have other application installed that do the direct JDBC connection. 

To simplify it, I have two applications in the Tomcat. 
	App1: Use the direct JDBC connection. 
	App2: Use the JNDI. 

Therefore App1 has the postgreSQL in its lib folder. 

Is it the issue that App2 fails to get the JNDI-JDBC connection from
Tomcat?

Stanley 

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Tuesday, March 03, 2009 1:55 PM
To: Tomcat Users List
Subject: Re: FW: Cannot create JDBC driver of class '' for connect URL
'null'

Stanley Wong wrote:
> My typo. The layout should look like this:
>
> |[tomcat home]
> |    - conf
> |        - server.xml
> |    - webapps
> |        - someApp (case IS important!)
> |            - META-INF
> |                - context.xml
> |            - (various jsps/static files)
> |            - WEB-INF
> |                - web.xml
> |                - lib
> |                    - (the postgres driver is HERE)
> |    - lib
> |        - postgres driver
> |    - common
> |        - lib
> |            - postgres driver
>
>   
Just to emphasize what Chuck is trying to say, tomcat's lib directory
and your webapp's lib directory are mutually exclusive.  If a jar exists
in one, it cannot exist in the other.  In your case, the postgresql
driver should ONLY be in tomcat's lib directory and in no other tomcat
directories, including other webapps this tomcat installation might be
hosting.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by David Smith <dn...@cornell.edu>.
Stanley Wong wrote:
> My typo. The layout should look like this:
>
> |[tomcat home]
> |    - conf
> |        - server.xml
> |    - webapps
> |        - someApp (case IS important!)
> |            - META-INF
> |                - context.xml
> |            - (various jsps/static files)
> |            - WEB-INF
> |                - web.xml
> |                - lib
> |                    - (the postgres driver is HERE)
> |    - lib
> |        - postgres driver
> |    - common
> |        - lib
> |            - postgres driver
>
>   
Just to emphasize what Chuck is trying to say, tomcat's lib directory
and your webapp's lib directory are mutually exclusive.  If a jar exists
in one, it cannot exist in the other.  In your case, the postgresql
driver should ONLY be in tomcat's lib directory and in no other tomcat
directories, including other webapps this tomcat installation might be
hosting.

--David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: FW: Cannot create JDBC driver of class '' for connect URL 'null'

Posted by Stanley Wong <wo...@pcigeomatics.com>.
My typo. The layout should look like this:

|[tomcat home]
|    - conf
|        - server.xml
|    - webapps
|        - someApp (case IS important!)
|            - META-INF
|                - context.xml
|            - (various jsps/static files)
|            - WEB-INF
|                - web.xml
|                - lib
|                    - (the postgres driver is HERE)
|    - lib
|        - postgres driver
|    - common
|        - lib
|            - postgres driver

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Tuesday, March 03, 2009 1:33 PM
To: Tomcat Users List
Subject: RE: FW: Cannot create JDBC driver of class '' for connect URL
'null'

> From: Stanley Wong [mailto:wong@pcigeomatics.com]
> Subject: RE: FW: Cannot create JDBC driver of class '' for
> connect URL 'null'
>
> The layout looked like this, except I did place the
> postgres driver in the lib directory. In additions,
> I place the postgre driver in both [tomcat home]/lib
> and [tomcat home]/lib/common

Don't ever do that.  If you're using Tomcat's connection pooling, JDBC
driver jars should be placed in [tomcat_home]/lib ONLY.  Remove it from
all the other places you erroneously put it.

> |    - lib
> |        - common

Unless you've done some serious reconfiguration of Tomcat (and you
shouldn't), there's no such directory as lib/common.

 - 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org