Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JBoss 4.2.1-GA dynamic class loading

Reply
Thread Tools

JBoss 4.2.1-GA dynamic class loading

 
 
wimxa@yahoo.com
Guest
Posts: n/a
 
      09-28-2007
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.ClassLoaderUtilit y.loadClass(ClassLoaderUtility.java:
82)
at
org.jboss.remoting.loading.RemotingClassLoader.loa dClass(RemotingClassLoader.java:
76)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at
org.jboss.remoting.loading.ObjectInputStreamWithCl assLoader.resolveClass(ObjectInputStreamWithClassL oader.java:
174)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectI nputStream.java:
1544)
at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:
1466)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1699)
at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:34
at
org.jboss.aop.joinpoint.InvocationResponse.readExt ernal(InvocationResponse.java:
122)
at java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:
1755)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1717)
at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:
190
at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:
1832)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1719)
at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:34
at
org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObjectVersion2_2(JavaSeri alizationManager.java:
239)
at
org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObject(JavaSerializationM anager.java:
133)
at
org.jboss.remoting.marshal.serializable.Serializab leUnMarshaller.read(SerializableUnMarshaller.java:
120)
at
org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.versionedRead(MicroSocketClientInvoker. java:
943)
at
org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.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.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.aspects.tx.ClientTxPropagationIntercepto r.invoke(ClientTxPropagationInterceptor.java:
61)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.aspects.security.SecurityClientIntercept or.invoke(SecurityClientInterceptor.java:
53)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke( IsLocalInterceptor.java:
72)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.ejb3.stateless.StatelessRemoteProxy.invo ke(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

 
Reply With Quote
 
 
 
 
steph
Guest
Posts: n/a
 
      10-03-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.ClassLoaderUtilit y.loadClass(ClassLoaderUtility.java:
> 82)
> at
> org.jboss.remoting.loading.RemotingClassLoader.loa dClass(RemotingClassLoader.java:
> 76)
> at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:242)
> at
> org.jboss.remoting.loading.ObjectInputStreamWithCl assLoader.resolveClass(ObjectInputStreamWithClassL oader.java:
> 174)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectI nputStream.java:
> 1544)
> at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:
> 1466)
> at
> java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
> 1699)
> at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
> at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:34
> at
> org.jboss.aop.joinpoint.InvocationResponse.readExt ernal(InvocationResponse.java:
> 122)
> at java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:
> 1755)
> at
> java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
> 1717)
> at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
> at java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:
> 190
> at java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:
> 1832)
> at
> java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
> 1719)
> at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
> at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:34
> at
> org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObjectVersion2_2(JavaSeri alizationManager.java:
> 239)
> at
> org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObject(JavaSerializationM anager.java:
> 133)
> at
> org.jboss.remoting.marshal.serializable.Serializab leUnMarshaller.read(SerializableUnMarshaller.java:
> 120)
> at
> org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.versionedRead(MicroSocketClientInvoker. java:
> 943)
> at
> org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.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.invokeNex t(MethodInvocation.java:
> 101)
> at
> org.jboss.aspects.tx.ClientTxPropagationIntercepto r.invoke(ClientTxPropagationInterceptor.java:
> 61)
> at
> org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
> 101)
> at
> org.jboss.aspects.security.SecurityClientIntercept or.invoke(SecurityClientInterceptor.java:
> 53)
> at
> org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
> 101)
> at
> org.jboss.ejb3.remoting.IsLocalInterceptor.invoke( IsLocalInterceptor.java:
> 72)
> at
> org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
> 101)
> at
> org.jboss.ejb3.stateless.StatelessRemoteProxy.invo ke(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 ?
 
Reply With Quote
 
 
 
 
wimxa@yahoo.com
Guest
Posts: n/a
 
      10-04-2007
> 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();
}

 
Reply With Quote
 
EricF
Guest
Posts: n/a
 
      10-05-2007
In article <(E-Mail Removed). com>, (E-Mail Removed) 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
 
Reply With Quote
 
wimxa@yahoo.com
Guest
Posts: n/a
 
      10-05-2007
> 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.ClassLoaderUtilit y.loadClass(ClassLoaderUtility.java:
82)
at
org.jboss.remoting.loading.RemotingClassLoader.loa dClass(RemotingClassLoader.java:
76)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:
319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at
org.jboss.remoting.loading.ObjectInputStreamWithCl assLoader.resolveClass(ObjectInputStreamWithClassL oader.java:
174)
at
java.io.ObjectInputStream.readNonProxyDesc(ObjectI nputStream.java:
1544)
at
java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:
1466)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1699)
at
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:
34
at
org.jboss.aop.joinpoint.InvocationResponse.readExt ernal(InvocationResponse.java:
122)
at
java.io.ObjectInputStream.readExternalData(ObjectI nputStream.java:
1755)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1717)
at
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at
java.io.ObjectInputStream.defaultReadFields(Object InputStream.java:
190
at
java.io.ObjectInputStream.readSerialData(ObjectInp utStream.java:
1832)
at
java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:
1719)
at
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:
34
at
org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObjectVersion2_2(JavaSeri alizationManager.java:
239)
at
org.jboss.remoting.serialization.impl.java.JavaSer ializationManager.receiveObject(JavaSerializationM anager.java:
133)
at
org.jboss.remoting.marshal.serializable.Serializab leUnMarshaller.read(SerializableUnMarshaller.java:
120)
at
org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.versionedRead(MicroSocketClientInvoker. java:
943)
at
org.jboss.remoting.transport.socket.MicroSocketCli entInvoker.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.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.aspects.tx.ClientTxPropagationIntercepto r.invoke(ClientTxPropagationInterceptor.java:
61)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.aspects.security.SecurityClientIntercept or.invoke(SecurityClientInterceptor.java:
53)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke( IsLocalInterceptor.java:
72)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNex t(MethodInvocation.java:
101)
at
org.jboss.ejb3.stateless.StatelessRemoteProxy.invo ke(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.


 
Reply With Quote
 
asoto
Guest
Posts: n/a
 
      10-05-2007
On Oct 5, 8:19 am, (E-Mail Removed) 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

 
Reply With Quote
 
wimxa@yahoo.com
Guest
Posts: n/a
 
      10-08-2007
> 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!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Application in JBoss Portal on Liferay JBoss LprzemekL Java 0 04-10-2008 12:03 PM
Loading properties file in .war under JBoss - where do they belong? ddog Java 3 08-04-2007 12:25 AM
Eclipse/Lomboz/JBoss: Cannot Start JBoss (Debug) Server from Eclipse Using Lomboz Plugin Jubz Java 0 05-30-2006 10:24 PM
jboss 4.0.3 jboss portal 2.2.1 han Java 0 05-08-2006 10:35 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM



Advertisments