You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ia...@dsl.pipex.com on 2007/08/16 14:18:03 UTC

JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three applications that are deployed from this 
server, two of which work fine with tomcat 5.5.12, however the third which uses an oracle 9i database gives me the 
following error "javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null' ". 
Basically I've included the same details form the Tomcat4 server.xml file into the tomcat 5.5 server.xml, rediting 
where necessary.

Things I have tried..

Placing the context into fragment files located either inside the applications META-INF folder or under 
tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as Tomcat could not find the apps, so I've 
left the context back in server.xml.
Rewriting the Resource params <parameter> as elements i.e.factory="com.ora.jsp.sql.DataSourceFactory"
Checked changed location of the JDBC jar file. classes12.jar catalina_home\common\lib\ AND 
catalina_home\webapps\[appname]\WEB-INF\lib
Checked changed the server.xml service-name and engine name to match previous TC4 server.xml version.
Added a Resourcelink element to the context - this is not present on the TC4 version
Checked Tomcat logs.

I think that Tomcat is not able to read the <ResourceParams> element, which is why the URL and driverClass are 
NULL. 

Which When I checked the Tomcat log files shows ...

16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
SEVERE: action: Cannot create JDBC driver of class '' for connect URL 'null'

Background info 
Using Apache 2.0 with mod_JK to serve pages on port 80
Java version 1.5

**** server.xml ****

<!-- Tomcat 5.5 Example Server Configuration File -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
 
  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>


    <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" ></Resource>

        
  </GlobalNamingResources>


  <Service name="Catalina">
   
    <Connector port="8009" 
               enableLookups="true" redirectPort="8443" protocol="AJP/1.3" />

    <Engine name="Catalina" defaultHost="opp-online" debug="0">

      
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
                         
          
      <Host name="opportunities-online" debug="0" appBase="webapps" >
      

        <Context path="/staff" docBase="oponline/staff" cookies="true" reloadable="true">
          <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="staff_access_log." suffix=".txt"
                 pattern="combined" resolveHosts="false"/>
                                 
          <Logger className="org.apache.catalina.logger.FileLogger" prefix="oponline_log." suffix=".txt" 
timestamp="true"/> 
          
           <ResourceParams name="jdbc/oponline"
                     factory="com.ora.jsp.sql.DataSourceFactory"
                         user="myuser"
                         password="mypassword"
                         dataSourceClassName="oracle.jdbc.pool.OracleConnectionCacheImpl"
                         URL="jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
                         maxLimit="5" />
                  
             <!-- global resource for application's context. -->
             <!-- <ResourceLink name="/jdbc/oponline" global="/jdbc/oponline"
                        type="org.apache.catalina.UserDatabase"/> -->
                                    
        </Context>
        
      </Host>

    </Engine>

  </Service>

</Server>

*** end server.xml ***


