i need to use business delegate pattern in my client class so that client dont need to catch remote exception. now problem is spring throws the exception. every thing goes good when i use local interface, but remote interface causing problem.
please inspect the code below.
Exception is:
Remote interface:Code:org.springframework.remoting.RemoteLookupFailureException: EJB instance [echoService:Stateless] is not a Remote Stateless Session Bean at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:207) at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:108) at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:74) at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy68.echo(Unknown Source)
local interface:Code:public interface EchoServiceSession extends javax.ejb.EJBObject{ public String echo(String message) throws java.rmi.RemoteException; }
business interface:Code:public interface EchoServiceLocal extends EchoService, EJBLocalObject { }
EJB class:Code:public interface EchoService { public String echo(String message); }
web layer applicationContext.xml is:Code:public class EchoServiceEJB extends AbstractStatelessSessionBean implements EchoService { private static final String BEAN_NAME = "echoService"; private EchoService service; protected void onEjbCreate() throws CreateException { service = (EchoService) getBeanFactory().getBean(BEAN_NAME); } public String echo(String message) { return service.echo(message); } }
ejb-jar.xml:Code:<bean id="EchoService" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean" lazy-init="true"> <property name="jndiName"> <value>echoService</value> </property> <property name="businessInterface"> <value>com.test.echo.EchoService</value> </property> <property name="homeInterface"> <value>com.test.echo.EchoServiceSessionHome</value> </property> </bean>
Thanks for the help.Code:<session> <description>Echo Service Bean</description> <ejb-name>EchoServiceEJB</ejb-name> <home>com.test.echo.EchoServiceSessionHome</home> <remote>com.test.echo.EchoServiceSession</remote> <local-home>com.test.echo.EchoServiceHome</local-home> <local>com.test.echo.EchoServiceLocal</local> <ejb-class>com.test.echo.EchoServiceEJB</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <env-entry> <env-entry-name>ejb/BeanFactoryPath</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>applicationContext.xml</env-entry-value> </env-entry> </session>


Reply With Quote