Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001603 [Resin] minor always 02-05-07 11:29 05-01-07 14:40
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.2 Product Version
  Product Build
Summary 0001603: JNDI lookup with spring
Description (rep by aadi deshpande)

On Resin 3.022 ( running on a Java 1.5 install on a Solaris 10 Sparc
environment ), I'm encountering a strange error when attempting to look up a
datasource in JNDI via Spring's JNDIObjectFactoryBean.

My database is set up like so :

        <database>
          <jndi-name>jdbc/ds</jndi-name>
          <driver type="oracle.jdbc.pool.OracleConnectionPoolDataSource">
            <url>jdbc:oracle:thin:@devdb01.myco.com:1521:DEV</url>
            <user>scott</user>
            <password>tiger</password>
           </driver>
           <prepared-statement-cache-size>8</prepared-statement-cache-size>
           <max-connections>20</max-connections>
           <max-idle-time>30s</max-idle-time>
         </database>

In my application context, i have :

       <bean id="dataSource"
                class="org.springframework.jndi.JndiObjectFactoryBean">^
               <property name="resourceRef" value="true"/>
                <property name="jndiName" value="jdbc/ds" />
        </bean>

When starting up my application, I get a NameNotFoundException, thrown by
ContextImpl :

[13:49:56.316] WebApp[http://localhost:9000/app] [^] initializing
[13:49:56.345] creating JNDI java: model for
EnvironmentClassLoader$13599389[web-app:http://localhost:9000/app] [^]
parent:EnvironmentClassLoader$32380043[host:
http://localhost:9000] [^]
[13:49:56.346] JNDI lookup `java:comp/env/caucho/auth' exception
javax.naming.NameNotFoundException: java:comp/env/caucho/auth
[13:49:56.346] javax.naming.NameNotFoundException: java:comp/env/caucho/auth
[13:49:56.347] WebApp[http://localhost:9000/app] [^] initialized
[13:49:56.348] WebApp[http://localhost:9000/app] [^] starting
[13:49:56.426] real-path / -> /opt/resin/webapps/app/
[13:49:56.428] Set web app root system property: 'webapp.root' =
[/opt/resin/webapps/app/]
[13:49:56.449] Initializing Log4J from [classpath:log4j.properties]
[13:49:58.599] Loading Spring root WebApplicationContext
[13:50:00.316] real-path /WEB-INF/application-context.xml ->
/opt/resin/webapps/app/WEB-INF/application-context.xml
[13:50:03.548] JNDI lookup `java:comp/env/jdbc/ds' ->
DBPool[java:comp/env/jdbc/ds]
[13:50:05.843] JNDI lookup `java:/comp/env/jdbc/ds' exception
javax.naming.NameNotFoundException: java:/comp/env/jdbc/ds


Note that the 'java:comp/env/jdbc/ds' is changed to 'java:/comp/env/jdbc/ds'
( leading slash before 'comp' ).
which causes the lookup to fail.

I've checked the Spring source code and it seems to be making the lookup
fine, generating the correct name.

Moreover, when i specify the jndi-name of the datasource to be
"java:/comp/env/jdbc/ds" and the jndiName in my application context file to
be 'java:/comp/env/jdbc/ds", then it works fine.

However, any combination of specifying "jdbc/ds" or "java:comp/env/jdbc/ds"
as my jndi-name and the explicit path ( "java:comp/env/jdbc/ds" ) or the
base path ( "jdbc/ds" ) with resourceRef=true, it fails with the
abovementioned error.

the normal convention of specifying "jdbc/ds" with resourceRef=true or the
full name "java:comp/env/jdbc/ds" in jndiName works just fine with other
containers that I've attempted this test on, including Tomcat and Jetty.

Have I encountered a bug or am I too obtuse to be witness to my own
stupidity?

Thanks for any help you can provide,
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0001980)
ferg
05-01-07 14:40

server/158i
 

- Issue History
Date Modified Username Field Change
02-05-07 11:29 ferg New Issue
05-01-07 14:40 ferg Note Added: 0001980
05-01-07 14:40 ferg Assigned To  => ferg
05-01-07 14:40 ferg Status new => closed
05-01-07 14:40 ferg Resolution open => fixed
05-01-07 14:40 ferg Fixed in Version  => 3.1.2
03-25-10 13:39 leaosou Issue Monitored: leaosou
03-25-10 13:41 leaosou Issue End Monitor: leaosou


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker