tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: How to access JNDI resources on Tomcat level
Date Mon, 30 Nov 2009 16:24:38 GMT
On 30/11/2009 13:46, vramanaj wrote:
>
> Hi,
>
> I am facing problem with configuring JNDI DataSources for Josso project in
> Tomcat 6. Getting the following errors in tomcat log when i am trying to
> access the application. Defined resource in
> conf/Catalina/localhost/webapp.xml. And res-reference in the application's
> web.xml.
>
> Nov 30, 2009 7:48:52 AM
> org.josso.gateway.identity.service.store.db.DataSourceIdentityStore
> getDataSource
> SEVERE: Error during DB connection lookup
> javax.naming.NameNotFoundException: Name DefaultDS is not bound in this
> Context
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>
> Steps Followed:
> 1. Defined DataSource within GlobalNamingResources
>             <Resource name="/DefaultDS"

Try using "jdbc/DefaultDS".  I don't believe you're allowed to start the 
name with a / character.

>             auth="Container"
>             type="javax.sql.DataSource"
>             description="SSO DataSource"
>             username="josso"
>             password="josso"
>             driverClassName="oracle.jdbc.OracleDriver"
>             url="jdbc:oracle:thin:@md1npddev10:1521:jdaj"
>             factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
>             maxActive="8"
>             maxIdle="4"/>
>
> 2. Added res-reference in web.xml
> 3. Defined resource in conf/Catalina/localhost/webapp.xml

If you've defined it in the global resources, you don't need to redefine 
it here, just use:

   <ResourceLink
     global="jdbc/DefaultDS"
     name="jdbc/DefaultDS"
     type="javax.sql.DataSource"/>


p

>             <Resource name="/DefaultDS"
>             auth="Container"
>             type="javax.sql.DataSource"
>             description="SSO DataSource"
>             username="josso"
>             password="josso"
>             driverClassName="oracle.jdbc.OracleDriver"
>             url="jdbc:oracle:thin:@md1npddev10:1521:jdaj"
>             factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
>             maxActive="8"
>             maxIdle="4"/>
>
> 4. In josso-gateway-db-stores.xml
>     <db-istore:datasource-store id="josso-identity-store"
>                       dsJndiName="java:comp/env/DefaultDS"
>                       userQueryString="SELECT NAME FROM JOSSO_USER WHERE
> LOGIN = ?"
>                       rolesQueryString="SELECT ROLE FROM JOSSO_USER_ROLE
> WHERE LOGIN = ?;"
>                       credentialsQueryString="SELECT LOGIN AS USERNAME,
> PASSWORD FROM JOSSO_USER WHERE LOGIN = ?"
>                       userPropertiesQueryString="SELECT NAME, VALUE FROM
> JOSSO_USER_PROPERTY WHERE LOGIN = ?"
>                       resetCredentialDml="UPDATE JOSSO_USER SET PASSWORD = ?
> WHERE LOGIN = ?"
>                       relayCredentialQueryString="SELECT LOGIN FROM
> JOSSO_USER WHERE #?# = ?" />
>
> 5. When i try to access the example partner application (/partner), getting
> the following error:
>             Error : Error During Lookup Name DefaultDS is not bound in this
> Context
>
> I am using Josso 1.8.0 with tomcat 6.0.18.
>
> Please help me out to proceed further. Quick response is highly appreciable.
>
> Thanks in Advance.
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> Mikolaj Rydzewski-2 wrote:
>>
>> Mikolaj Rydzewski wrote:
>>> Now, I want to setup Josso single sign on system (www.josso.org) and
>>> force it to use JNDI DataSources as well. With no luck.
>> Here's the solution for anyone interested (addition to typical josso
>> setup):
>>
>>      * define DataSource within GlobalNamingResources (e.g. jdbc/users)
>>      * add JNDI support to josso webapp (e.g. and ResourceLink to
>>        META-INF/context.xml and resource-ref to WEB-INF/web.xml)
>>      * reference DataSource from josso-gateway-config.xml using
>>        java:comp/env/jdbc/users as its JNDI name
>>
>> Enjoy ;-)
>>
>> --
>> Mikolaj Rydzewski<miki@ceti.pl>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
> Quoted from:
> http://old.nabble.com/How-to-access-JNDI-resources-on-Tomcat-level-tp19672443p19689928.html
>
> Mikolaj Rydzewski-2 wrote:
>>
>> Christopher Schultz wrote:
>>>>     * add JNDI support to josso webapp (e.g. and ResourceLink to
>>>>       META-INF/context.xml and resource-ref to WEB-INF/web.xml)
>>>>
>>>
>>> Note that this is not required for Realms. See
>>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Context+versus+GlobalNamingResources
>>>
>> I'm exposing DataSource to josso webapp, not the Realm. So I need this.
>> Lack of such configuration was causing my initial problems.
>>
>> --
>> Mikolaj Rydzewski<miki@ceti.pl>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message