*** App web.xml except ***

 <resource-ref>
    <description>
      JNDI DataSource for [appname] database.
      (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
    </description>
    <res-ref-name>jdbc/oponline</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

*** end web.xml ***


Thanks

Ian

-- 

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
much better, thank you!  I think I'm gonna have to put aside some time 
to brush up on tomcat 5.5/6 jndi datasourcing as I'm obviously out of date.

cheers!

David Smith wrote:
> I see.  Some of the tomcat docs are probably out of date, depending on 
> someone pointing out the flaw or contributing updates.
>
> Tomcat uses reflection to configure the pool using bean setter 
> methods.  That makes the full set of attributes dependant on the 
> implementation used -- in this case DBCP.  If you'd like the full set 
> of database pool parameters available in the default tomcat db pool, 
> just take a look at:
>
> http://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/BasicDataSource.html 
>
>
> --David
-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by David Smith <dn...@cornell.edu>.
I see.  Some of the tomcat docs are probably out of date, depending on 
someone pointing out the flaw or contributing updates.

Tomcat uses reflection to configure the pool using bean setter methods.  
That makes the full set of attributes dependant on the implementation 
used -- in this case DBCP.  If you'd like the full set of database pool 
parameters available in the default tomcat db pool, just take a look at:

http://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/BasicDataSource.html

--David

Matthew Kerle wrote:

> no I didn't...:-(
>
> I was going off the globalresources config reference page, wher it 
> lists the attributes of a <Resource> element as being:
>
> **snip**
> The valid attriutes for a <Resource> element are as follows:
>
> Attribute   Description
> auth  
> Specify whether the web Application code signs on to the corresponding 
> resource manager programatically, or whether the Container will sign 
> on to the resource manager on behalf of the application. The value of 
> this attribute must be Application or Container. This attribute is 
> required if the web application will use a <resource-ref> element in 
> the web application deployment descriptor, but is optional if the 
> application uses a <resource-env-ref> instead.
> description
>
> Optional, human-readable description of this resource.
> name  
> The name of the resource to be created, relative to the java:comp/env 
> context.
> scope 
> Specify whether connections obtained through this resource manager can 
> be shared. The value of this attribute must be Shareable or 
> Unshareable. By default, connections are assumed to be shareable.
> type  
> The fully qualified Java class name expected by the web application 
> when it performs a lookup for this resource.
> **snip**
>
> ...and I took this to mean that these were the only valid attributes, 
> as the provided example only references these attributes. I guess then 
> you can add the username/password/driverClass/url attributes and 
> they'll be picked up fine? If that's they case then my mistake, but 
> the doco isn't very clear on that...
>
> ps - apologies if the above table has disintegrated getting converted 
> to plain-text...
>
> David Smith wrote:
>
>> As far as I'm aware, there is no difference between a <Resource 
>> ..../> element in context.xml and a <Resource ..../> element in a 
>> <GlobalNamingResources>...</GlobalNamingResources> block.  Well... 
>> other than the need to use a <ResourceLink .../> to make it available 
>> to an individual webapp.  Did you try it and get a failure?
>>
>> --David
>>
>>
>> Matthew Kerle wrote:
>>
>>> now that sounds good! the only thing is I don't see how that maps to 
>>> a DataSource declaration, the <Resource> element in 
>>> <GlobalNamingResources> doesn't seem to allow the full range of 
>>> properties that you need to define a database connection, eg - 
>>> username/password/driverClassName/url etc...
>>>
>>> Where would you define these?
>>>
>>> David Smith wrote:
>>>
>>>> In my experience, a resource is usually only relevant to one 
>>>> webapp.  There's no need to put it in server.xml as a 
>>>> GlobalNamingResource unless you want that resource available in all 
>>>> your webapps.  Moving the resource to the <Context> block of a 
>>>> context.xml file also makes it so resources can come and go with 
>>>> deployment of an individual webapp without restarting tomcat and 
>>>> disrupting all the webapps.
>>>>
>>>> Developers could define their Resources in the 
>>>> <GlobalNamingResources> ... </GlobalNamingResources> block of 
>>>> server.xml and then add a <ResourceLink> element to the context.xml 
>>>> file.  That'll get you out of having database specific information 
>>>> in the <Context ..../> element.  See this page for further details 
>>>> on that:
>>>>
>>>> http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
>>>>
>>>> --David
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
no I didn't...:-(

I was going off the globalresources config reference page, wher it lists 
the attributes of a <Resource> element as being:

**snip**
The valid attriutes for a <Resource> element are as follows:

Attribute   Description
auth   

Specify whether the web Application code signs on to the corresponding 
resource manager programatically, or whether the Container will sign on 
to the resource manager on behalf of the application. The value of this 
attribute must be Application or Container. This attribute is required 
if the web application will use a <resource-ref> element in the web 
application deployment descriptor, but is optional if the application 
uses a <resource-env-ref> instead.
description

Optional, human-readable description of this resource.
name   

The name of the resource to be created, relative to the java:comp/env 
context.
scope  

Specify whether connections obtained through this resource manager can 
be shared. The value of this attribute must be Shareable or Unshareable. 
By default, connections are assumed to be shareable.
type   

The fully qualified Java class name expected by the web application when 
it performs a lookup for this resource.
**snip**

...and I took this to mean that these were the only valid attributes, as 
the provided example only references these attributes. I guess then you 
can add the username/password/driverClass/url attributes and they'll be 
picked up fine? If that's they case then my mistake, but the doco isn't 
very clear on that...

ps - apologies if the above table has disintegrated getting converted to 
plain-text...

David Smith wrote:
> As far as I'm aware, there is no difference between a <Resource ..../> 
> element in context.xml and a <Resource ..../> element in a 
> <GlobalNamingResources>...</GlobalNamingResources> block.  Well... 
> other than the need to use a <ResourceLink .../> to make it available 
> to an individual webapp.  Did you try it and get a failure?
>
> --David
>
>
> Matthew Kerle wrote:
>
>> now that sounds good! the only thing is I don't see how that maps to 
>> a DataSource declaration, the <Resource> element in 
>> <GlobalNamingResources> doesn't seem to allow the full range of 
>> properties that you need to define a database connection, eg - 
>> username/password/driverClassName/url etc...
>>
>> Where would you define these?
>>
>> David Smith wrote:
>>
>>> In my experience, a resource is usually only relevant to one 
>>> webapp.  There's no need to put it in server.xml as a 
>>> GlobalNamingResource unless you want that resource available in all 
>>> your webapps.  Moving the resource to the <Context> block of a 
>>> context.xml file also makes it so resources can come and go with 
>>> deployment of an individual webapp without restarting tomcat and 
>>> disrupting all the webapps.
>>>
>>> Developers could define their Resources in the 
>>> <GlobalNamingResources> ... </GlobalNamingResources> block of 
>>> server.xml and then add a <ResourceLink> element to the context.xml 
>>> file.  That'll get you out of having database specific information 
>>> in the <Context ..../> element.  See this page for further details 
>>> on that:
>>>
>>> http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
>>>
>>> --David
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by David Smith <dn...@cornell.edu>.
As far as I'm aware, there is no difference between a <Resource ..../> 
element in context.xml and a <Resource ..../> element in a 
<GlobalNamingResources>...</GlobalNamingResources> block.  Well... other 
than the need to use a <ResourceLink .../> to make it available to an 
individual webapp.  Did you try it and get a failure?

--David


Matthew Kerle wrote:

> now that sounds good! the only thing is I don't see how that maps to a 
> DataSource declaration, the <Resource> element in 
> <GlobalNamingResources> doesn't seem to allow the full range of 
> properties that you need to define a database connection, eg - 
> username/password/driverClassName/url etc...
>
> Where would you define these?
>
> David Smith wrote:
>
>> In my experience, a resource is usually only relevant to one webapp.  
>> There's no need to put it in server.xml as a GlobalNamingResource 
>> unless you want that resource available in all your webapps.  Moving 
>> the resource to the <Context> block of a context.xml file also makes 
>> it so resources can come and go with deployment of an individual 
>> webapp without restarting tomcat and disrupting all the webapps.
>>
>> Developers could define their Resources in the 
>> <GlobalNamingResources> ... </GlobalNamingResources> block of 
>> server.xml and then add a <ResourceLink> element to the context.xml 
>> file.  That'll get you out of having database specific information in 
>> the <Context ..../> element.  See this page for further details on that:
>>
>> http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
>>
>> --David
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
now that sounds good! the only thing is I don't see how that maps to a 
DataSource declaration, the <Resource> element in 
<GlobalNamingResources> doesn't seem to allow the full range of 
properties that you need to define a database connection, eg - 
username/password/driverClassName/url etc...

Where would you define these?

David Smith wrote:
> In my experience, a resource is usually only relevant to one webapp.  
> There's no need to put it in server.xml as a GlobalNamingResource 
> unless you want that resource available in all your webapps.  Moving 
> the resource to the <Context> block of a context.xml file also makes 
> it so resources can come and go with deployment of an individual 
> webapp without restarting tomcat and disrupting all the webapps.
>
> Developers could define their Resources in the <GlobalNamingResources> 
> ... </GlobalNamingResources> block of server.xml and then add a 
> <ResourceLink> element to the context.xml file.  That'll get you out 
> of having database specific information in the <Context ..../> 
> element.  See this page for further details on that:
>
> http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
>
> --David



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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by David Smith <dn...@cornell.edu>.
In my experience, a resource is usually only relevant to one webapp.  
There's no need to put it in server.xml as a GlobalNamingResource unless 
you want that resource available in all your webapps.  Moving the 
resource to the <Context> block of a context.xml file also makes it so 
resources can come and go with deployment of an individual webapp 
without restarting tomcat and disrupting all the webapps.

Developers could define their Resources in the <GlobalNamingResources> 
... </GlobalNamingResources> block of server.xml and then add a 
<ResourceLink> element to the context.xml file.  That'll get you out of 
having database specific information in the <Context ..../> element.  
See this page for further details on that:

http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html

--David

Matthew Kerle wrote:

> Hi David
>
> David Smith wrote:
>
>> My only editorial comment on the page is to NOT place your 
>> <Resource.../> or <Context .../> definition in server.xml as 
>> recommended on the page.  Place it in context.xml or myapp.xml as I 
>> describe above.
>
>
> Just quickly, I was wondering why you recommend this? I know the 
> tomcat docs have changed to reflect the deprecation of defining the 
> <Resource.../> or <Context .../> definition in server.xml, but I never 
> understood why, and personally doing things that way is a serious pain 
> for me since it means I need to build a separate deployment descriptor 
> for dev, test & prod, which means I need to know the prod database 
> details. which I don't want.
>
> Is there a better way that the sysadmin can setup a JNDI datasource so 
> that deployed war's don't have to contain database-specific details? 
> the only way I've seen so far is to configure that in the server.xml...
>
> cheers!
>


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by ia...@dsl.pipex.com.
Thanks for all your advice,

Problem sorted now.

I moved the ojdbc14.jar into common/lib only, and set-up a context in the appname/META-INF/contex.xml. Tomcat still 
wouldn't start after renaming ResourceParams to Resource even after I had validated the xml with an xml validator 
tool. In the end I stripped out the context.xml file and retyped everything rather than copy and paste the context 
from server.xml. And it now works, I'm guesing the last step was that there was something up / hidden with the file 
type encoding utf-8.

Thanks

Ian


Hi Ian.

ojdbc14.jar needs to ONLY be in common/lib.  It won't work in 
myapp/WEB-INF/lib and won't work if you have the jar in both places.

Additionally you should take a look at the JDBC howto docs regarding 
what your <Resource...> config in your myapp/META-INF/context.xml or 
conf/Catalina/localhost/myapp.xml should look like:

http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Oracle%208i%20with%20OCI%20client

My only editorial comment on the page is to NOT place your 
<Resource.../> or <Context .../> definition in server.xml as recommended 
on the page.  Place it in context.xml or myapp.xml as I describe above.

--David

ian.blenk@dsl.pipex.com wrote:

>Thanks for your advice so far
>
>I've upgraded to the latest Oracle ojdbc14.jar and placed it the myapp\WEB-INF\lib folder, I also tried it the 
>Tomcat\common\lib for for good measure but still got the same results. I'll continue to use ojdbc14.jar from now 
>though.
>
>I've change the ResourceParams name to just Resource name but this causes Tomcat not to startup, the logs show the 
>following trace...
>
>*** Excerpt Tomcat 5.5.12 logs ***
>16-Aug-2007 16:08:32 org.apache.tomcat.util.digester.Digester endElement
>SEVERE: End event threw exception
>java.lang.reflect.InvocationTargetException
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>*** end ***
>
>Does this mean it's now reading the <context> <Resource> element. ?
>
>Thanks
>
>Ian

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

Matthew Kerle wrote:
> after my post I had a read through the jboss docs, and
> apparently it uses embedded tomcat internally as a web container, then
> the jboss code does all the extra j2ee app server goodness.

To be more precise, Tomcat provides the servlet container while JBoss
provides the EJB container and some other services. They are both part
of the J2EE specification, and can both reasonably be called application
servers.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGxupz9CaO5/Lv0PARAjY+AJ9Kei7pTzjFQ7HQeQPPd9S5XlBTZgCXTWnK
yQoFLyZ0ZsE14SE6ON8wcw==
=v+u+
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi chris

Christopher Schultz wrote:
> IIRC, JBoss used to use Tomcat as its servlet container. Maybe that's no
> longer the case.
>   
it still is. after my post I had a read through the jboss docs, and 
apparently it uses embedded tomcat internally as a web container, then 
the jboss code does all the extra j2ee app server goodness.
http://docs.jboss.org/jbossas/getting_started/v4/html/tour.html#d0e627
>> But I'm a
>> big believer in FOSS & the community, so I'd love the chance to
>> contribute something to the tomcat docs, especially if it makes life
>> easier for other hackers like me...
>>     
>
> JBoss counts as FOSS, right?
>   
yup! not criticising jboss at all, and <disclaimer>I haven't used it yet 
</disclaimer>, but if it already uses tomcat internally and if you're 
just doing a simple java web app with no ejb etc, then *my opinion* is 
that tomcat is pretty much the go. Jetty or glassfish may sway me later, 
but not for a while...
>> thanks! that's just the pointer I need. Question but, if the war is
>> outside the auto-deploy'ing webapps dir, then how do you auto-deploy new
>> wars?
>>     
>
> You can't. That's one of the prices you pay for playing outside the
> rules. I don't believe you can, for instance, use the manager app to
> deploy a WAR along with a separate context.xml file.
>   
hmm, ok let's agree to disagree on this point.
> You have to do it entirely yourself. You'll have to check, but it's
> possible that Tomcat won't even do auto-redeploy if you update the WAR.
> There's been a long thread about the (separate) context.xml file being
> deleted during auto-deploy of outside WAR files (if I understand the
> thread, which I'm not really following). You might want to read through
> that for more information.
>   
yes, we got bitten by this. we were pretty stumped until we realised 
that tomcat auto-deletes context.xml on undeploy. bit of a gotcha that 
one...
>   
>> have you ever used OC4J?
>>     
>
> Nope. I've been off Oracle since they stopped shipping the JDBC driver
> as a ZIP file ;)
>   
that's a bad thing? I was relieved when they changed to a .jar! (around 
9ir2 i think they did that..?)
> - -chris
>   

ps - nice web site, bet you're glad the kitchens done!

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

Matthew Kerle wrote:
> I'm changing jobs soon and the new company uses JBoss (:-<), so
> it may take a while to convince them how good tomcat is ;-p!

IIRC, JBoss used to use Tomcat as its servlet container. Maybe that's no
longer the case.

> But I'm a
> big believer in FOSS & the community, so I'd love the chance to
> contribute something to the tomcat docs, especially if it makes life
> easier for other hackers like me...

JBoss counts as FOSS, right?

> thanks! that's just the pointer I need. Question but, if the war is
> outside the auto-deploy'ing webapps dir, then how do you auto-deploy new
> wars?

You can't. That's one of the prices you pay for playing outside the
rules. I don't believe you can, for instance, use the manager app to
deploy a WAR along with a separate context.xml file.

> do you have to use the manager app, or the command-line interface?

