Announcement Announcement Module
Collapse
No announcement yet.
WebLogic 11g and Spring beens injected into EJB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebLogic 11g and Spring beens injected into EJB

    All,

    I am getting an error injecting Spring managed beans into EJB's within WebLogic 11g. I am using an interceptor extending the SpringBeanAutowiringInterceptor to set the context name by overriding the getBeanFactoryLocatorKey method. This is configured within the ejb-jar.xml file as an interceptor-binding for all ejb's. The beanRefContext.xml is in the root of the ejb jar and on the class path.

    The application deploys however when I can the remote ejb interface the following error occurs. The remote interface and model passed on the method call are deployed within a ejb-client jar file that within both the ejb and web applications class path. The ejb and web app are deployed separately i.e. the web app is deployed as a war out with the ejb ear.

    Does anyone have an idea on what is causing this? I suspect it is something to do with the class loaders / classpath and where the Spring managed context is being loaded from. The Spring jars are deployed within the root of the ear and referenced within the Class-Path element of the manifest.

    Regards
    Neil

    Code:
    javax.ejb.EJBException: A error occurred the server; nested exception is: 
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** cannot unmarshaling throwable ; nested exception is: java.rmi.ServerError: A error occurred the server; nested exception is: 
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** cannot unmarshaling throwable 
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:112)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:91)
    at $Proxy212.validatePostcode(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy213.validatePostcode(Unknown Source)
    at sandpit.web.PostcodeValidationController.onSubmit(PostcodeValidationController.java:59)
    at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
    at org.springframework.web.servlet.mvc.CancellableFormController.processFormSubmission(CancellableFormController.java:140)
    at org.springframework.web.servlet.mvc.AbstractFormController.handleInvalidSubmit(AbstractFormController.java:671)
    at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:272)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.rmi.ServerError: A error occurred the server; nested exception is: 
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** cannot unmarshaling throwable 
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:220)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at sandpit.ejb.address.AddressEJB_vk8fj2_AddressEJBImpl_1031_WLStub.validatePostcode(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:73)
    ... 36 more
    Caused by: weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** cannot unmarshaling throwable 
    at weblogic.rmi.internal.ServerRequest.unmarshalThrowable(ServerRequest.java:357)
    at weblogic.rmi.internal.ServerRequest.getThrowable(ServerRequest.java:62)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:203)
    ... 44 more
    Caused by: java.io.InvalidClassException: org.springframework.beans.BeansException; local class incompatible: stream classdesc serialVersionUID = 5951866628951717299, local class serialVersionUID = -2725566157126749441
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)
    at weblogic.rmi.internal.ServerRequest.unmarshalThrowable(ServerRequest.java:352)
    ... 46 more
    Last edited by neila29; Aug 10th, 2009, 11:57 AM.

  • #2
    WebLogic 11g and Spring beens injected into EJB - Try this

    Hi, Error message seems that ,there is a problem in Marshalling and UnMarshalling ( Container encountered problem in Serializatiion and DeSerialization). So i suggest , your interceptor which extends SpringBeanAutowiringInterceptor should implement serializable interface.

    Ex:

    public class XXXInterceptor extends SpringBeanAutowiringInterceptor implements Serializable {

    private static final long serialVersionUID = 1L;

    ......
    ......



    }

    Hope this will resolve your problem. Please check

    Comment


    • #3
      The interceptor does not need to implement Serializable. The error is after this point when Spring is trying to auto wire the beans.

      Has anyone successfully deployed EJB's into WebLogic 11g that are auto wired with Spring beans using the SpringBeanAutowiringInterceptor?

      Regards
      Neil

      Comment


      • #4
        After some tinkering with this I am now getting a different error. I believe the error has changed as I am now deploying Spring 2.5.3 with my EJB. Does anyone have an idea on what is causing this?

        Code:
        
        Error 500--Internal Server Error
        
        javax.ejb.EJBException: EJB Exception: ; nested exception is: 
        	org.springframework.jee.interfaces.LifecycleCallbackException: Failure to invoke public void org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(javax.interceptor.InvocationContext) on bean class class sandpit.ejb.interceptor.SandpitSpringBeanAutowiringInterceptor_ei72e8_Impl with args: [com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata$LifecycleEventCallbackInvocationContext@bc6ac]; nested exception is: org.springframework.jee.interfaces.LifecycleCallbackException: Failure to invoke public void org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(javax.interceptor.InvocationContext) on bean class class sandpit.ejb.interceptor.SandpitSpringBeanAutowiringInterceptor_ei72e8_Impl with args: [com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata$LifecycleEventCallbackInvocationContext@bc6ac]
        	at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:109)
        	at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:91)
        	at $Proxy156.validatePostcode(Unknown Source)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        	at java.lang.reflect.Method.invoke(Method.java:597)
        	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
        	at $Proxy97.validatePostcode(Unknown Source)
        	at sandpit.web.PostcodeValidationController.onSubmit(PostcodeValidationController.java:56)
        	at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
        	at org.springframework.web.servlet.mvc.CancellableFormController.processFormSubmission(CancellableFormController.java:140)
        	at org.springframework.web.servlet.mvc.AbstractFormController.handleInvalidSubmit(AbstractFormController.java:671)
        	at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:272)
        	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
        	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
        	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
        	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
        	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:463)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
        	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        	at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
        	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
        	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
        	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
        	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
        	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
        Caused by: org.springframework.jee.interfaces.LifecycleCallbackException: Failure to invoke public void org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(javax.interceptor.InvocationContext) on bean class class sandpit.ejb.interceptor.SandpitSpringBeanAutowiringInterceptor_ei72e8_Impl with args: [com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata$LifecycleEventCallbackInvocationContext@bc6ac]
        	at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:335)
        	at com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata.invokeLifecycleMethods(InterceptionMetadata.java:580)
        	at com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata$AdvisorChainProxyControl.invokeLifecycleMethod(InterceptionMetadata.java:547)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        	at java.lang.reflect.Method.invoke(Method.java:597)
        	at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        	at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:106)
        	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        	at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        	at $Proxy157.invokeLifecycleMethod(Unknown Source)
        	at weblogic.ejb.container.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:196)
        	at weblogic.ejb.container.pool.StatelessSessionPool.getBean(StatelessSessionPool.java:121)
        	at weblogic.ejb.container.manager.StatelessManager.preInvoke(StatelessManager.java:148)
        	at weblogic.ejb.container.internal.BaseRemoteObject.preInvoke(BaseRemoteObject.java:227)
        	at weblogic.ejb.container.internal.StatelessRemoteObject.preInvoke(StatelessRemoteObject.java:52)
        	at sandpit.ejb.address.AddressEJB_vk8fj2_AddressEJBImpl.validatePostcode(AddressEJB_vk8fj2_AddressEJBImpl.java:39)
        	at sandpit.ejb.address.AddressEJB_vk8fj2_AddressEJBImpl_WLSkel.invoke(Unknown Source)
        	at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
        	at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
        	at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
        	at sandpit.ejb.address.AddressEJB_vk8fj2_AddressEJBImpl_1031_WLStub.validatePostcode(Unknown Source)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        	at java.lang.reflect.Method.invoke(Method.java:597)
        	at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:73)
        	... 36 more
        Caused by: java.lang.reflect.InvocationTargetException
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        	at java.lang.reflect.Method.invoke(Method.java:597)
        	at com.bea.core.repackaged.springframework.jee.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:332)
        	... 63 more
        Caused by: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.findMethod(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Method;
        	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineRequiredStatus(AutowiredAnnotationBeanPostProcessor.java:347)
        	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$1.doWith(AutowiredAnnotationBeanPostProcessor.java:294)
        	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:283)
        	at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:260)
        	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.findAutowiringMetadata(AutowiredAnnotationBeanPostProcessor.java:287)
        	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.processInjection(AutowiredAnnotationBeanPostProcessor.java:268)
        	at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(SpringBeanAutowiringInterceptor.java:101)
        	... 68 more

        Note I have also deployed the code onto OC4J and it works fine.

        Comment


        • #5
          Hi,

          I had the same problem using Weblogic 10.3.1 (Weblogic 11g) and I solved the problem using Weblogic 10.3.2 (Weblogic 11g Rel 1)

          Saludos,

          Comment

          Working...
          X