Hello David,
thanks for the reply. We are talking about your 2. description.
The file is named "context.xml" and it is stored in the war`s META-INF
directory.
The full error output is:
106627 [http-8080-Processor24] DEBUG com.jmangos.beans.LoginBean - Validating given password.
106627 [http-8080-Processor24] DEBUG com.jmangos.persistance.hibernate.AccountDAO - finding Account instance with property: username, value: test7
106827 [http-8080-Processor24] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/jmangos] - Exception performing authentication
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.java:282)
at
org.apache.catalina.authenticator.FormAuthenticator.authenticate (
FormAuthenticator.java:257)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke (
AuthenticatorBase.java:416)
at
org.apache.catalina.core.StandardHostValve.invoke (
StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke (
ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke (
StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service (
CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process (
Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket (
PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt (
LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at
java.lang.Thread.run (
Thread.java:595)
As you can see in the second line:
106627 [http-8080-Processor24] DEBUG com.jmangos.persistance.hibernate.AccountDAO - finding Account instance with property: username, value: test7
Hibernate is working well using the same datasource.
My full context.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/jmangos" docBase="jmangos" debug="5" reloadable="true"
crossContext="false">
<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" />
<Realm className="
org.apache.catalina.realm.DataSourceRealm" debug="4"
dataSourceName="jdbc/mangos"
userTable="account"
userNameCol="username"
userCredCol="password"
userRoleTable="account"
roleNameCol="gmlevel" />
</Context>
regards Oliver
> -----Ursprüngliche Nachricht-----
> Von: David Smith [mailto:dns4@(protected)]
> Gesendet: Montag, 29. Januar 2007 17:11
> An: Tomcat Users List
> Betreff: Re: datasource-realm troubles
>
> 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.
>
>
> --David
>
> Walter, Oliver (BR/ICI3) wrote:
>
> >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(DataSourceReal
> m.java:401)
> > at
> >
org.apache.catalina.realm.DataSourceRealm.authenticate(DataSo
> urceRealm.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@(protected)
> >To unsubscribe, e-mail: users-unsubscribe@(protected)
> >For additional commands, e-mail: users-help@(protected)
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@(protected)
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)