You have to do it entirely yourself. You'll have to check, but it's
possible that Tomcat won't even do auto-redeploy if you update the WAR.
There's been a long thread about the (separate) context.xml file being
deleted during auto-deploy of outside WAR files (if I understand the
thread, which I'm not really following). You might want to read through
that for more information.

> have you ever used OC4J?

Nope. I've been off Oracle since they stopped shipping the JDBC driver
as a ZIP file ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxbFO9CaO5/Lv0PARAvBWAJ9Gw9wL/mH7ClHJdoO1Iz1MTfkFqwCfQm5Y
AChHAHzvEH/u+7DOF6G0FDI=
=p6HC
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi Chris

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Matt,
> I agree the documentation is terse and/or missing. If you implement any
> of these strategies, consider submitting an update to the documentation
> to help others in the future.
>   
will do. I'm changing jobs soon and the new company uses JBoss (:-<), so 
it may take a while to convince them how good tomcat is ;-p! But I'm a 
big believer in FOSS & the community, so I'd love the chance to 
contribute something to the tomcat docs, especially if it makes life 
easier for other hackers like me...
> It's easy to deploy using a context.xml file that is /not/ inside a WAR
> file:
>
> Start with the context.xml file that you would have put into your WAR
> file. Add the "docBase" element to the <Context> element to configure
> the location of the WAR file. Put your WAR file somewhere outside of the
> auto-deploying webapps directory. Put the context.xml file into
> $CATALINA_HOME/conf/[enginename]/[hostname]/[appname].xml.
>   
thanks! that's just the pointer I need. Question but, if the war is 
outside the auto-deploy'ing webapps dir, then how do you auto-deploy new 
wars? do you have to use the manager app, or the command-line interface? 
that's ok, but it'd be a shame to lose the nicety of just dropping in a 
war and it auto-deploying...
>> How do you go about submitting an update
>> to the documentation? I assume there's a short list of committers...
>>     
>
> You can certainly post to this list. Several (of not all) Tomcat devs
> lurk on this list. Just mark your post clearly and see what happens.
>   
will do.
>> every time we deployed a war without a context .xml tomcat would delete
>> the existing one, or overwrite it.
>>     
>
> You mean the context.xml file, not the WAR, right? When you step outside
> of the standard (read: recommended) configurations, then you will have
> to fight Tomcat to get things working properly. That's just the price
> you pay: your deployment will be complicated if you want to do things
> differently.
>   
yes, the context.xml. it was very frustrating! Mainly because at the 
time we didn't have a very good idea of tomcat deployment details. the 
docbase method you mentioned sounds much better.

have you ever used OC4J? Anything before 10g was hopeless, but I do like 
the way it handles defining data-sources, there's a dedicacted 
data-sources.xml file for the server where you configure jndi 
data-sources. very simple and user-friendly.

thanks for your help Chris!

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

Matthew Kerle wrote:
> the doco is a bit... terse on the subject of setting up a JNDI
> datasource outside the war file, and it's not as straightforward or easy
> to find as compared to the method for placing the context.xml inside the
> deployment war, which is well documented.

I agree the documentation is terse and/or missing. If you implement any
of these strategies, consider submitting an update to the documentation
to help others in the future.

It's easy to deploy using a context.xml file that is /not/ inside a WAR
file:

Start with the context.xml file that you would have put into your WAR
file. Add the "docBase" element to the <Context> element to configure
the location of the WAR file. Put your WAR file somewhere outside of the
auto-deploying webapps directory. Put the context.xml file into
$CATALINA_HOME/conf/[enginename]/[hostname]/[appname].xml.

> How do you go about submitting an update
> to the documentation? I assume there's a short list of committers...

You can certainly post to this list. Several (of not all) Tomcat devs
lurk on this list. Just mark your post clearly and see what happens.

> every time we deployed a war without a context .xml tomcat would delete
> the existing one, or overwrite it.

You mean the context.xml file, not the WAR, right? When you step outside
of the standard (read: recommended) configurations, then you will have
to fight Tomcat to get things working properly. That's just the price
you pay: your deployment will be complicated if you want to do things
differently.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxK6b9CaO5/Lv0PARAvLxAKCz5TsLIFE+yNgwRcqJSP2h0i2TcgCgh1c/
T35dIRLVMDSMAkR7Jyc30ak=
=VEsi
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi Chris

I apologise for coming across a bit harsh there, don't mean to offend! 
I'll take it a bit easier...;-p

Either of the methods you recommended looks good, the only trouble is 
that the doco is a bit... terse on the subject of setting up a JNDI 
datasource outside the war file, and it's not as straightforward or easy 
to find as compared to the method for placing the context.xml inside the 
deployment war, which is well documented.

If I can make an observation, if people have been hitting the lists with 
this issue since the release of 5.5, then maybe the doco needs updating? 
a simple full code example on the JNDI resources howto page on both the 
ways you listed would probably kill most of those questions, and make 
life easier for the rest of us! How do you go about submitting an update 
to the documentation? I assume there's a short list of committers...

To be honest I hadn't looked deeply into the jndi setup since 5.0, when 
we moved to 5.5 I tried to get the external-context.xml working, but 
everytime we deployed a war without a context .xml tomcat would delete 
the existing one, or overwrite it. the project didn't have the scope to 
get a good solution and I wasn't in charge of building deploys so it 
never happened. I'll try and dig through the archives to find a good 
example of that which works so we can update our procedure.

cheers!

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Matt,
>
> Matthew Kerle wrote:
>   
>> Most of the sysadmin's I've worked with really don't like the idea of
>> having to rip open a war and update some weird config file just to do a
>> deploy. the alternative is I know all the passwords and build a war for
>> each target, which is a crap solution.
>>     
>
> They're all crap solutions when nobody wants to do their job. Either the
> deployment folks have to do some work (horrors!) or the developers have
> to (oh, no!). The solution you're looking for is simply not recommended
> by this crowd.
>
> You CAN do this:
>
> 1. Set up a GlobalNamingResource and ResourceParams in your server.xml
>    file.
>    http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
> 2. Use a <ResourceLink> in your <Context> in your META-INF/context.xml
>    file.
>
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html#Resource%20Links
>
> Another option is to have a context.xml file /outside/ of the WAR file.
> This requires alternate configuration -- details can be found in the
> archives for just about every week since the release of TC 5.5 ('cause
> someone always asks before searching).
>
>   
>> We should just be able to configure a datasource for a particular
>> context in the target instance, and then forever after all deployments
>> are database transparent. Am i missing something?
>>     
>
> The only thing you're missing is that this is no longer recommended
> procedure, which is why everyone is telling you to do it differently.
> Feel free to do it your own way, but don't complain when we tell you
> it's not a recommended / supported configuration. Sure, Tomcat will do
> it, but if you're having problems, your free tech-support provided by
> this forum might just refuse to help.
>
>   
>> I can't understand why it would be better to target a war file for a
>> database, than have the configuration live in the instance and the war
>> file is database-agnostic. makes change migration a *lot* easier.
>>     
>
> See the option above about using an outside-the-WAR file context.xml
> configuration file.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGxIYt9CaO5/Lv0PARArMNAKCZ/YLaoqADeT3OWZRkFdj0ycku0gCfc/bj
> M8Tiwu8RsSsOK0b+i9PLjaE=
> =x7NG
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/16/07, Christopher Schultz <ch...@christopherschultz.net> wrote:

> They're all crap solutions when nobody wants to do their job.

heh -- indeed.

And how about we add the "it depends" corollary -- they're all
crap solutions for /some/ specific environment(s)  :-)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

Matthew Kerle wrote:
> Most of the sysadmin's I've worked with really don't like the idea of
> having to rip open a war and update some weird config file just to do a
> deploy. the alternative is I know all the passwords and build a war for
> each target, which is a crap solution.

They're all crap solutions when nobody wants to do their job. Either the
deployment folks have to do some work (horrors!) or the developers have
to (oh, no!). The solution you're looking for is simply not recommended
by this crowd.

You CAN do this:

1. Set up a GlobalNamingResource and ResourceParams in your server.xml
   file.
   http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html
2. Use a <ResourceLink> in your <Context> in your META-INF/context.xml
   file.

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html#Resource%20Links

Another option is to have a context.xml file /outside/ of the WAR file.
This requires alternate configuration -- details can be found in the
archives for just about every week since the release of TC 5.5 ('cause
someone always asks before searching).

> We should just be able to configure a datasource for a particular
> context in the target instance, and then forever after all deployments
> are database transparent. Am i missing something?

The only thing you're missing is that this is no longer recommended
procedure, which is why everyone is telling you to do it differently.
Feel free to do it your own way, but don't complain when we tell you
it's not a recommended / supported configuration. Sure, Tomcat will do
it, but if you're having problems, your free tech-support provided by
this forum might just refuse to help.

> I can't understand why it would be better to target a war file for a
> database, than have the configuration live in the instance and the war
> file is database-agnostic. makes change migration a *lot* easier.

See the option above about using an outside-the-WAR file context.xml
configuration file.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxIYt9CaO5/Lv0PARArMNAKCZ/YLaoqADeT3OWZRkFdj0ycku0gCfc/bj
M8Tiwu8RsSsOK0b+i9PLjaE=
=x7NG
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi Chris

my experience has been: one tomcat instance per dev/test/prod, & the 
webapp on each instance always points to the same database (dev 
tomcat->dev db, test tomcat -> test db etc), so the database connection 
on a /single/ instance never changes. However when promoting code from 
dev to test to prod, you want to use the one war file and not have to 
fiddle around in it's guts to promote a change, otherwise there's the 
chance of error's creeping in. (prod app pointing to dev/test anyone?)

Most of the sysadmin's I've worked with really don't like the idea of 
having to rip open a war and update some weird config file just to do a 
deploy. the alternative is I know all the passwords and build a war for 
each target, which is a crap solution.

We should just be able to configure a datasource for a particular 
context in the target instance, and then forever after all deployments 
are database transparent. Am i missing something?

