I'm trying to subclass LocalStatelessSessionProxyFactoryBean
in order to override the invoke
method.
There is a client side accessing services via http invoker mechanism, and i need to unwrap all EJBExceptions because the client doesn't have the class. I've unsuccessfully tried with spring AOP too.
I have the constraints that all exceptions raised to the client are runtimes, and i can't annotate all exceptions with @ApplicationException. (if this annotation were inherited, that would have been a good solution for me)
My spring config looks is :
<bean name="/TestService" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter" >
<property name="service" ref="testServiceEJB" />
<property name="serviceInterface" value="package.shared.services.ITestService" />
</bean>
<bean name="testServiceEJB" class="package.framework.server.spring.LocalStatelessSessionProxyFactoryBean" >
<property name="jndiName" value="framework/TestServiceImpl/local"/>
<property name="businessInterface" value="package.shared.services.ITestService"/>
</bean>
My problem is when starting jboss, it tells me
[org.springframework.web.context.ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/TestService' defined in ServletContext resource [/WEB-INF/service-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Service interface [package.framework.shared.services.ITestService] needs to be implemented by service [package.framework.server.spring.LocalStatelessSessionProxyFactoryBean@133c8e5] of class [package.framework.server.spring.LocalStatelessSessionProxyFactoryBean]
I don't have this error when using the tag jee:local-slsb
or declare the bean with class LocalStatelessSessionProxyFactoryBean
.
When debugging, the proxying is not made where it should happened, and a check fails :
at org.springframework.remoting.support.RemoteExporter.checkServiceInterface(RemoteExporter.java:136)
at org.springframework.remoting.support.RemoteExporter.getProxyForService(RemoteExporter.java:155)
at org.springframework.remoting.rmi.RemoteInvocationSerializingExporter.prepare(RemoteInvocationSerializingExporter.java:88)
at org.springframework.remoting.rmi.RemoteInvocationSerializingExporter.afterPropertiesSet(RemoteInvocationSerializingExporter.java:81)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
Thanks for helping