aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes serializing Handle to java.lang.String Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "serializing Handle to java.lang.String" Watch "serializing Handle to java.lang.String" New topic
Author

serializing Handle to java.lang.String

Nitzan Levi
Greenhorn

Joined: Feb 19, 2003
Posts: 22
hi,
i'm trying to serialize the handle igot from a ejb to a string an then deserialize it and work with him.
i did the serializing with the folowing code :
public String serializeService(EJBObject service) {
String res;
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bytes);
oo.writeObject(service.getHandle());
//res = bytes.toString();
res = new String(bytes.toByteArray());
System.out.println(res);
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public EJBObject deserializeService(String serializedService) {
EJBObject res;
try {
ObjectInputStream oi = new ObjectInputStream(new ByteArrayInputStream(serializedService.getBytes()));
Handle hand = (Handle) oi.readObject();
res = hand.getEJBObject();
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
the proble accur whan i'm trying to deserialize the handle , i'm getting ...Local Class Not Compatible , the serializing and the deserializing both accur on the same servlet
do you have any ideas ??


nitzan levi :-)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: serializing Handle to java.lang.String
 
Similar Threads
getEJBObject ERROR!!!
Problem with serialization
interview question
Serialization issue
Service Locator pattern