I can't understand why it would be better to target a war file for a 
database, than have the configuration live in the instance and the war 
file is database-agnostic. makes change migration a *lot* easier.

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Matt,
>
> Matthew Kerle wrote:
>   
>> I never
>> understood why, and personally doing things that way is a serious pain
>> for me since it means I need to build a separate deployment descriptor
>> for dev, test & prod, which means I need to know the prod database
>> details. which I don't want.
>>     
>
> Actually, this is the whole point: the deployment descriptor is
> different for each environment, which makes a whole lot of sense to /me/.
>
>   
>> Is there a better way that the sysadmin can setup a JNDI datasource so
>> that deployed war's don't have to contain database-specific details? the
>> only way I've seen so far is to configure that in the server.xml...
>>     
>
> Why not have your sysadmin manage the deployment descriptor for your
> production deployments?
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGxHbA9CaO5/Lv0PARAn+IAJ9DjuZ9rrVu3lO3XLqMs3zM3WQl/gCfaH01
> F2rQxahMVwj+77VYSekqQWM=
> =X32x
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

Matthew Kerle wrote:
> I never
> understood why, and personally doing things that way is a serious pain
> for me since it means I need to build a separate deployment descriptor
> for dev, test & prod, which means I need to know the prod database
> details. which I don't want.

Actually, this is the whole point: the deployment descriptor is
different for each environment, which makes a whole lot of sense to /me/.

> Is there a better way that the sysadmin can setup a JNDI datasource so
> that deployed war's don't have to contain database-specific details? the
> only way I've seen so far is to configure that in the server.xml...

Why not have your sysadmin manage the deployment descriptor for your
production deployments?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxHbA9CaO5/Lv0PARAn+IAJ9DjuZ9rrVu3lO3XLqMs3zM3WQl/gCfaH01
F2rQxahMVwj+77VYSekqQWM=
=X32x
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi Chris

It seems like you guys have a pretty good setup going, better than the 
one at my (current) company anyway. I didn't realise that your 
environment doesn't have dependencies on statically linked war files 
like ours does. The developer makes a release and creates the three wars 
for deployment at the same time, which then have to be kept in synch. I 
have a lot of issues with this process as it's very error-prone, and I 
think some of my attitude towards this process crept into my previous 
emails, which wasn't appropriate. my bad.

Unfortunately not all of us are lucky enough for the prod server to have 
access to the version control repository...;-p

Also, our situation is a bit different where we consult to the client, 
our two networks are totally separated so there's no way that we can do 
fresh builds from version control (Subversion rocks!) to deployement 
targets directly. We need to build the wars in our office, then submit 
them to the client for testing and promotion. We have very little 
control over the promotion process, and more than once we've had serious 
bugs resulting from the wrong war going into the wrong target due to a 
mistake by the clients sysadmin. Thus my attitude towards configuration 
being external to the app as much as possible, I like to build a 
stand-alone war that gets as much of  their info as possible from the 
container/database.


responses inline.

Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Matt,
>
> I disagree with many of your assertions.
>   
well put.
> I'm guessing that you don't deploy all 3 WARs onto the same machine.
> What's the difference between 3 different WARs and 1 WAR in 3 places?
> Don't complain about disk space when the argument is 1) flawed (disk
> space doesn't matter) and 2) moot (deployments to different servers).
>   
fair point, HD space isn't an issue. it's the process used to deploy the 
war to the server, and ensuring that the same  release is delivered 
consistently across all targets. so long as the code can be deployed 
consistely & transparent of the target that's the main thing as I see it.
> I completely disagree. We have complex configurations that need to
> change for each environment (many properties files, etc.). Trying to
> create one properties file to rule them all is impossible, and shoving
> all that configuration into a (static) deployment descriptor on the
> target server is kludgy and error prone, since the developers don't have
> control over the server configuration.
>   
sorry, I should have been more specific, I was just referring to 
database targeting, not the complete environment. there's a lot of 
things that ant <replace> is excellent for.
> We don't deliver a WAR file to our deployment team; we give them a cvs
> tag to use as the new version. It's as simple as:
>
> $ pushd
> $ cd $APP
> $ ant tomcat-stop
> $ ant install-clean
> $ popd
> $ rm -rf $APP
> $ cvs checkout -r ${RELEASE_TAG} ${APP}
> $ cd ${APP}
> $ ant install
> $ ant tomcat-start
>
> You may find that complicated, but it's all that's required for us to
> deploy our applications into ANY environment. 
nice. fresh checkout from cvs tag straight into deployment. is good!
> Wanna upgrade Tomcat? No
> problem:
>
> # cd /where/you/want/tomcat/to/live
> # tar xzf apache-tomcat-version.tar.gz
> # (fix 'tomcat' symlink)
> # (restart apps at your convenience)
>
> No effing around with Tomcat server configuration. In fact, deploying
> our production applications doesn't require root access, so out
> deployment team can't really break anything.
>   
nice.
> - -chris

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt,

I disagree with many of your assertions.

Matthew Kerle wrote:
> it's doable, some of my teammates use that method, but it's a pain in
> the butt because you basically have to create 3 WARs per release (one
> for each target). considering a struts/hibernate/spring/xFire
> application is about 30mb in 3rd party jars, that's a lot of space. ok
> HD space is cheap, but it's still no excuse for poor procedure.

I'm guessing that you don't deploy all 3 WARs onto the same machine.
What's the difference between 3 different WARs and 1 WAR in 3 places?
Don't complain about disk space when the argument is 1) flawed (disk
space doesn't matter) and 2) moot (deployments to different servers).

> To do it you would basically create different build targets in your ant
> script, with each one using custom props from your build.props file, eg
> - so you would have targets dev/test/prod/all, running all would build
> wars for dev, test & prod. you use a <replace> tag to replace a
> pre-formatted pattern like ##db_user##, ##db_pwd## etc in your
> deployment descriptor with the target details. it's a crappy hack for
> bad programmers.

I completely disagree. We have complex configurations that need to
change for each environment (many properties files, etc.). Trying to
create one properties file to rule them all is impossible, and shoving
all that configuration into a (static) deployment descriptor on the
target server is kludgy and error prone, since the developers don't have
control over the server configuration.

Your choices are to have separate file sets for each environment or to
do this search-and-replace trick. I favor both, because some
configuration is best done by the programmers (properties files
including file locations, URLs, etc.) and other stuff (data source
names, passwords, etc.) are better done by server admins.

We don't deliver a WAR file to our deployment team; we give them a cvs
tag to use as the new version. It's as simple as:

$ pushd
$ cd $APP
$ ant tomcat-stop
$ ant install-clean
$ popd
$ rm -rf $APP
$ cvs checkout -r ${RELEASE_TAG} ${APP}
$ cd ${APP}
$ ant install
$ ant tomcat-start

You may find that complicated, but it's all that's required for us to
deploy our applications into ANY environment. Wanna upgrade Tomcat? No
problem:

# cd /where/you/want/tomcat/to/live
# tar xzf apache-tomcat-version.tar.gz
# (fix 'tomcat' symlink)
# (restart apps at your convenience)

No effing around with Tomcat server configuration. In fact, deploying
our production applications doesn't require root access, so out
deployment team can't really break anything.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxIkd9CaO5/Lv0PARAilKAJ93UnlpIeG53wx0iltxo+CrDwFgTQCgg9jj
2w7a/xXTVt0zgI3hKICoL2o=
=lXKw
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
it's doable, some of my teammates use that method, but it's a pain in 
the butt because you basically have to create 3 WARs per release (one 
for each target). considering a struts/hibernate/spring/xFire 
application is about 30mb in 3rd party jars, that's a lot of space. ok 
HD space is cheap, but it's still no excuse for poor procedure.

To do it you would basically create different build targets in your ant 
script, with each one using custom props from your build.props file, eg 
- so you would have targets dev/test/prod/all, running all would build 
wars for dev, test & prod. you use a <replace> tag to replace a 
pre-formatted pattern like ##db_user##, ##db_pwd## etc in your 
deployment descriptor with the target details. it's a crappy hack for 
bad programmers.

Len Popp wrote:
> How do you use a build.properties file to define a JNDI resource? Or
> do you create JDBC connections a different way?
>   

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/16/07, Len Popp <le...@gmail.com> wrote:
> I don't get it. Are you assuming that the programmer would put the
> JDBC server info in a build.properties file that is used at compile
> time? That doesn't work unless the programmer knows all the servers
> the app will eventually be deployed on - which isn't always the case
> for me.

Interesting -- I've never been in a situation where I *didn't*
know all the gory deployment details. :-)

But the question of who *maintains* the build.properties file
is completely orthogonal to the discussion of whether it's an
appropriate methodology, I'd say.

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Len,

Len Popp wrote:
> I don't get it. Are you assuming that the programmer would put the
> JDBC server info in a build.properties file that is used at compile
> time?

Well, you have to get creative. For instance, all our devs (and
deployment folks) have a file, ~/.ant.properties, which gets loaded into
the ant environment before anything else does. That allows a user to
override just about anything for their own instance.

You can put the production creds into this file and simply build the WAR
right there on the target box (or somewhere that has the same setup).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxImW9CaO5/Lv0PARAnIwAKC0EjmE6M2tMzhydDnHAfPgPUh6lgCghatU
U5obR/rb9pA6ZCdro2Z1JdI=
=iPmi
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Len Popp <le...@gmail.com>.
I don't get it. Are you assuming that the programmer would put the
JDBC server info in a build.properties file that is used at compile
time? That doesn't work unless the programmer knows all the servers
the app will eventually be deployed on - which isn't always the case
for me.
-- 
Len

On 8/16/07, Hassan Schroeder <ha...@gmail.com> wrote:
> On 8/16/07, Len Popp <le...@gmail.com> wrote:
> > How do you use a build.properties file to define a JNDI resource? Or
> > do you create JDBC connections a different way?
>
> Not sure I understand the question -- we're talking about putting
> a Resource element in META-INF/context.xml, right? So the details
> of that element can be configured via a properties file, eh?
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/16/07, Len Popp <le...@gmail.com> wrote:
> How do you use a build.properties file to define a JNDI resource? Or
> do you create JDBC connections a different way?

