ClassNotFoundException on CDI proxified (Weld) bean when JBoss receives remote EJB calls
dbdbdb Apr 26, 2013 10:06 AMI 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.