tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <>
Subject Re: datasource-realm troubles
Date Mon, 29 Jan 2007 16:10:59 GMT
I would guess from the outset that your "Context.xml" file isn't being
used.  Where are your putting it and what are you naming it?  What's the
name of your webapp when deployed?

Quick checks:

1. It has to be named to match your webapp if your are storing it in
Catalina/localhost and deploying an expanded webapp.  If the webapp is
named fubar, then the file should be named fubar.xml.

2. If deploying a .war file, it has to be named context.xml (note: case
is important) and stored in the war files META-INF directory.


Walter, Oliver (BR/ICI3) wrote:

>i have some trouble using a datasource realm in tomcat 5.5.20, jdk
>In META-INF/Context.xml i defined a datasource:
><Resource name="jdbc/mangos" auth="Container"
>		type="javax.sql.DataSource" maxActive="10" maxIdle="2"
>		username="" password=""
>		driverClassName="com.mysql.jdbc.Driver"
>url="jdbc:mysql://localhost:3306/realmd?autoReconnect=true" />
>and in web.xml a resource reference:
>	<description>DB Connection</description>
>	<res-ref-name>jdbc/mangos</res-ref-name>
>	<res-type>javax.sql.DataSource</res-type>
>	<res-auth>Container</res-auth>
>With hibernate everything works fine, no problems, but if i define a
>datasource realm in Context.xml
><Realm className="org.apache.catalina.realm.DataSourceRealm" debug="4"
>		dataSourceName="jdbc/mangos"
>		userTable=... />
>it can`t find the resource name:
>javax.naming.NameNotFoundException: Name jdbc is not bound in this
>	at
>	at
>	at
>	at
>	...
>I tried already the following namings, jdbc/mangos,
>java:comp/env/jdbc/mangos, mangos, java:/comp/env/jdbc/mangos
>with no luck.
>I can workaround this issue, when defining the resource in server.xml
>and create a <ResourceLink name="jdbc/mangos" global="jdbc/mangos"
>type="javax.sql.DataSource" />
>in Context.xml, but i would prefer, doing Realm and Datasource
>definition together in Context.xml.
>The second issue i run into is programming my webapp against the realm
>interface. I want to built
>up the Navigation Panel dynamically based on the users asigned roles,
>but when i try to access
>GenericPrincipal i get "java.lang.NoClassDefFoundError:
>I also can workaround this issue by copying the catalina into my
>webapp`s classpath (WEB-INF/lib/),
>but i`m pretty this is not correct.
>I would be appreciate for any help.
>Regards Oliver
>To start a new topic, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message