Not sure I understand the question -- we're talking about putting
a Resource element in META-INF/context.xml, right? So the details
of that element can be configured via a properties file, eh?

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Len,

Len Popp wrote:
> How do you use a build.properties file to define a JNDI resource? Or
> do you create JDBC connections a different way?

Search-and-replace, baby. That's how I have my configuration working.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxIZO9CaO5/Lv0PARAhS0AKCjyREf9bOvh8H9hG8Ak3lHRT6LMQCfQfn7
uGUMtdZZ9VXfPG8jhhz4MFw=
=MBaD
-----END PGP SIGNATURE-----

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Len Popp <le...@gmail.com>.
How do you use a build.properties file to define a JNDI resource? Or
do you create JDBC connections a different way?
-- 
Len

On 8/16/07, Hassan Schroeder <ha...@gmail.com> wrote:
> On 8/16/07, Len Popp <le...@gmail.com> wrote:
>
> > You're right that putting server-specific info in context.xml in the
> > .war is no good when the app could be installed on different servers.
>
> Isn't that what build.properties files are for? :-)
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Hassan Schroeder <ha...@gmail.com>.
On 8/16/07, Len Popp <le...@gmail.com> wrote:

> You're right that putting server-specific info in context.xml in the
> .war is no good when the app could be installed on different servers.

Isn't that what build.properties files are for? :-)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Len Popp <le...@gmail.com>.
The reason is that server.xml is for the whole server, so when you
change something you have to restart the whole server rather than just
the one application.

You're right that putting server-specific info in context.xml in the
.war is no good when the app could be installed on different servers.
-- 
Len


On 8/16/07, Matthew Kerle <ma...@sra.com.au> wrote:
> Hi David
>
> David Smith wrote:
> > My only editorial comment on the page is to NOT place your
> > <Resource.../> or <Context .../> definition in server.xml as
> > recommended on the page.  Place it in context.xml or myapp.xml as I
> > describe above.
>
> Just quickly, I was wondering why you recommend this? I know the tomcat
> docs have changed to reflect the deprecation of defining the
> <Resource.../> or <Context .../> definition in server.xml, but I never
> understood why, and personally doing things that way is a serious pain
> for me since it means I need to build a separate deployment descriptor
> for dev, test & prod, which means I need to know the prod database
> details. which I don't want.
>
> Is there a better way that the sysadmin can setup a JNDI datasource so
> that deployed war's don't have to contain database-specific details? the
> only way I've seen so far is to configure that in the server.xml...
>
> cheers!
>
> --
> Matthew Kerle
> IT Consultant
> Canberra, Australia
>
> Mobile: +61404 096 863
> Email : mattkerle@gmail.com
> Web : http://threebrightlights.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
Hi David

David Smith wrote:
> My only editorial comment on the page is to NOT place your 
> <Resource.../> or <Context .../> definition in server.xml as 
> recommended on the page.  Place it in context.xml or myapp.xml as I 
> describe above.

Just quickly, I was wondering why you recommend this? I know the tomcat 
docs have changed to reflect the deprecation of defining the 
<Resource.../> or <Context .../> definition in server.xml, but I never 
understood why, and personally doing things that way is a serious pain 
for me since it means I need to build a separate deployment descriptor 
for dev, test & prod, which means I need to know the prod database 
details. which I don't want.

Is there a better way that the sysadmin can setup a JNDI datasource so 
that deployed war's don't have to contain database-specific details? the 
only way I've seen so far is to configure that in the server.xml...

cheers!

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by David Smith <dn...@cornell.edu>.
Hi Ian.

ojdbc14.jar needs to ONLY be in common/lib.  It won't work in 
myapp/WEB-INF/lib and won't work if you have the jar in both places.

Additionally you should take a look at the JDBC howto docs regarding 
what your <Resource...> config in your myapp/META-INF/context.xml or 
conf/Catalina/localhost/myapp.xml should look like:

http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Oracle%208i%20with%20OCI%20client

My only editorial comment on the page is to NOT place your 
<Resource.../> or <Context .../> definition in server.xml as recommended 
on the page.  Place it in context.xml or myapp.xml as I describe above.

--David

ian.blenk@dsl.pipex.com wrote:

