tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berner Martin <Martin.Ber...@qualitasag.ch>
Subject AW: DataSourceRealm and resource.xml
Date Fri, 26 Oct 2012 12:06:22 GMT
Thanks. I got it to work:
But dataSourceName was little bit different from your sugestion: dataSourceName="openejb/Resource/jdbc/sheeprealm"
And I had set Datasource as local: localDataSource="true"

In resource.xml:
----------------
  <Resource id="jdbc/sheeprealm" type="DataSource">
      DataSourceCreator                tomcat
      JtaManaged                       false
      JdbcDriver                       oracle.jdbc.driver.OracleDriver
      JdbcUrl                          ${ch.qual.database.ar01.url}
      UserName                         <DB_USER>
      Password                         <DB_PWD>
      ConnectionProperties             v$session.program=08_SchafeRealm;
      maxAge                           0
      initialSize                      ${ch.qual.database.ar01.poolsize}
      maxActive                        10
      maxIdle                          5
      MinIdle                          ${ch.qual.database.ar01.poolsize}
      maxWait                          30000
      validationQuery                  SELECT GESTHO.PA_ANI.nGetAniID('US 184087.2') FROM
DUAL
      testOnBorrow                     true
      testOnReturn                     true
      testWhileIdle                    false
      timeBetweenEvictionRunsMillis    -1
      numTestsPerEvictionRun           5
      minEvictableIdleTimeMillis       1800000
  </Resource>


In context.xml:
---------------
<Realm localDataSource="true" 
         className="org.apache.catalina.realm.DataSourceRealm" 
         dataSourceName="openejb/Resource/jdbc/sheeprealm" 
         digest="MD5" 
         roleNameCol="ROLE_NAME" 
         userCredCol="USER_PASS" 
         userNameCol="USER_NAME" 
         userRoleTable="GESTHO.VR_AUTH_USER_ROLES" 
         userTable="GESTHO.VR_AUTH_USER_PASSWORD"/>


Martin Berner

-----Ursprüngliche Nachricht-----
Von: José Luis Cetina [mailto:maxtorzito@gmail.com] 
Gesendet: Donnerstag, 25. Oktober 2012 18:22
An: users@openejb.apache.org
Betreff: Re: DataSourceRealm and resource.xml

You have to use:  "openejb:Resource/" + dataSourceName

2012/10/25 Romain Manni-Bucau <rmannibucau@gmail.com>

> Use java:openejb/Resource prefix i think
> Le 25 oct. 2012 14:50, "Berner Martin" <Martin.Berner@qualitasag.ch> a
> écrit :
>
> > Hi,
> > We use org.apache.catalina.realm.DataSourceRealm to authenticate and so
> on.
> >
> > The Realm is configured in META-INF/context.xml referencing a Datasource
> > by name:
> > <Realm className="org.apache.catalina.realm.DataSourceRealm"
> > dataSourceName="jdbc/sheeprealm" digest="MD5" roleNameCol="ROLE_NAME"
> > userCredCol="USER_PASS" userNameCol="USER_NAME"
> > userRoleTable="GESTHO.VR_AUTH_USER_ROLES"
> > userTable="GESTHO.VR_AUTH_USER_PASSWORD"/>
> >
> > The Datasource is configured in server.xml in GlobalNamingResources:
> > <Resource auth="Container"
> > connectionProperties="v$session.program=08_SchafeRealm;"
> > driverClassName="oracle.jdbc.OracleDriver" maxActive="20" maxIdle="10"
> > maxWait="-1" name="jdbc/sheeprealm" password="XXX"
> > type="javax.sql.DataSource" url="XXX" username="XXX"/>
> >
> > I'd like to do the resource definition in resources.xml to be able to use
> > Placeholders for DatabaseUrl. But if I move the declaration to
> resource.xml
> > the Realm dosen't find the Datasource.
> >
> > Okt 25, 2012 2:48:36 PM org.apache.catalina.realm.DataSourceRealm open
> > Schwerwiegend: Exception performing authentication
> > javax.naming.NameNotFoundException: Name [sheeprealm] is not bound in
> this
> > Context. Unable to find [sheeprealm].
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
> >         at
> > org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:394)
> >         at
> >
> org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:285)
> >         at
> >
> org.apache.catalina.realm.CombinedRealm.authenticate(CombinedRealm.java:146)
> >         at
> > org.apache.tomee.catalina.TomEERealm.authenticate(TomEERealm.java:43)
> >         at
> >
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:295)
> >         at
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:450)
> >         at
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> >         at
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> >         at
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
> >         at
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> >         at
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> >         at
> >
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
> >         at
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
> >         at
> >
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
> >         at
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> >         at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> >         at java.lang.Thread.run(Thread.java:722)
> >
> >
> > Is it possible, and how do I do that?
> >
> > Martin Berner
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Mime
View raw message