[jboss-user] [EJB/JBoss] - Serializable no remote classloading
newtetris
do-not-reply at jboss.com
Thu Jan 3 16:49:18 EST 2008
I try to return an Interface of a serializable Object and simply access a getter but all I get is a ClassNotFoundException:
on JBoss 4.2.2.GA
| java.lang.reflect.UndeclaredThrowableException
| at $Proxy0.findRessource(Unknown Source)
| at org.test.EJBTester.main(EJBTester.java:39)
| Caused by: java.lang.ClassNotFoundException: org.test.RessourceImpl
| at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:82)
| at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:76)
| at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
| at java.lang.Class.forName0(Native Method)
| at java.lang.Class.forName(Class.java:242)
| at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveClass(ObjectInputStreamWithClassLoader.java:174)
| at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
| at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
| at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
| at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
| at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
| at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
| at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
| at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
| at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
| at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
| at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
| at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
| at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
| at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
| at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)
| at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)
| at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)
| at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:957)
| at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:586)
| at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
| at org.jboss.remoting.Client.invoke(Client.java:1634)
| at org.jboss.remoting.Client.invoke(Client.java:548)
|
files:
| public interface Ressource
| {
| public void setId(Long id);
| public Long getId();
| }
|
| public class RessourceImpl implements Ressource, Serializable
| {
| private Long id;
|
| public Long getId() {
| return this.id;
| }
| public void setId(Long id) {
| this.id = id;
| }
| }
|
| @Stateless
| @Remote(value=RessourceBean.class)
| public class RessourceBeanImpl implements RessourceBean, Serializable
| {
| public Ressource findRessource(Long id) {
| // simplified
| Ressource res = new RessourceImpl();
| res.setId(1L);
| return res;
| }
| }
| @Remote
| public interface RessourceBean
| {
| Ressource findRessource(Long id);
| }
|
|
the test:
| public class EJBTester
| {
| public static void main(String[] args)
| {
| RessourceBean res = null;
| try
| {
| Properties props = new Properties();
| props.setProperty("java.naming.provider.url", "jnp://localhost:1099");
| props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
| //
| props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
| //props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
| //props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
| System.setProperty("java.security.policy", "client.policy");
| System.setSecurityManager(new RMISecurityManager());
| InitialContext ctx = new InitialContext( props );
| //res = (RessourceBean) ctx.lookup("org.test.ejb.RessourceBean");
| res = (RessourceBean) ctx.lookup("TestEJB/RessourceBeanImpl/remote");
| if (null != res)
| {
| Ressource r = res.findRessource(null);
| if (null != r)
| {
| System.out.println("id = " + r.getId());
| }
| }
| }
| catch (Exception e)
| {
| e.printStackTrace();
| }
| }
|
| }
On the client I only added the interfaces and retrieve successfully the SSB .. And the funny thing is as you might have noticed on glassfish it works without any problems it fetches the (ressource)implemenation via RMIClassloader ;)
Any hints/suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116874#4116874
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116874
More information about the jboss-user
mailing list