aspose file tools
The moose likes Spring and the fly likes ejb lookups in spring config Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "ejb lookups in spring config" Watch "ejb lookups in spring config" New topic
Author

ejb lookups in spring config

Billy Vandory
Ranch Hand

Joined: Mar 23, 2010
Posts: 57
Hi Folks, I'm trying to determine if the following is a good idea or bad idea: (This may be an EJB question)

In the ApplicationContext.xml :

First I get the JNDI properties for an EJB lookup

<bean id="jndiconfig" class="com.wakapeek.common.context.ConfigProperties">
<constructor-arg>
<value>/ejblookup.properties</value>
</constructor-arg>
</bean>

Then I pass those properties into the constructor of the InitialContext

<bean id="context" class="javax.naming.InitialContext" destroy-method="close">
<constructor-arg>
<ref bean="jndiconfig" />
</constructor-arg>
</bean>

Then I create the Stateless EJB

<bean id="categoryServiceBean" factory-bean="context" factory-method="lookup">
<constructor-arg>
<value>CategoryBeanRemote</value>
</constructor-arg>
</bean>

Then I inject the bean reference into a service object that will use the bean

<bean id="categoryManagerImpl" class="com.wakapeek.common.manager.impl.CategoryManagerImpl" scope="singleton">
<constructor-arg ref="categoryServiceBean"/>
</bean>


I was hoping this would cache the lookup and cache to the pool of stateless beans, instead of one particular instance of a stateless bean


Is the bean reference being cached or is a reference to the pool being cached? I want to make sure I am using the stateless bean pool provided by the app server.


Thanks alot,

Billy

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17234
    
    1

Or you could have the jee namespace used in your configuration and do

<jee:jndi-lookup id="myEjb" jndi-name="myJndiStringValueHere"/>

And Spring will do all the other work for you.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ejb lookups in spring config
 
Similar Threads
Could not initialize JBossWorkManagerTaskExecutor because JBoss API is not available: java.lang.refl
XML: multiple bean references - how to change them in one line?
Caching ejb 3 bean lookups
Need to Get a Specific JMS Queue from the objectPool ( GenericKeyedObjectPool )
java.lang.NoClassDefFoundError: java/util/concurrent/ConcurrentSkipListMap