PDA

View Full Version : HttpInvoker and SLSB



afida
Jan 13th, 2005, 03:32 AM
This might have been answered somewhere but i just can't seem to find the solution.

I simply wnt to expose my SLSB through HttpInvoker so my rich client can access it. My app is packaged in ear.

ws.servlet

<!-- HttpInvoker exporter for the core service -->
<bean name="/rbacx-httpInvoker" class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service"><ref bean="core"/></property>
<property name="serviceInterface"><value>com.vaau.core.MainService</value></property>
</bean>

what i want to is have something like this

<bean id="core" lazy-init="true" class="org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean">
<property name="jndiName">
<value>local/coreSLSB</value>
</property>
<property name="businessInterface">
<value>com.vaau.core.MainService</value>
</property>
</bean>

I just not sure where to define this bean "core". I have tried declaring this into my aplicationContext.xml but when i executure my business method I get,


org.springframework.beans.FatalBeanException: Unable to return specified BeanFactory instance: factory key [java:comp/env/ejb/BeanFactoryPat
h], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tio
nException: No bean named 'java:comp/env/ejb/BeanFactoryPath' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFacto
ry defining beans []; root of BeanFactory hierarchy
org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'java:comp/env/ejb/BeanFactoryPath' is defined: org.springfra
mework.beans.factory.support.DefaultListableBeanFa ctory defining beans []; root of BeanFactory hierarchy
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:332)
at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedBeanDefinition(AbstractBeanFa ctory.java:672)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:207)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:496)
at org.springframework.beans.factory.access.Singleton BeanFactoryLocator.useBeanFactory(SingletonBeanFac toryLocator.java:387)
at org.springframework.ejb.support.AbstractEnterprise Bean.loadBeanFactory(AbstractEnterpriseBean.java:1 15)
at org.springframework.ejb.support.AbstractStatelessS essionBean.ejbCreate(AbstractStatelessSessionBean. java:63)

Please help me !!! I am going Nuts over this...

Amad
[/quote]

tentacle
Jan 13th, 2005, 03:53 AM
The problem appears to be caused by the fact the your SLSB extends AbstractStatelessSessionBean. You should only extends this class if you need to access a Spring application context in your SLBS. If you don't need that try overwriting the setSessionContext and ejbCreate methods like this:



public void setSessionContext&#40;SessionContext sessionContext&#41; &#123;
super.setSessionContext&#40;sessionContext&#41;;
setBeanFactoryLocator&#40;null&#41;;
&#125;

public void ejbCreate&#40;&#41; &#123;
onEjbCreate&#40;&#41;;
&#125;


If you do this make sure you don't call the getBeanFactory or you will get a NullPointerException. You may also consider to not extend AbstractStatelessSessionBean at all.

afida
Jan 13th, 2005, 04:14 AM
THanks, But i think i need to accesss the spring context as i have my business interface implmentation bean defined in context. Because slsb uses this delegate to get implementation.

Amad

tentacle
Jan 13th, 2005, 04:18 AM
I refer to another post I wrote today:

http://forum.springframework.org/showthread.php?t=12367&highlight=

If you're interested let me know.

afida
Jan 13th, 2005, 12:45 PM
If thats the only way to have a shared context between web app and ejb then yes i am very much interested.

Thanks

Amad

tentacle
Jan 13th, 2005, 04:11 PM
If thats the only way to have a shared context between web app and ejb then yes i am very much interested.

I'll get back to you when it's finished.