Hi,
I'm using Spring/Hibernate in a WSAD envirionment and have attempted
avail the utilities in Spring to do the jndi lookup etc for me given a jindi configuration.
I'm having difficulty obtaining the refence to a bean held in an xml config file (WASAD classpath) in my application . This xml file is quite comprehensive and it should give Spring the details for an EJB I'm interested in invoking (jndi info etc). NB the application is standalone will run on the same machine but different JVM. Please help! Thanks!
The xml file is as follows (StockPrice is my EJB remote interface):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="StockPrice" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
<property name="jndiName">
<value>java:comp/env/ejb/StockPrice
</value>
</property>
<property name="businessInterface">
<value>com.stock.data.services.ejb.StockPrice
</value>
</property>
<property name="environment">
<props>
<!-- provide WebSphere AppServer 5.1 environment properties here -->
<prop key="java.naming.factory.initial">com.ibm.webspher e.naming.WsnInitialContextFactory</prop>
<prop key="java.naming.provider.url">iiop://localhost:1234/</prop>
</props>
</property>
</bean>
</beans>
In my application I have the following code which should return
the desired bean as an object to the calling program (for casting to the
EJB StockPrice) :
NB serviceName = "StockPrice".
protected Object getService(String serviceName) throws BeansException {
Object instObject=null;
try
{
instObject = this.getAppCtx().getBeanFactory().getBean(serviceN ame);
}
catch (BeansException e)
{
} catch (NullPointerException e) {
} catch (Exception e)
{
}
return instObject;
}
However the above code gives me a null pointer exception.
java.lang.NullPointerException
at com.stock.data.services.source.getService(Abstract Mace.java:70)
NB port number for WAS above is noddy.


Reply With Quote