JBoss 4.2.1-GA dynamic class loading

Discussion in 'Java' started by wimxa@yahoo.com, Sep 28, 2007.

  1. Guest

    I have been searching on the Internet about this, but no real success.
    I am using JBoss 4.2.1-GA. I have ClassA and ClassB, with interfaces
    IClassA and IClassB and a stateless session bean returning IClassA
    (while actually returning ClassB instance). I get the exception when I
    try to fetch it.

    Here is the stack trace:
    ---------- stack trace start
    ERROR SocketClientInvoker - Got marshalling exception, exiting
    java.lang.ClassNotFoundException: test.domain.ClassB
    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:
    943)
    at
    org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:
    584)
    at
    org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:
    122)
    at org.jboss.remoting.Client.invoke(Client.java:1550)
    at org.jboss.remoting.Client.invoke(Client.java:530)
    at
    org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:
    62)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:
    61)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:
    53)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:
    72)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:
    103)
    at $Proxy0.getIClassA(Unknown Source)
    at test.client.TestClient.test1(TestClient.java:163)
    at test.client.TestClient.run(TestClient.java:237)
    at test.client.TestClient.main(TestClient.java:290)
    ---------- stack trace end
     
    , Sep 28, 2007
    #1
    1. Advertising

  2. steph Guest

    wrote:
    > I have been searching on the Internet about this, but no real success.
    > I am using JBoss 4.2.1-GA. I have ClassA and ClassB, with interfaces
    > IClassA and IClassB and a stateless session bean returning IClassA
    > (while actually returning ClassB instance). I get the exception when I
    > try to fetch it.
    >
    > Here is the stack trace:
    > ---------- stack trace start
    > ERROR SocketClientInvoker - Got marshalling exception, exiting
    > java.lang.ClassNotFoundException: test.domain.ClassB
    > 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:
    > 943)
    > at
    > org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:
    > 584)
    > at
    > org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:
    > 122)
    > at org.jboss.remoting.Client.invoke(Client.java:1550)
    > at org.jboss.remoting.Client.invoke(Client.java:530)
    > at
    > org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:
    > 62)
    > at
    > org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    > 101)
    > at
    > org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:
    > 61)
    > at
    > org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    > 101)
    > at
    > org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:
    > 53)
    > at
    > org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    > 101)
    > at
    > org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:
    > 72)
    > at
    > org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    > 101)
    > at
    > org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:
    > 103)
    > at $Proxy0.getIClassA(Unknown Source)
    > at test.client.TestClient.test1(TestClient.java:163)
    > at test.client.TestClient.run(TestClient.java:237)
    > at test.client.TestClient.main(TestClient.java:290)
    > ---------- stack trace end
    >


    it's hard to answer without the code of ClassB en so one, but does it
    implement Serializable ?
     
    steph, Oct 3, 2007
    #2
    1. Advertising

  3. Guest

    > it's hard to answer without the code of ClassB en so one, but does it
    > implement Serializable ?

    It does. Think of it this way - I don't have a problem changing the
    code, but I don't know what to change. What is necessary to make it
    work? Is there any documentation about this? If the classes need to
    implement interfaces, extend other classes, be packaged specifically,
    if I need to have some configuration for JBoss - basically whatever is
    necessary I am willing to try. Can you tell me what that is, so I can
    try and see if it works for me?

    The example I made is a fictional one, so it can be changed however
    you wish. Here is the code:

    --- ClassA
    @Entity
    public class ClassA implements Serializable, IClassA {
    private static final long serialVersionUID = 1L;

    private int id;
    private int propA;

    @Id
    @GeneratedValue
    public int getId() {
    return id;
    }

    public int getPropA() {
    return propA;
    }

    public void setId(int id) {
    this.id = id;
    }

    public void setPropA(int propA) {
    this.propA = propA;
    }
    }

    ---- ClassB
    @Entity
    public class ClassB extends ClassA implements Serializable, IClassB {
    private static final long serialVersionUID = 1L;

    private int propB;

    public int getPropB() {
    return propB;
    }

    public void setPropB(int propB) {
    this.propB = propB;
    }
    }

    ---- IClassA
    public interface IClassA {
    int getPropA();
    void setPropA(int propA);
    }

    ---- IClassB
    public interface IClassB extends IClassA {
    int getPropB();
    void setPropB(int propB);
    }

    ---- StatelessSessionBeanTest
    @Stateless
    public class StatelessSessionBeanTest implements
    IStatelessSessionBeanTest {
    public IClassA getClassA() {
    ClassA classA = new ClassA();
    classA.setPropA(881);
    return classA;
    }

    public IClassB getClassB() {
    ClassB classB = new ClassB();
    classB.setPropA(881);
    classB.setPropB(98234);
    return classB;
    }
    }

    ---- IStatelessSessionBeanTest
    @Remote
    public interface IStatelessSessionBeanTest {
    IClassA getClassA();
    IClassB getClassB();
    }
     
    , Oct 4, 2007
    #3
  4. EricF Guest

    In article <>, wrote:
    >> it's hard to answer without the code of ClassB en so one, but does it
    >> implement Serializable ?

    >It does. Think of it this way - I don't have a problem changing the
    >code, but I don't know what to change. What is necessary to make it
    >work? Is there any documentation about this? If the classes need to
    >implement interfaces, extend other classes, be packaged specifically,
    >if I need to have some configuration for JBoss - basically whatever is
    >necessary I am willing to try. Can you tell me what that is, so I can
    >try and see if it works for me?
    >
    >The example I made is a fictional one, so it can be changed however
    >you wish. Here is the code:
    >
    >--- ClassA
    >@Entity
    >public class ClassA implements Serializable, IClassA {
    > private static final long serialVersionUID = 1L;
    >
    > private int id;
    > private int propA;
    >
    > @Id
    > @GeneratedValue
    > public int getId() {
    > return id;
    > }
    >
    > public int getPropA() {
    > return propA;
    > }
    >
    > public void setId(int id) {
    > this.id = id;
    > }
    >
    > public void setPropA(int propA) {
    > this.propA = propA;
    > }
    >}
    >
    >---- ClassB
    >@Entity
    >public class ClassB extends ClassA implements Serializable, IClassB {
    > private static final long serialVersionUID = 1L;
    >
    > private int propB;
    >
    > public int getPropB() {
    > return propB;
    > }
    >
    > public void setPropB(int propB) {
    > this.propB = propB;
    > }
    >}
    >
    >---- IClassA
    >public interface IClassA {
    > int getPropA();
    > void setPropA(int propA);
    >}
    >
    >---- IClassB
    >public interface IClassB extends IClassA {
    > int getPropB();
    > void setPropB(int propB);
    >}
    >
    >---- StatelessSessionBeanTest
    >@Stateless
    >public class StatelessSessionBeanTest implements
    >IStatelessSessionBeanTest {
    > public IClassA getClassA() {
    > ClassA classA = new ClassA();
    > classA.setPropA(881);
    > return classA;
    > }
    >
    > public IClassB getClassB() {
    > ClassB classB = new ClassB();
    > classB.setPropA(881);
    > classB.setPropB(98234);
    > return classB;
    > }
    >}
    >
    >---- IStatelessSessionBeanTest
    >@Remote
    >public interface IStatelessSessionBeanTest {
    > IClassA getClassA();
    > IClassB getClassB();
    >}
    >


    So what was the question? The original post isn't here. Makes it hard to help.

    Eric
     
    EricF, Oct 5, 2007
    #4
  5. Guest

    > So what was the question? The original post isn't here. Makes it hard to help.
    Eric,

    I can see the original post, but here it is again.

    #########------ original post start

    I have been searching on the Internet about this, but no real success.
    I am using JBoss 4.2.1-GA. I have ClassA and ClassB, with interfaces
    IClassA and IClassB and a stateless session bean returning IClassA
    (while actually returning ClassB instance). I get the exception when I
    try to fetch it.

    Here is the stack trace:
    ---------- stack trace start
    ERROR SocketClientInvoker - Got marshalling exception, exiting
    java.lang.ClassNotFoundException: test.domain.ClassB
    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:
    943)
    at
    org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:
    584)
    at
    org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:
    122)
    at org.jboss.remoting.Client.invoke(Client.java:1550)
    at org.jboss.remoting.Client.invoke(Client.java:530)
    at
    org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:
    62)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:
    61)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:
    53)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:
    72)
    at
    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:
    101)
    at
    org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:
    103)
    at $Proxy0.getIClassA(Unknown Source)
    at test.client.TestClient.test1(TestClient.java:163)
    at test.client.TestClient.run(TestClient.java:237)
    at test.client.TestClient.main(TestClient.java:290)
    ---------- stack trace end

    #########------ original post end

    Question: When I try to fetch ClassA or ClassB instance using
    getClassA or getClassB methods of StatelessSessionBeanTest, the client
    bombs with the exception in the original post. That is, it doesn't
    know how to load the entity classes (ClassA and ClassB) from the JBoss
    server. I assume this is possible because JBoss is setting up the RMI
    codebase (I've seen it say that when booting up - at http://127.0.0.1:8083).
    Is this possible and, if it is, what is the problem? Better, do you
    have a pointer to some working example on the Web? I want to use this
    so clients can be automatically "upgraded" when some change happens to
    entity beans - if the interface stays the same, the client should
    continue to work, but it will work with the new version (so the logic
    that changed can actually work).

    Thanks for the note.
     
    , Oct 5, 2007
    #5
  6. asoto Guest

    On Oct 5, 8:19 am, wrote:

    Wi...

    Have you found the solution to this problem.
    I'm also having the same problem but so far have not been able to
    figure it out.
    Thanks
    Alex
     
    asoto, Oct 5, 2007
    #6
  7. Guest

    > Wi...
    >
    > Have you found the solution to this problem.
    > I'm also having the same problem but so far have not been able to
    > figure it out.
    > Thanks
    > Alex


    Alex,

    Unfortunately no. I have also posted to JBoss forums - no replies yet.
    This doesn't seem to be capable in JBoss, even though it's all over
    the place in the config files - it seems that it is just there for
    some underlying things or as a future reference...

    Best wishes!
     
    , Oct 8, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,783
    Thomas Weidenfeller
    Oct 12, 2005
  2. han
    Replies:
    0
    Views:
    479
  3. Jubz
    Replies:
    0
    Views:
    2,291
  4. ddog
    Replies:
    3
    Views:
    7,521
  5. LprzemekL
    Replies:
    0
    Views:
    529
    LprzemekL
    Apr 10, 2008
Loading...

Share This Page