Announcement Announcement Module
Collapse
No announcement yet.
Problem using AOP on a proxy for a Stateless Session Bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem using AOP on a proxy for a Stateless Session Bean

    A while ago, Spring AOP convinced me of being a very usefull aspect oriented framework, but I'm having a problem in one specific case:

    Scheme:
    Weblogic -- (creates webservice and delegates methods to) --> Pojo webservice -- (delegates methods to SLSB) --> Stateless session bean (aka SLSB) -- (Starts Transaction, delegates methods to service) --> service (spring bean)

    The pojo webservice can't be a spring bean, because it's instanciated by weblogic (itīs a soap webservice). All our logging is done through aspects, catching the severe exceptions in a gracefull way. As the pojo webservice interacts with the SLSB, it has to be able to handle RemoteInterface Exceptions (and create ex.).

    One graceway to solve this problem is to add another layer between weblogic and the pojo webservice. This would make weblogic happy (it can create the layer in between as webservice), and would allow me to make a spring bean of the pojo webservice. The problem is our architecture already has too many layers, adding yet another one would mean one single method call from outside would be delegated an excessive amount of times before it hits the bussiness logic.

    A cleaner solution would be to use a springed proxybean between the pojo webservice and the SLSB. AOP could be used to catch the remoteinterfaceex. on the proxy, and my code would still be clean.

    Making the proxy between the webservice pojo and the SLSB is not a problem, but I'm getting a cryptic exception while deploying if I add AOP logging on the proxy:

    Code:
    EJB Exception: : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundProvisioningGatewaySLSB' defined in class path resource [applicationContextAop.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
         [java] ; nested exception is: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundProvisioningGatewaySLSB' defined in class path resource [applicationContextAop.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null - with nested exception:
         [java] [javax.ejb.EJBException: EJB Exception: : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundProvisioningGatewaySLSB' defined in class path resource [applicationContextAop.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
         [java] ; nested exception is: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inboundProvisioningGatewaySLSB' defined in class path resource [applicationContextAop.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null]
    This is my applicationcontext config:

    The proxy between the webservice and the stateless session bean:
    <bean id="inboundProvisioningGatewaySLSB" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyTargetClass"><value>true</value></property>
    <property name="target">
    <bean class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
    <property name="businessInterface">
    <value>myPackage.myInterface</value>
    </property>
    <property name="jndiName">
    <value>ejb/my.jndiname</value>
    </property>
    <property name="jndiTemplate">
    <ref bean="jndi"/>
    </property>
    </bean>
    </property>
    <property name="interceptorNames">
    <list>
    <value>loggingThrowsAdvice</value>
    </list>
    </property>
    </bean>

    jndi bean:
    <bean id="jndi" class="myPackage.JndiTemplate">
    <constructor-arg index="0"><value>t3://localhost:7001</value></constructor-arg>
    <constructor-arg index="1"><value>weblogic.jndi.WLInitialContextFac tory</value></constructor-arg>
    <constructor-arg index="2"><value>user</value></constructor-arg>
    <constructor-arg index="3"><value>psswd</value></constructor-arg>
    </bean>

    The AOP loggin class for exceptions:
    <bean id="loggingThrowsAdvice" class="myPackage.LoggingThrowsAdvice"/>


    Removing the SLSB and replacing it with springed beans and spring JTA is a good solution too, but it would require to much time.

    Can anyone offer any advice on how to solve this problem?
Working...
X