Hello,

i have some trouble using a datasource realm in tomcat 5.5.20, jdk
1.5.0_09.

In META-INF/Context.xml i defined a datasource:

<Resource name="jdbc/mangos" auth="Container"
                type="javax.sql.DataSource" maxActive="10" maxIdle="2"
maxWait="10000"
                username="" password=""
                driverClassName="com.mysql.jdbc.Driver"
        
url="jdbc:mysql://localhost:3306/realmd?autoReconnect=true" />

and in web.xml a resource reference:

<resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/mangos</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
</resource-ref>

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
Context
        at
org.apache.naming.NamingContext.lookup(NamingContext.java:769)
        at
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
        at
org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:401)
        at
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.j
ava:282)
        ...

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
<GlobalNamingResources>
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:
org/apache/catalina/realm/GenericPrincipal".

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: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to