aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Custom Object Serializable via Session Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Custom Object Serializable via Session Bean" Watch "Custom Object Serializable via Session Bean" New topic
Author

Custom Object Serializable via Session Bean

seshu Palamanti
Ranch Hand

Joined: Jul 03, 2004
Posts: 59
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.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

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


Groovy
seshu Palamanti
Ranch Hand

Joined: Jul 03, 2004
Posts: 59
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom Object Serializable via Session Bean
 
Similar Threads
Writing objects to files and reading them back into the UI
Websphere Studio Error : MQJMS1061: Unable to deserialize object
Problem injecting Sessionscoped bean in Managed bean
Custom class Serializable Dynamic Class Loading
Convert an Object to ByteArray