>Thanks for your advice so far
>
>I've upgraded to the latest Oracle ojdbc14.jar and placed it the myapp\WEB-INF\lib folder, I also tried it the 
>Tomcat\common\lib for for good measure but still got the same results. I'll continue to use ojdbc14.jar from now 
>though.
>
>I've change the ResourceParams name to just Resource name but this causes Tomcat not to startup, the logs show the 
>following trace...
>
>*** Excerpt Tomcat 5.5.12 logs ***
>16-Aug-2007 16:08:32 org.apache.tomcat.util.digester.Digester endElement
>SEVERE: End event threw exception
>java.lang.reflect.InvocationTargetException
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>*** end ***
>
>Does this mean it's now reading the <context> <Resource> element. ?
>
>Thanks
>
>Ian
>
>
>Quoting ashish shrivastava <as...@gmail.com>:
>
>  
>
>>check this
>>
>>http://evolutionnext.com/blog/2005/10/13/1129259088959.html
>>
>>
>>
>>On 8/16/07, Matthew Kerle <ma...@sra.com.au> wrote:
>>    
>>
>>>hmm, you have an interesting problem!
>>>
>>>first thing I'd say is use this opportunity to upgrade to the
>>>ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of
>>>nice enhancements.
>>>
>>>second, I'm assuming that since the error is a servlet exception, that
>>>there's some servlet code manually handling a database connection (no
>>>comment *cough* *cough*) that it gets from a JNDI lookup?
>>>
>>>third, try changing the <ResourceParams> tag to a plain <Resource> tag,
>>>this is the Resource tag that I use in my app (and it works). caveat: I
>>>declare this in /META-INF/context.xml inside the <context> tag.
>>>
>>>   <Resource name="jdbc/my_USERDS" auth="Container"
>>>             type="javax.sql.DataSource"
>>>             maxActive="0"
>>>             maxIdle="10"
>>>             maxWait="500"
>>>             username="db_user"
>>>             password="db_pass"
>>>             driverClassName="oracle.jdbc.OracleDriver"
>>>             url="jdbc:oracle:thin:@server:1521:ORA_SID"/>
>>>
>>>can you try this and let us know how it goes?
>>>
>>>cheers!
>>>
>>>ian.blenk@dsl.pipex.com wrote:
>>>      
>>>
>>>>I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three
>>>>        
>>>>
>>>applications that are deployed from this
>>>      
>>>
>>>>server, two of which work fine with tomcat 5.5.12, however the third
>>>>        
>>>>
>>>which uses an oracle 9i database gives me the
>>>      
>>>
>>>>following error "javax.servlet.ServletException: Cannot create JDBC
>>>>        
>>>>
>>>driver of class '' for connect URL 'null' ".
>>>      
>>>
>>>>Basically I've included the same details form the Tomcat4 server.xmlfile
>>>>        
>>>>
>>into the tomcat
>>    
>>
>>>5.5 server.xml, rediting
>>>      
>>>
>>>>where necessary.
>>>>
>>>>Things I have tried..
>>>>
>>>>Placing the context into fragment files located either inside the
>>>>        
>>>>
>>>applications META-INF folder or under
>>>      
>>>
>>>>tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as
>>>>        
>>>>
>>>Tomcat could not find the apps, so I've
>>>      
>>>
>>>>left the context back in server.xml.
>>>>Rewriting the Resource params <parameter> as elements i.e.factory="
>>>>        
>>>>
>>>com.ora.jsp.sql.DataSourceFactory"
>>>      
>>>
>>>>Checked changed location of the JDBC jar file.
>>>>        
>>>>
>>classes12.jarcatalina_home\common\lib\ AND
>>    
>>
>>>>catalina_home\webapps\[appname]\WEB-INF\lib
>>>>Checked changed the server.xml service-name and engine name to match
>>>>        
>>>>
>>>previous TC4 server.xml version.
>>>      
>>>
>>>>Added a Resourcelink element to the context - this is not present on the
>>>>        
>>>>
>>>TC4 version
>>>      
>>>
>>>>Checked Tomcat logs.
>>>>
>>>>I think that Tomcat is not able to read the <ResourceParams> element,
>>>>        
>>>>
>>>which is why the URL and driverClass are
>>>      
>>>
>>>>NULL.
>>>>
>>>>Which When I checked the Tomcat log files shows ...
>>>>
>>>>16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
>>>>SEVERE: action: Cannot create JDBC driver of class '' for connect URL
>>>>        
>>>>
>>>'null'
>>>      
>>>
>>>>Background info
>>>>Using Apache 2.0 with mod_JK to serve pages on port 80
>>>>Java version 1.5
>>>>
>>>>**** server.xml ****
>>>>
>>>><!-- Tomcat 5.5 Example Server Configuration File -->
>>>>
>>>><Server port="8005" shutdown="SHUTDOWN" debug="0">
>>>>
>>>>  <Listener className="
>>>>        
>>>>
>>>org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
>>>      
>>>
>>>>  <Listener className="
>>>>        
>>>>
>>>org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
>>>      
>>>
>>>>  <!-- Global JNDI resources -->
>>>>  <GlobalNamingResources>
>>>>
>>>>    <!-- Test entry for demonstration purposes -->
>>>>    <Environment name="simpleValue" type="java.lang.Integer"
>>>>        
>>>>
>>>value="30"/>
>>>      
>>>
>>>>    <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" ></Resource>
>>>>
>>>>
>>>>  </GlobalNamingResources>
>>>>
>>>>
>>>>  <Service name="Catalina">
>>>>
>>>>    <Connector port="8009"
>>>>               enableLookups="true" redirectPort="8443"
>>>>        
>>>>
>>>protocol="AJP/1.3" />
>>>      
>>>
>>>>    <Engine name="Catalina" defaultHost="opp-online" debug="0">
>>>>
>>>>
>>>>      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>>>>             resourceName="UserDatabase"/>
>>>>
>>>>
>>>>      <Host name="opportunities-online" debug="0" appBase="webapps" >
>>>>
>>>>
>>>>        <Context path="/staff" docBase="oponline/staff" cookies="true"
>>>>        
>>>>
>>>reloadable="true">
>>>      
>>>
>>>>          <Valve className="org.apache.catalina.valves.AccessLogValve"
>>>>                 directory="logs"  prefix="staff_access_log."
>>>>        
>>>>
>>>suffix=".txt"
>>>      
>>>
>>>>                 pattern="combined" resolveHosts="false"/>
>>>>
>>>>          <Logger className="org.apache.catalina.logger.FileLogger"
>>>>        
>>>>
>>>prefix="oponline_log." suffix=".txt"
>>>      
>>>
>>>>timestamp="true"/>
>>>>
>>>>           <ResourceParams name="jdbc/oponline"
>>>>                     factory="com.ora.jsp.sql.DataSourceFactory"
>>>>                         user="myuser"
>>>>                         password="mypassword"
>>>>                         dataSourceClassName="
>>>>        
>>>>
>>>oracle.jdbc.pool.OracleConnectionCacheImpl"
>>>      
>>>
>>>>                         URL="
>>>>        
>>>>
>>>jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
>>>      
>>>
>>>>                         maxLimit="5" />
>>>>
>>>>             <!-- global resource for application's context. -->
>>>>             <!-- <ResourceLink name="/jdbc/oponline"
>>>>        
>>>>
>>>global="/jdbc/oponline"
>>>      
>>>
>>>>                        type="org.apache.catalina.UserDatabase"/> -->
>>>>
>>>>        </Context>
>>>>
>>>>      </Host>
>>>>
>>>>    </Engine>
>>>>
>>>>  </Service>
>>>>
>>>></Server>
>>>>
>>>>*** end server.xml ***
>>>>
>>>>
>>>>*** App web.xml except ***
>>>>
>>>> <resource-ref>
>>>>    <description>
>>>>      JNDI DataSource for [appname] database.
>>>>      (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
>>>>    </description>
>>>>    <res-ref-name>jdbc/oponline</res-ref-name>
>>>>    <res-type>javax.sql.DataSource</res-type>
>>>>    <res-auth>Container</res-auth>
>>>>  </resource-ref>
>>>>
>>>>*** end web.xml ***
>>>>
>>>>
>>>>Thanks
>>>>
>>>>Ian
>>>>
>>>>
>>>>        
>>>>
>>>--
>>>Matthew Kerle
>>>IT Consultant
>>>Canberra, Australia
>>>
>>>Mobile: +61404 096 863
>>>Email : mattkerle@gmail.com
>>>Web : http://threebrightlights.blogspot.com/
>>>
>>>
>>>---------------------------------------------------------------------
>>>To start a new topic, e-mail: users@tomcat.apache.org
>>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>      
>>>
>
>
>  
>


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
looks like your xml doc has an un-closed tag or similar, hate to suggest 
this but maybe can you recheck your change to make sure this isn't the case?

I'd suggest going with David's suggestion, and put your <context .../> 
definition in a separate file called 'context.xml'. Explode your WAR, 
put this in /META-INF/ folder (create if doesn't exist), then re-deploy. 
your context.xml should look like this (tomcat 5.5+):

**start context.xml**
<!-- Tomcat 5.5. -->
<Context path="/myapp">
    <!-- set the JNDI Datasource -->
    <Resource name="jdbc/APP_USERDS" 
	      auth="Container"
              type="javax.sql.DataSource"
              maxActive="0"
              maxIdle="10"
              maxWait="500"
              username="dbuser"
              password="dbuserpass"
              driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@server:1521:SID"/>

</Context>
** end context.xml**



ian.blenk@dsl.pipex.com wrote:
> Thanks for your advice so far
>
> I've upgraded to the latest Oracle ojdbc14.jar and placed it the myapp\WEB-INF\lib folder, I also tried it the 
> Tomcat\common\lib for for good measure but still got the same results. I'll continue to use ojdbc14.jar from now 
> though.
>
> I've change the ResourceParams name to just Resource name but this causes Tomcat not to startup, the logs show the 
> following trace...
>
> *** Excerpt Tomcat 5.5.12 logs ***
> 16-Aug-2007 16:08:32 org.apache.tomcat.util.digester.Digester endElement
> SEVERE: End event threw exception
> java.lang.reflect.InvocationTargetException
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> *** end ***
>
> Does this mean it's now reading the <context> <Resource> element. ?
>
> Thanks
>
> Ian
>
>
> Quoting ashish shrivastava <as...@gmail.com>:
>
>   
>> check this
>>
>> http://evolutionnext.com/blog/2005/10/13/1129259088959.html
>>
>>
>>
>> On 8/16/07, Matthew Kerle <ma...@sra.com.au> wrote:
>>     
>>> hmm, you have an interesting problem!
>>>
>>> first thing I'd say is use this opportunity to upgrade to the
>>> ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of
>>> nice enhancements.
>>>
>>> second, I'm assuming that since the error is a servlet exception, that
>>> there's some servlet code manually handling a database connection (no
>>> comment *cough* *cough*) that it gets from a JNDI lookup?
>>>
>>> third, try changing the <ResourceParams> tag to a plain <Resource> tag,
>>> this is the Resource tag that I use in my app (and it works). caveat: I
>>> declare this in /META-INF/context.xml inside the <context> tag.
>>>
>>>    <Resource name="jdbc/my_USERDS" auth="Container"
>>>              type="javax.sql.DataSource"
>>>              maxActive="0"
>>>              maxIdle="10"
>>>              maxWait="500"
>>>              username="db_user"
>>>              password="db_pass"
>>>              driverClassName="oracle.jdbc.OracleDriver"
>>>              url="jdbc:oracle:thin:@server:1521:ORA_SID"/>
>>>
>>> can you try this and let us know how it goes?
>>>
>>> cheers!
>>>
>>> ian.blenk@dsl.pipex.com wrote:
>>>       
>>>> I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three
>>>>         
>>> applications that are deployed from this
>>>       
>>>> server, two of which work fine with tomcat 5.5.12, however the third
>>>>         
>>> which uses an oracle 9i database gives me the
>>>       
>>>> following error "javax.servlet.ServletException: Cannot create JDBC
>>>>         
>>> driver of class '' for connect URL 'null' ".
>>>       
>>>> Basically I've included the same details form the Tomcat4 server.xmlfile
>>>>         
>> into the tomcat
>>     
>>> 5.5 server.xml, rediting
>>>       
>>>> where necessary.
>>>>
>>>> Things I have tried..
>>>>
>>>> Placing the context into fragment files located either inside the
>>>>         
>>> applications META-INF folder or under
>>>       
>>>> tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as
>>>>         
>>> Tomcat could not find the apps, so I've
>>>       
>>>> left the context back in server.xml.
>>>> Rewriting the Resource params <parameter> as elements i.e.factory="
>>>>         
>>> com.ora.jsp.sql.DataSourceFactory"
>>>       
>>>> Checked changed location of the JDBC jar file.
>>>>         
>> classes12.jarcatalina_home\common\lib\ AND
>>     
>>>> catalina_home\webapps\[appname]\WEB-INF\lib
>>>> Checked changed the server.xml service-name and engine name to match
>>>>         
>>> previous TC4 server.xml version.
>>>       
>>>> Added a Resourcelink element to the context - this is not present on the
>>>>         
>>> TC4 version
>>>       
>>>> Checked Tomcat logs.
>>>>
>>>> I think that Tomcat is not able to read the <ResourceParams> element,
>>>>         
>>> which is why the URL and driverClass are
>>>       
>>>> NULL.
>>>>
>>>> Which When I checked the Tomcat log files shows ...
>>>>
>>>> 16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
>>>> SEVERE: action: Cannot create JDBC driver of class '' for connect URL
>>>>         
>>> 'null'
>>>       
>>>> Background info
>>>> Using Apache 2.0 with mod_JK to serve pages on port 80
>>>> Java version 1.5
>>>>
>>>> **** server.xml ****
>>>>
>>>> <!-- Tomcat 5.5 Example Server Configuration File -->
>>>>
>>>> <Server port="8005" shutdown="SHUTDOWN" debug="0">
>>>>
>>>>   <Listener className="
>>>>         
>>> org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
>>>       
>>>>   <Listener className="
>>>>         
>>> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
>>>       
>>>>   <!-- Global JNDI resources -->
>>>>   <GlobalNamingResources>
>>>>
>>>>     <!-- Test entry for demonstration purposes -->
>>>>     <Environment name="simpleValue" type="java.lang.Integer"
>>>>         
>>> value="30"/>
>>>       
>>>>     <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" ></Resource>
>>>>
>>>>
>>>>   </GlobalNamingResources>
>>>>
>>>>
>>>>   <Service name="Catalina">
>>>>
>>>>     <Connector port="8009"
>>>>                enableLookups="true" redirectPort="8443"
>>>>         
>>> protocol="AJP/1.3" />
>>>       
>>>>     <Engine name="Catalina" defaultHost="opp-online" debug="0">
>>>>
>>>>
>>>>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>>>>              resourceName="UserDatabase"/>
>>>>
>>>>
>>>>       <Host name="opportunities-online" debug="0" appBase="webapps" >
>>>>
>>>>
>>>>         <Context path="/staff" docBase="oponline/staff" cookies="true"
>>>>         
>>> reloadable="true">
>>>       
>>>>           <Valve className="org.apache.catalina.valves.AccessLogValve"
>>>>                  directory="logs"  prefix="staff_access_log."
>>>>         
>>> suffix=".txt"
>>>       
>>>>                  pattern="combined" resolveHosts="false"/>
>>>>
>>>>           <Logger className="org.apache.catalina.logger.FileLogger"
>>>>         
>>> prefix="oponline_log." suffix=".txt"
>>>       
>>>> timestamp="true"/>
>>>>
>>>>            <ResourceParams name="jdbc/oponline"
>>>>                      factory="com.ora.jsp.sql.DataSourceFactory"
>>>>                          user="myuser"
>>>>                          password="mypassword"
>>>>                          dataSourceClassName="
>>>>         
>>> oracle.jdbc.pool.OracleConnectionCacheImpl"
>>>       
>>>>                          URL="
>>>>         
>>> jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
>>>       
>>>>                          maxLimit="5" />
>>>>
>>>>              <!-- global resource for application's context. -->
>>>>              <!-- <ResourceLink name="/jdbc/oponline"
>>>>         
>>> global="/jdbc/oponline"
>>>       
>>>>                         type="org.apache.catalina.UserDatabase"/> -->
>>>>
>>>>         </Context>
>>>>
>>>>       </Host>
>>>>
>>>>     </Engine>
>>>>
>>>>   </Service>
>>>>
>>>> </Server>
>>>>
>>>> *** end server.xml ***
>>>>
>>>>
>>>> *** App web.xml except ***
>>>>
>>>>  <resource-ref>
>>>>     <description>
>>>>       JNDI DataSource for [appname] database.
>>>>       (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
>>>>     </description>
>>>>     <res-ref-name>jdbc/oponline</res-ref-name>
>>>>     <res-type>javax.sql.DataSource</res-type>
>>>>     <res-auth>Container</res-auth>
>>>>   </resource-ref>
>>>>
>>>> *** end web.xml ***
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Ian
>>>>
>>>>
>>>>         
>>> --
>>> Matthew Kerle
>>> IT Consultant
>>> Canberra, Australia
>>>
>>> Mobile: +61404 096 863
>>> Email : mattkerle@gmail.com
>>> Web : http://threebrightlights.blogspot.com/
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>       
>
>
>   

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by ia...@dsl.pipex.com.
Thanks for your advice so far

I've upgraded to the latest Oracle ojdbc14.jar and placed it the myapp\WEB-INF\lib folder, I also tried it the 
Tomcat\common\lib for for good measure but still got the same results. I'll continue to use ojdbc14.jar from now 
though.

I've change the ResourceParams name to just Resource name but this causes Tomcat not to startup, the logs show the 
following trace...

*** Excerpt Tomcat 5.5.12 logs ***
16-Aug-2007 16:08:32 org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
*** end ***

Does this mean it's now reading the <context> <Resource> element. ?

Thanks

Ian


Quoting ashish shrivastava <as...@gmail.com>:

> check this
> 
> http://evolutionnext.com/blog/2005/10/13/1129259088959.html
> 
> 
> 
> On 8/16/07, Matthew Kerle <ma...@sra.com.au> wrote:
> >
> > hmm, you have an interesting problem!
> >
> > first thing I'd say is use this opportunity to upgrade to the
> > ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of
> > nice enhancements.
> >
> > second, I'm assuming that since the error is a servlet exception, that
> > there's some servlet code manually handling a database connection (no
> > comment *cough* *cough*) that it gets from a JNDI lookup?
> >
> > third, try changing the <ResourceParams> tag to a plain <Resource> tag,
> > this is the Resource tag that I use in my app (and it works). caveat: I
> > declare this in /META-INF/context.xml inside the <context> tag.
> >
> >    <Resource name="jdbc/my_USERDS" auth="Container"
> >              type="javax.sql.DataSource"
> >              maxActive="0"
> >              maxIdle="10"
> >              maxWait="500"
> >              username="db_user"
> >              password="db_pass"
> >              driverClassName="oracle.jdbc.OracleDriver"
> >              url="jdbc:oracle:thin:@server:1521:ORA_SID"/>
> >
> > can you try this and let us know how it goes?
> >
> > cheers!
> >
> > ian.blenk@dsl.pipex.com wrote:
> > > I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three
> > applications that are deployed from this
> > > server, two of which work fine with tomcat 5.5.12, however the third
> > which uses an oracle 9i database gives me the
> > > following error "javax.servlet.ServletException: Cannot create JDBC
> > driver of class '' for connect URL 'null' ".
> > > Basically I've included the same details form the Tomcat4 server.xmlfile
> into the tomcat
> > 5.5 server.xml, rediting
> > > where necessary.
> > >
> > > Things I have tried..
> > >
> > > Placing the context into fragment files located either inside the
> > applications META-INF folder or under
> > > tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as
> > Tomcat could not find the apps, so I've
> > > left the context back in server.xml.
> > > Rewriting the Resource params <parameter> as elements i.e.factory="
> > com.ora.jsp.sql.DataSourceFactory"
> > > Checked changed location of the JDBC jar file.
> classes12.jarcatalina_home\common\lib\ AND
> > > catalina_home\webapps\[appname]\WEB-INF\lib
> > > Checked changed the server.xml service-name and engine name to match
> > previous TC4 server.xml version.
> > > Added a Resourcelink element to the context - this is not present on the
> > TC4 version
> > > Checked Tomcat logs.
> > >
> > > I think that Tomcat is not able to read the <ResourceParams> element,
> > which is why the URL and driverClass are
> > > NULL.
> > >
> > > Which When I checked the Tomcat log files shows ...
> > >
> > > 16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
> > > SEVERE: action: Cannot create JDBC driver of class '' for connect URL
> > 'null'
> > >
> > > Background info
> > > Using Apache 2.0 with mod_JK to serve pages on port 80
> > > Java version 1.5
> > >
> > > **** server.xml ****
> > >
> > > <!-- Tomcat 5.5 Example Server Configuration File -->
> > >
> > > <Server port="8005" shutdown="SHUTDOWN" debug="0">
> > >
> > >   <Listener className="
> > org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
> > >   <Listener className="
> > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
> > >
> > >   <!-- Global JNDI resources -->
> > >   <GlobalNamingResources>
> > >
> > >     <!-- Test entry for demonstration purposes -->
> > >     <Environment name="simpleValue" type="java.lang.Integer"
> > value="30"/>
> > >
> > >
> > >     <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" ></Resource>
> > >
> > >
> > >   </GlobalNamingResources>
> > >
> > >
> > >   <Service name="Catalina">
> > >
> > >     <Connector port="8009"
> > >                enableLookups="true" redirectPort="8443"
> > protocol="AJP/1.3" />
> > >
> > >     <Engine name="Catalina" defaultHost="opp-online" debug="0">
> > >
> > >
> > >       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> > >              resourceName="UserDatabase"/>
> > >
> > >
> > >       <Host name="opportunities-online" debug="0" appBase="webapps" >
> > >
> > >
> > >         <Context path="/staff" docBase="oponline/staff" cookies="true"
> > reloadable="true">
> > >           <Valve className="org.apache.catalina.valves.AccessLogValve"
> > >                  directory="logs"  prefix="staff_access_log."
> > suffix=".txt"
> > >                  pattern="combined" resolveHosts="false"/>
> > >
> > >           <Logger className="org.apache.catalina.logger.FileLogger"
> > prefix="oponline_log." suffix=".txt"
> > > timestamp="true"/>
> > >
> > >            <ResourceParams name="jdbc/oponline"
> > >                      factory="com.ora.jsp.sql.DataSourceFactory"
> > >                          user="myuser"
> > >                          password="mypassword"
> > >                          dataSourceClassName="
> > oracle.jdbc.pool.OracleConnectionCacheImpl"
> > >                          URL="
> > jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
> > >                          maxLimit="5" />
> > >
> > >              <!-- global resource for application's context. -->
> > >              <!-- <ResourceLink name="/jdbc/oponline"
> > global="/jdbc/oponline"
> > >                         type="org.apache.catalina.UserDatabase"/> -->
> > >
> > >         </Context>
> > >
> > >       </Host>
> > >
> > >     </Engine>
> > >
> > >   </Service>
> > >
> > > </Server>
> > >
> > > *** end server.xml ***
> > >
> > >
> > > *** App web.xml except ***
> > >
> > >  <resource-ref>
> > >     <description>
> > >       JNDI DataSource for [appname] database.
> > >       (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
> > >     </description>
> > >     <res-ref-name>jdbc/oponline</res-ref-name>
> > >     <res-type>javax.sql.DataSource</res-type>
> > >     <res-auth>Container</res-auth>
> > >   </resource-ref>
> > >
> > > *** end web.xml ***
> > >
> > >
> > > Thanks
> > >
> > > Ian
> > >
> > >
> >
> > --
> > Matthew Kerle
> > IT Consultant
> > Canberra, Australia
> >
> > Mobile: +61404 096 863
> > Email : mattkerle@gmail.com
> > Web : http://threebrightlights.blogspot.com/
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 


-- 

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


Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by ashish shrivastava <as...@gmail.com>.
check this

http://evolutionnext.com/blog/2005/10/13/1129259088959.html



On 8/16/07, Matthew Kerle <ma...@sra.com.au> wrote:
>
> hmm, you have an interesting problem!
>
> first thing I'd say is use this opportunity to upgrade to the
> ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of
> nice enhancements.
>
> second, I'm assuming that since the error is a servlet exception, that
> there's some servlet code manually handling a database connection (no
> comment *cough* *cough*) that it gets from a JNDI lookup?
>
> third, try changing the <ResourceParams> tag to a plain <Resource> tag,
> this is the Resource tag that I use in my app (and it works). caveat: I
> declare this in /META-INF/context.xml inside the <context> tag.
>
>    <Resource name="jdbc/my_USERDS" auth="Container"
>              type="javax.sql.DataSource"
>              maxActive="0"
>              maxIdle="10"
>              maxWait="500"
>              username="db_user"
>              password="db_pass"
>              driverClassName="oracle.jdbc.OracleDriver"
>              url="jdbc:oracle:thin:@server:1521:ORA_SID"/>
>
> can you try this and let us know how it goes?
>
> cheers!
>
> ian.blenk@dsl.pipex.com wrote:
> > I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three
> applications that are deployed from this
> > server, two of which work fine with tomcat 5.5.12, however the third
> which uses an oracle 9i database gives me the
> > following error "javax.servlet.ServletException: Cannot create JDBC
> driver of class '' for connect URL 'null' ".
> > Basically I've included the same details form the Tomcat4 server.xmlfile into the tomcat
> 5.5 server.xml, rediting
> > where necessary.
> >
> > Things I have tried..
> >
> > Placing the context into fragment files located either inside the
> applications META-INF folder or under
> > tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as
> Tomcat could not find the apps, so I've
> > left the context back in server.xml.
> > Rewriting the Resource params <parameter> as elements i.e.factory="
> com.ora.jsp.sql.DataSourceFactory"
> > Checked changed location of the JDBC jar file. classes12.jarcatalina_home\common\lib\ AND
> > catalina_home\webapps\[appname]\WEB-INF\lib
> > Checked changed the server.xml service-name and engine name to match
> previous TC4 server.xml version.
> > Added a Resourcelink element to the context - this is not present on the
> TC4 version
> > Checked Tomcat logs.
> >
> > I think that Tomcat is not able to read the <ResourceParams> element,
> which is why the URL and driverClass are
> > NULL.
> >
> > Which When I checked the Tomcat log files shows ...
> >
> > 16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
> > SEVERE: action: Cannot create JDBC driver of class '' for connect URL
> 'null'
> >
> > Background info
> > Using Apache 2.0 with mod_JK to serve pages on port 80
> > Java version 1.5
> >
> > **** server.xml ****
> >
> > <!-- Tomcat 5.5 Example Server Configuration File -->
> >
> > <Server port="8005" shutdown="SHUTDOWN" debug="0">
> >
> >   <Listener className="
> org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
> >   <Listener className="
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
> >
> >   <!-- Global JNDI resources -->
> >   <GlobalNamingResources>
> >
> >     <!-- Test entry for demonstration purposes -->
> >     <Environment name="simpleValue" type="java.lang.Integer"
> value="30"/>
> >
> >
> >     <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" ></Resource>
> >
> >
> >   </GlobalNamingResources>
> >
> >
> >   <Service name="Catalina">
> >
> >     <Connector port="8009"
> >                enableLookups="true" redirectPort="8443"
> protocol="AJP/1.3" />
> >
> >     <Engine name="Catalina" defaultHost="opp-online" debug="0">
> >
> >
> >       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> >              resourceName="UserDatabase"/>
> >
> >
> >       <Host name="opportunities-online" debug="0" appBase="webapps" >
> >
> >
> >         <Context path="/staff" docBase="oponline/staff" cookies="true"
> reloadable="true">
> >           <Valve className="org.apache.catalina.valves.AccessLogValve"
> >                  directory="logs"  prefix="staff_access_log."
> suffix=".txt"
> >                  pattern="combined" resolveHosts="false"/>
> >
> >           <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="oponline_log." suffix=".txt"
> > timestamp="true"/>
> >
> >            <ResourceParams name="jdbc/oponline"
> >                      factory="com.ora.jsp.sql.DataSourceFactory"
> >                          user="myuser"
> >                          password="mypassword"
> >                          dataSourceClassName="
> oracle.jdbc.pool.OracleConnectionCacheImpl"
> >                          URL="
> jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
> >                          maxLimit="5" />
> >
> >              <!-- global resource for application's context. -->
> >              <!-- <ResourceLink name="/jdbc/oponline"
> global="/jdbc/oponline"
> >                         type="org.apache.catalina.UserDatabase"/> -->
> >
> >         </Context>
> >
> >       </Host>
> >
> >     </Engine>
> >
> >   </Service>
> >
> > </Server>
> >
> > *** end server.xml ***
> >
> >
> > *** App web.xml except ***
> >
> >  <resource-ref>
> >     <description>
> >       JNDI DataSource for [appname] database.
> >       (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
> >     </description>
> >     <res-ref-name>jdbc/oponline</res-ref-name>
> >     <res-type>javax.sql.DataSource</res-type>
> >     <res-auth>Container</res-auth>
> >   </resource-ref>
> >
> > *** end web.xml ***
> >
> >
> > Thanks
> >
> > Ian
> >
> >
>
> --
> Matthew Kerle
> IT Consultant
> Canberra, Australia
>
> Mobile: +61404 096 863
> Email : mattkerle@gmail.com
> Web : http://threebrightlights.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: JDBC driver of class '' for connect URL 'null' in Tomcat 5.5.12

Posted by Matthew Kerle <ma...@sra.com.au>.
hmm, you have an interesting problem!

first thing I'd say is use this opportunity to upgrade to the 
ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of 
nice enhancements.

second, I'm assuming that since the error is a servlet exception, that 
there's some servlet code manually handling a database connection (no 
comment *cough* *cough*) that it gets from a JNDI lookup?

third, try changing the <ResourceParams> tag to a plain <Resource> tag, 
this is the Resource tag that I use in my app (and it works). caveat: I 
declare this in /META-INF/context.xml inside the <context> tag.

    <Resource name="jdbc/my_USERDS" auth="Container"
              type="javax.sql.DataSource"
              maxActive="0"
              maxIdle="10"
              maxWait="500"
              username="db_user"
              password="db_pass"
              driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@server:1521:ORA_SID"/>

can you try this and let us know how it goes?

cheers!

ian.blenk@dsl.pipex.com wrote:
> I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three applications that are deployed from this 
> server, two of which work fine with tomcat 5.5.12, however the third which uses an oracle 9i database gives me the 
> following error "javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null' ". 
> Basically I've included the same details form the Tomcat4 server.xml file into the tomcat 5.5 server.xml, rediting 
> where necessary.
>
> Things I have tried..
>
> Placing the context into fragment files located either inside the applications META-INF folder or under 
> tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as Tomcat could not find the apps, so I've 
> left the context back in server.xml.
> Rewriting the Resource params <parameter> as elements i.e.factory="com.ora.jsp.sql.DataSourceFactory"
> Checked changed location of the JDBC jar file. classes12.jar catalina_home\common\lib\ AND 
> catalina_home\webapps\[appname]\WEB-INF\lib
> Checked changed the server.xml service-name and engine name to match previous TC4 server.xml version.
> Added a Resourcelink element to the context - this is not present on the TC4 version
> Checked Tomcat logs.
>
> I think that Tomcat is not able to read the <ResourceParams> element, which is why the URL and driverClass are 
> NULL. 
>
> Which When I checked the Tomcat log files shows ...
>
> 16-Aug-2007 09:25:46 org.apache.catalina.core.ApplicationContext log
> SEVERE: action: Cannot create JDBC driver of class '' for connect URL 'null'
>
> Background info 
> Using Apache 2.0 with mod_JK to serve pages on port 80
> Java version 1.5
>
> **** server.xml ****
>
> <!-- Tomcat 5.5 Example Server Configuration File -->
>
> <Server port="8005" shutdown="SHUTDOWN" debug="0">
>
>   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/>
>   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
>  
>   <!-- Global JNDI resources -->
>   <GlobalNamingResources>
>
>     <!-- Test entry for demonstration purposes -->
>     <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
>
>
>     <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" ></Resource>
>
>         
>   </GlobalNamingResources>
>
>
>   <Service name="Catalina">
>    
>     <Connector port="8009" 
>                enableLookups="true" redirectPort="8443" protocol="AJP/1.3" />
>
>     <Engine name="Catalina" defaultHost="opp-online" debug="0">
>
>       
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>                          
>           
>       <Host name="opportunities-online" debug="0" appBase="webapps" >
>       
>
>         <Context path="/staff" docBase="oponline/staff" cookies="true" reloadable="true">
>           <Valve className="org.apache.catalina.valves.AccessLogValve"
>                  directory="logs"  prefix="staff_access_log." suffix=".txt"
>                  pattern="combined" resolveHosts="false"/>
>                                  
>           <Logger className="org.apache.catalina.logger.FileLogger" prefix="oponline_log." suffix=".txt" 
> timestamp="true"/> 
>           
>            <ResourceParams name="jdbc/oponline"
>                      factory="com.ora.jsp.sql.DataSourceFactory"
>                          user="myuser"
>                          password="mypassword"
>                          dataSourceClassName="oracle.jdbc.pool.OracleConnectionCacheImpl"
>                          URL="jdbc:oracle:thin:@sas-test.myserver.ac.uk:1521:MYTE"
>                          maxLimit="5" />
>                   
>              <!-- global resource for application's context. -->
>              <!-- <ResourceLink name="/jdbc/oponline" global="/jdbc/oponline"
>                         type="org.apache.catalina.UserDatabase"/> -->
>                                     
>         </Context>
>         
>       </Host>
>
>     </Engine>
>
>   </Service>
>
> </Server>
>
> *** end server.xml ***
>
>
> *** App web.xml except ***
>
>  <resource-ref>
>     <description>
>       JNDI DataSource for [appname] database.
>       (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485)
>     </description>
>     <res-ref-name>jdbc/oponline</res-ref-name>
>     <res-type>javax.sql.DataSource</res-type>
>     <res-auth>Container</res-auth>
>   </resource-ref>
>
> *** end web.xml ***
>
>
> Thanks
>
> Ian
>
>   

-- 
Matthew Kerle
IT Consultant
Canberra, Australia

Mobile: +61404 096 863
Email : mattkerle@gmail.com
Web : http://threebrightlights.blogspot.com/


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