You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@continuum.apache.org by Dan Kigelman <dk...@gmail.com> on 2008/03/09 02:45:45 UTC
Problems configuring JNDI on tomcat (META-INF/context.xml)
Hello!
I was going through the installation instructions for continuum (
http://maven.apache.org/continuum/docs/1.1/installation/tomcat.html#Defining_JNDI_Resources)
and failing for both tomcat 6.x and 5.x.
The error message I was most often having was: "
javax.jdo.JDODataStoreException: Failed initialising database. Please check
that your database JDBC driver is accessible, and the database URL and
username/password are correct. Exception : Cannot create JDBC driver of
class '' for connect URL 'null'"
(As I understand it, the JNDI context not being configured correctly, the
url and driver strings had no values.)
The configuration that finally worked for me was technique #2 for tomcat
5.5.26:
"Creating a $CATALINA_HOME/conf/Catalina/localhost/continuum.xml containing
a <Context> element."
I am still not able to get this to work using technique #1: "Creating a
$CATALINA_HOME/webapps/continuum/META-INF/context.xml containing a <Context>
element." Since this is the most recommended technique, I wanted to get
this to work, especially since I can't find a conf/Catalina/localhost for
tomcat 6.
My context.xml file looks like this:
<Context path="/continuum-webapp-1.1"
docBase="continuum-webapp-1.1">
<Resource name="jdbc/users"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:database/users;create=true" />
<Resource name="jdbc/continuum"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:database/continuum;create=true" />
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"/>
</Context>
Any ideas on what I may be doing wrong?
Much thanks,
-- Dan
Re: Problems configuring JNDI on tomcat (META-INF/context.xml)
Posted by Dan Kigelman <dk...@gmail.com>.
I got it to work! The problem was that the context.xml had to be inside the
.war. (after pasting the context.xml to META-INF, I had to `jar -cf
continuum-webapp-1.1.war -C continuum-webapp-1.1 .`)
The context.xml I used was:
<Context>
<Resource name="jdbc/users"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:database/users;create=true" />
<Resource name="jdbc/continuum"
auth="Container"
type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:database/continuum;create=true" />
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"/>
</Context>
However, I also got it to work using <Context path="/some-erraneous-value"
docBase="some-other-erraneous-value">. As far as I understand, path and
docBase are ignored when they're read from META-INF.
Is this really the most recommended way of setting JNDI? Putting the
context.xml into META-INF and re-packaging the .war?
Thank you,
-- Dan
On Sat, Mar 8, 2008 at 7:45 PM, Dan Kigelman <dk...@gmail.com> wrote:
> Hello!
>
> I was going through the installation instructions for continuum (
> http://maven.apache.org/continuum/docs/1.1/installation/tomcat.html#Defining_JNDI_Resources)
> and failing for both tomcat 6.x and 5.x.
>
> The error message I was most often having was: "
> javax.jdo.JDODataStoreException: Failed initialising database. Please
> check that your database JDBC driver is accessible, and the database URL and
> username/password are correct. Exception : Cannot create JDBC driver of
> class '' for connect URL 'null'"
>
> (As I understand it, the JNDI context not being configured correctly, the
> url and driver strings had no values.)
>
>
> The configuration that finally worked for me was technique #2 for tomcat
> 5.5.26:
> "Creating a $CATALINA_HOME/conf/Catalina/localhost/continuum.xml
> containing a <Context> element."
>
>
>
> I am still not able to get this to work using technique #1: "Creating a
> $CATALINA_HOME/webapps/continuum/META-INF/context.xml containing a <Context>
> element." Since this is the most recommended technique, I wanted to get
> this to work, especially since I can't find a conf/Catalina/localhost for
> tomcat 6.
>
> My context.xml file looks like this:
>
> <Context path="/continuum-webapp-1.1"
> docBase="continuum-webapp-1.1">
>
> <Resource name="jdbc/users"
> auth="Container"
> type="javax.sql.DataSource"
> username="sa"
> password=""
> driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
> url="jdbc:derby:database/users;create=true" />
>
> <Resource name="jdbc/continuum"
> auth="Container"
> type="javax.sql.DataSource"
> username="sa"
> password=""
> driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
> url="jdbc:derby:database/continuum;create=true" />
>
> <Resource name="mail/Session"
> auth="Container"
> type="javax.mail.Session"
> mail.smtp.host="localhost"/>
> </Context>
>
>
> Any ideas on what I may be doing wrong?
>
> Much thanks,
>
> -- Dan
>