6 Replies Latest reply on Apr 26, 2013 1:39 PM by dbdbdb dbdbdb

    ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls

    dbdbdb dbdbdb Newbie

      I have two war applications that communicate with each other via EJB.

      And when I try to call a remote EJB passing in parameters an injected value (cdi weld) throws a ClassNotFoundException in my bean com.mycompany.portalcarweb.client.model.User$Proxy$_$$_WeldClientProxy

       

      If I dont send a CDI bean to EJB (using "new User()" instead), it works normaly.

      JBoss can send/receive CDI beans as parameter in remote EJB?

       

      Follow my sources:

      I have a LoggedUserProducer.java thats produces a User from the database.

       

      public class LoggedUserProducer {
      
          @Produces
          @SessionScoped
          @LoggedUser
          public User produceLoggedUser() throws Exception {
              ... //load user from database with a request token
              return user;
          }
      }
      

       

      And I have a JSF Bean thats make the EJB call:

      CarController.java

       

      @Named
      @ViewScoped
      public class CarController implements Serializable {
      
      
          @Inject //I have a producer to create the EJB proxy
          private AuditRemote auditRemote; //My remote EJB
      
      
          @Inject
          @LoggedUser
          private User loggedUser; //my User produced by LoggedUserProducer
      
      
          public void repairCar() throws Exception {
              ... //some actions...
      
      
              AuditAction action = new AuditAction()
              action.setPerformedBy(loggedUser); //setting my proxified cdi bean into a POJO
      
      
              auditRemote.audit(action); //here throws ClassNotFoundException;
          }
      

       

       

      and the Exception:

      java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters

       

       

      at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:229)

      at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:216)

          ...

      at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

      at org.jboss.weld.proxies.AuditRemote$-248248579$Proxy$_$$_WeldClientProxy.audit(AuditRemote$-248248579$Proxy$_$$_WeldClientProxy.java)

      at com.mycompany.services.controller.CarController.repairCar(CarController.java:118)

      at com.mycompany.services.controller.CarController$Proxy$_$$_WeldSubclass.repairCar(CarController$Proxy$_$$_WeldSubclass.java)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      ...

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      at java.lang.Thread.run(Thread.java:662)

      Caused by: java.lang.ClassNotFoundException: com.mycompany.portalcarweb.client.model.User$Proxy$_$$_WeldClientProxy from [Module "deployment.portalcarweb.war:main" from Service Module Loader]

       

       

       

      I don't know why my remote EJB can't find the class com.mycompany.portalcarweb.client.model.User$Proxy$_$$_WeldClientProxy

      My User.java is deployed in a JBoss 7 module. My EJB client and server have the jboss-deployment-structure.xml in WEB-INF folder and declaring the correct module to access this class.

       

      Thanks.

        • 1. Re: ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls
          Stephen Coy Master

          I don't know of any reason why what you're doing should not work.

           

          It looks like a bug to me.

          • 4. Re: ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls
            jaikiran pai Master

            Can you please try one of the latest released versions from here http://www.jboss.org/jbossas/downloads. I vaguely remember we might have done some fixes in this area post 7.1.1.Final.

            • 5. Re: ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls
              dbdbdb dbdbdb Newbie

              Tested with version 7.1.3 (built by sources) and the same error happened.

              I will test with EAP 6.1.0.Beta now.

               

              I'm trying to create an issue on JIRA for this, but in 'Create Issue' popup there's no AS7 (or similar - only Application Server 3 4 5 and 6) in project's combo box.

              • 6. Re: ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls
                dbdbdb dbdbdb Newbie

                Still not working with EAP 6.1.0 (7.2.0.Final-redhat-4):

                 

                 

                14:11:37,211 SEVERE [javax.faces.event] (http-/127.0.0.1:8080-5) java.lang.RuntimeException: JBAS014154: Failed to marshal EJB parameters

                          at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:270)

                          at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:259)

                          at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:170)

                          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

                          at org.jboss.ejb.client.EJBHomeCreateInterceptor.handleInvocation(EJBHomeCreateInterceptor.java:79)

                          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)

                          at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42)

                          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)

                          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:125)

                          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)

                          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:177)

                          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:161)

                          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:124)

                          at com.sun.proxy.$Proxy127.audit(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.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45)

                          at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

                          at org.jboss.weld.proxies.AuditRemote$-248248579$Proxy$_$$_WeldClientProxy.audit(AuditRemote$-248248579$Proxy$_$$_WeldClientProxy.java)

                          at com.mycompany.services.controller.CarController.repairCar(CarController.java:118)

                          at com.mycompany.services.controller.CarController$Proxy$_$$_WeldSubclass.repairCar(CarController$Proxy$_$$_WeldSubclass.java)

                 

                Caused by: java.lang.IllegalArgumentException: Can not set com.mycompany.portalcarweb.client.model.User field com.mycompany.portalcarweb.client.model.AuditAction.performedBy to com.mycompany.portalcarweb.client.model.User$Proxy$_$$_WeldClientProxy

                          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) [rt.jar:1.6.0_45]

                          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) [rt.jar:1.6.0_45]

                          at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63) [rt.jar:1.6.0_45]

                          at java.lang.reflect.Field.set(Field.java:657) [rt.jar:1.6.0_45]

                          at org.jboss.marshalling.cloner.SerializingCloner.storeFields(SerializingCloner.java:368)

                          at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:313)

                          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:253)

                          at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134)

                          at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:268) [jboss-as-ejb3-7.2.0.Final-redhat-4.jar:7.2.0.Final-redhat-4]

                          ... 76 more