You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2007/02/06 21:03:20 UTC
context placement
I am trying to use tomcat 5.5 for the first time - having just moved
from tomcat5.
I am getting symptoms (I think) of my JDNI resource having not been set
up properly
In particular, I have NO contexts in my $CATALINA_HOME/conf/server.xml,
since I want to bring these in in my webapps .war file.
So in the .war file for my app I have a META-INF/context.xml file with
the following in (apart from the password which I have changed)
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="usermgr" path="/usermgr">
<Resource name ="jdbc/usermgr" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://127.0.0.1:5432/users"
username="tomcat" password="x"
maxActive="20" maxIdle="10" maxWait="-1" />
</Context>
and my application attempts to connect to the JDNI resource
java:/comp/env/jdbc/usermgr
But when I run it, I get the following in the error message
Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'
I am interpreting this as the JDNI resource has not been recognised.
Do I have the right interpretation?
Have I misunderstood how tomcat can find the contexts?
--
Alan Chandler
http://www.chandlerfamily.org.uk
---------------------------------------------------------------------
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
[SOLVED] Re: context placement
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Tuesday 06 February 2007 20:46, Alan Chandler wrote:
> On Tuesday 06 February 2007 20:34, Pid wrote:
> > Alan Chandler wrote:
> > > On Tuesday 06 February 2007 20:03, Alan Chandler wrote:
> > >> I am getting symptoms (I think) of my JDNI resource having not
> > >> been set up properly
...
> > for:
> > %tomcat_home%/webapps/appname1.war
> >
> > the context xml file should deploy to:
> > %tomcat_home%/conf/Catalina/localhost/appname1.xml
>
> When you say this, are you saying that tomcat automatically copies
> from the the META-INF/context.xml file in the .war file to that
> location
>
Answer yes - but only if it has permissions.
I think this is a debian problem in that Catalina directory is owned by
root with 755 access rights.
--
Alan Chandler
http://www.chandlerfamily.org.uk
---------------------------------------------------------------------
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: context placement
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Tuesday 06 February 2007 20:34, Pid wrote:
> Alan Chandler wrote:
> > On Tuesday 06 February 2007 20:03, Alan Chandler wrote:
> >> I am getting symptoms (I think) of my JDNI resource having not
> >> been set up properly
> Context first:
Yeh just took that out as per suggestion further up thread
>
> you don't need to specify the /path.
> the path to the webapp is determined from the name of the deployed
> .war or the name of the context.xml file.
>
> for:
> %tomcat_home%/webapps/appname1.war
>
> the context xml file should deploy to:
> %tomcat_home%/conf/Catalina/localhost/appname1.xml
When you say this, are you saying that tomcat automatically copies from
the the META-INF/context.xml file in the .war file to that location
(in my case that would
be /var/lib/tomcat5.5/conf/Catalina/appserv.home/usermgr.xml because my
host is appserv.home)
BUT
I only have an EMPTY localhost directory in
the /var/lib/tomcat5.5/conf/Catalina directory and
no appserv.home directory at all.
--
Alan Chandler
http://www.chandlerfamily.org.uk
---------------------------------------------------------------------
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: context placement
Posted by Pid <p...@pidster.com>.
Alan Chandler wrote:
> On Tuesday 06 February 2007 20:03, Alan Chandler wrote:
>> I am getting symptoms (I think) of my JDNI resource having not been
>> set up properly
>
> I forgot to say that I have this working under eclipse on a development
> system, but it seems (as part of the Web App plugin) to copy the
> contents of context.xml into server.xml
>
> My reading of the docs of tomcat5.5 is that I don't need to do this (nor
> to Catalina/ENGINE_NAME/HOST_NAME/usermgr.xml)
>
>
Context first:
you don't need to specify the /path.
the path to the webapp is determined from the name of the deployed .war
or the name of the context.xml file.
for:
%tomcat_home%/webapps/appname1.war
the context xml file should deploy to:
%tomcat_home%/conf/Catalina/localhost/appname1.xml
I posted last week a sample JNDI config which defines the DB globally,
but ought to work with a tweak or two:
http://mail-archives.apache.org/mod_mbox/tomcat-users/200702.mbox/%3c45C30808.6090304@pidster.com%3e
p
---------------------------------------------------------------------
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: context placement
Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Tuesday 06 February 2007 20:03, Alan Chandler wrote:
>
> I am getting symptoms (I think) of my JDNI resource having not been
> set up properly
I forgot to say that I have this working under eclipse on a development
system, but it seems (as part of the Web App plugin) to copy the
contents of context.xml into server.xml
My reading of the docs of tomcat5.5 is that I don't need to do this (nor
to Catalina/ENGINE_NAME/HOST_NAME/usermgr.xml)
--
Alan Chandler
http://www.chandlerfamily.org.uk
---------------------------------------------------------------------
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: context placement
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alan,
Alan Chandler wrote:
> In particular, I have NO contexts in my $CATALINA_HOME/conf/server.xml,
> since I want to bring these in in my webapps .war file.
Good.
> So in the .war file for my app I have a META-INF/context.xml file with
> the following in (apart from the password which I have changed)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context docBase="usermgr" path="/usermgr">
Get rid of "docBase" and "path". I believe they are illegal in a
context.xml file, since the server has already determined where your
application is and to what URL it will be deployed. It is rumored to be
"bad" to set these attributes in context.xml. It might even cause Tomcat
to double-deploy (or worse, double-deploy on top of each other) your
webapp and cause great confusion.
> <Resource name ="jdbc/usermgr" auth="Container"
> type="javax.sql.DataSource"
> driverClassName="org.postgresql.Driver"
> url="jdbc:postgresql://127.0.0.1:5432/users"
> username="tomcat" password="x"
> maxActive="20" maxIdle="10" maxWait="-1" />
> </Context>
The rest of this looks good, and matches the configuration I use for my
webapps.
> Cause: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC
> driver of class '' for connect URL 'null'
Yup, this is going to be a subtle configuration error. Make the changes
I suggested above and see if that helps. If not, do a quick search in
the archives for "cannot create jdbc driver null": this question comes
up occasionally.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFyOGJ9CaO5/Lv0PARAploAJ4iTOetTTXFx1Vm1u7qH6JoZGlypACfYB34
X5BU6cSfeJxgEj3pIKFf7Ts=
=t4Qy
-----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