You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mateusz Kijowski <ma...@gmail.com> on 2007/10/04 12:52:52 UTC

Weird magic happening when deploying WARs via manager webapp

Howdy list,


I've been messing with our site's tomcat installation (we are running 5.5.17 
with BEA's 1.5.0_06-b05 JRockit JVM on 2.6 Linux) recently and wanted to 
change our deployment process to use the manager application to upload and 
deploy WAR files. Right now we copy the webapp tree to the right place in the 
filesystem and reload the webapp via the manager interface. After some 
testing we found out that deploying our main production WAR doesn't seem to 
work. The error message we are getting is:


org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null'


After some googling we've come into conclusion that the resource descriptor 
defined in the webapp's context.xml (located in 
war_root/META-INF/context.xml) isn't read/initialised properly and the the 
resource-ref defined in web.xml tries to connect to a resource with default, 
null/empty values (does it seem correct?). 

Well, that's where the magic starts. After some debugging we found out that it 
does work *sometimes*. No error messages, and everything works as supposed. 
The breakage seems random, not depending on any changes on our side.

The configuration layout we are using right now without any problems is almost 
identical as the one in WAR files (the only difference being additional 
resource-ref in web.xml). The I've been lurking this list for quite a while, 
but I haven't seen anyone describe the problem I am experiecning.

The webapp archive is quite(?) big, weighing ~60 MB. One of the explanation we 
are considering is that tomcat starts deploying the webapp before it is fully 
uploaded/unpacked. Is that possible.

Below are relevant config files.

WAR_ROOT/META-INF/context.xml:

<Context debug="0" reloadable="false" crossContext="false">
        <Resource name="jdbc/qs"
                auth="Container"
                type="javax.sql.DataSource"
                factory="org.apache.commons.dbcp.BasicDataSourceFactory"
                driverClassName="org.postgresql.Driver"
                url="jdbc:postgresql://the_host:5432/qs"
                validationQuery="SELECT 1"
                loginTimeout="10"
                username="the_username"
                password="the_secret"
                initialSize="20"
                maxActive="70"
                minIdle="20"
                maxIdle="50"
                maxWait="-1"
                testWhileIdle="true"
                testOnBorrow="false"
                removeAbandoned="true"
                removeAbandonedTimeout="100"
                logAbandoned="true"
                timeBetweenEvictionRunsMillis="60000"
                minEvictableIdleTimeMillis="120000"/>
        <Resource name="jdbc/sof"
                auth="Container"
                type="javax.sql.DataSource"
                factory="org.apache.commons.dbcp.BasicDataSourceFactory"
                driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://the_host/sof?characterEncoding=UTF-8"
                validationQuery="SELECT 1"
                loginTimeout="10"
                username="the_username"
                password="the_secret"
                initialSize="30"
                maxActive="100"
                minIdle="30"
                maxIdle="60"
                maxWait="-1"
                testWhileIdle="true"
                testOnBorrow="false"
                removeAbandoned="true"
                removeAbandonedTimeout="300"
                logAbandoned="true"
                timeBetweenEvictionRunsMillis="60000"
                minEvictableIdleTimeMillis="120000"/>
</Context>

WAR_ROOT/WEB-INF/web.xml:

        [snip]
        <resource-ref>
                <description>postgreSQL Datasource example</description>
                <res-ref-name>jdbc/qs</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
        <resource-ref>
                <description>postgreSQL Datasource example</description>
                <res-ref-name>jdbc/sof</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
	[snip]

CATALINA_HOME/conf/server.xml:

	[snip]
	<Host name="the_hostname" appBase="vhosts/program"
		unpackWARs="true" autoDeploy="false"
		xmlValidation="false" xmlNamespaceAware="false">

	[...some valves, aliases, doesn't seem relevent...]

	</Host>
	[snip]

The version working right now properly doesn't have the second resource-ref 
(the webapp manages to use the jdbc/sof resource anyway), but some another 
error message ("javax.naming.NameNotFoundException: Name sof is not bound in 
this Context") made us put it in web.xml in the WAR file.

Does anyone have a clue what might be wrong with our setup?

I will happily provide more detailed logs and/or configuration files if 
needed.

Regards,


Mateusz Kijowski