IntelliJ Java IDE
The moose likes Other Application Frameworks and the fly likes JNDI Lookup of Datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "JNDI Lookup of Datasource" Watch "JNDI Lookup of Datasource" New topic
Author

JNDI Lookup of Datasource

Edmund Yong
Ranch Hand

Joined: Nov 16, 2003
Posts: 164
We have a datasource called DBPool defined in a WebLogic server. On the same server, we want to run a stand-alone program to access the same datasource. The stand-alone program uses Spring/Hibernate for the database access. In this stand-alone program, we defined the following:

<bean id="MyDBPool" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef">
<value>true</value>
</property>
<property name="jndiName">
<value>DBPool</value>
</property>
</bean>

When this stand-alone program runs, it will fail in the JNDI lookup. In general, is it possible for a stand-alone program to do a JNDI lookup for a datasource defined in a WebLogic server?

Thanks.


SCJP 1.2, SCWCD 1.4
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 93
Is this standalone program able to lookup any other JNDI resources?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You are running this application outside the context of WebLogic right? So you need to provide addtional information for Spring to do the JNDI lookup... like where to look for the WebLogic Server.



The username/password properties would only be required if you are accessing a resource that is secured in WebLogic... in other words it depends on your particular configuration.
 
IntelliJ Java IDE
 
subject: JNDI Lookup of Datasource
 
Threads others viewed
configure "private" datasource
Set DB username/password dynamically
Spring Question: How to realize IOC in stand alone programs?
Unique issue with Spring-WebServices-JDBC
What's wrong with my spring config?
developer file tools