ClassLoader issue when using JBoss remoting in AS 7.1.1
victorgarcia Jun 6, 2012 5:35 PMHi,
I am runing a junit test using jboss-remoting to test a stateless session bean running on JBoss 7.1.1, and a get this error:
10:51:58,765 ERROR [org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver] (Remoting "bahrain" task-3) Exception on channel Channel ID 4c947d59 (inbound) of Remoting connection 00137b1e to /127.0.0.1:2093 from message org.jboss.remoting3.remote.InboundMessage$3@d206f9: java.io.InvalidClassException: com.aplica.plus.tarjeta.negocio.modelo.TarjetaInteligente; Class does not extend stream superclass
at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:909)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1314)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37) [jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:156)
at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.handleMessage(VersionOneProtocolChannelReceiver.java:170)
at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437) [jboss-remoting-3.2.3.GA.jar:3.2.3.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_18]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18]
Caused by: an exception which occurred:
in object of type java.lang.Class
this the method i am invoking:
public DefinicionBase findDefinicionBasePropiedades(Class<? extends ObjetoFidelizacion> claseObjeto);
and the test is invoking the method with the class TarjetaInteligente as the parameter, which extends ObjetoFidelizacion.
I also have another test who sends an object to the server which is then used a a parameter in a jpa query, and in this case the server throws the following exception:
Caused by: java.lang.IllegalArgumentException: Parameter value [com.aplicaltda.plus.establecimiento.modelo.Establecimiento@32] did not match expected type [com.aplicaltda.plus.establecimiento.modelo.Establecimiento]
at org.hibernate.ejb.AbstractQueryImpl.validateParameterBinding(AbstractQueryImpl.java:375) [hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:348) [hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:375) [hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:72) [hibernate-entitymanager-4.1.4.Final.jar:4.1.4.Final]
at com.aplicaltda.common.dao.QueryUtil.getQuery(QueryUtil.java:49) [aplicaltda-common-1.10-SNAPSHOT.jar:]
at com.aplica.validation.dao.UniqueDAOImpl.existsObject(UniqueDAOImpl.java:58) [aplica-validation-ejb-1.3-SNAPSHOT.jar:]
at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source) [:1.6.0_18]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_18]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_18]
Could all this be a classloader issue? maybe jboss remoting use a diferent classloader that the classloader use by the application. If it is so, is there a way to make jboss remoting use the same classloader that my application, or visceversa?