Forums Register Login

Custom Object Serializable via Session Bean

+Pie Number of slices to send: Send
I have simple Custom Class which implements Serializable i want to send this one across a stateless session bean
import java.io.Serializable;

public class TestObject implements Serializable {
private String name;
private String city;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}


}
Now when i send this class object through a method on server deployed stateless bean i get...this Before...java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Failed to load class TestObject
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:191)

I thought that we can send any object with implements Serializable across the wire with out the other side having the same class.Is that true? how can we make this work.
+Pie Number of slices to send: Send
You need the class to be in the CLASSPATH to deserialize. When an object is deserialized only the content is stored and not the class definition. The class definition is in .class file
+Pie Number of slices to send: Send
Thanks for your reply Pradip but we have a caching service and cache should be able to taken in any object with out the server side knowing which class object it is getting. Can you please suggest some thing in this scenario.I was reading some thing about dynamic class loading for RMI. It this is the solution can you please tell me how can be achieved a simple example would be good.Thanks in advance Pradip.
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 981 times.
Similar Threads
Convert an Object to ByteArray
Websphere Studio Error : MQJMS1061: Unable to deserialize object
Writing objects to files and reading them back into the UI
Custom class Serializable Dynamic Class Loading
Problem injecting Sessionscoped bean in Managed bean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:41:44.