A similar problem was reported on Jan 31 2002, but the solution suggested deals
with the "getEJBObject" line. I have tryed to implement this solution, as you
can see below, but since the error I am getting is thrown before getting to that
line, it makes no difference.
The Exception I am getting is an "InvalidClassException". The message reads as
follows = "weblogic.rmi.internal. LocalServerRefMissing no-arg constructor for
class".
As far as the "no-arg constructor" error goes, as I understand it I should not
be having that problem. My Session bean implements the SessionBean interface and
does not explicitly extend anything, so by default it extends Object, right?!
Object has a no-args constructor, so there should be no problem.
My code is as follows:
---SERIALIZATION--- Handle msaHandle = contributions.getHandle(); ObjectOutputStream
toFile = new ObjectOutputStream( new FileOutputStream(handleFile)); toFile.writeObject(msaHandle);
toFile.close();
---DESERIALIZATION--- ObjectInputStream fromFile = new ObjectInputStream( new
FileInputStream(handleFile)); Handle msaHandle = (Handle) fromFile.readObject();
//MsaSession contributions = (MsaSession) msaHandle.getEJBObject(); MsaSession
contributions = (MsaSession) javax.rmi.PortableRemote Object.narrow(msaHandle.getEJBObject(),
MsaSession.class); fromFile.close();
I have tried to print "classname" (available in the InvalidClassException class),
but only get null as the value.
Anyone have any ideas?
I would suggest that you open a case with sup...@bea.com
-- Rob
-- ---------------------------------------------------------------------- AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server by Michael Girdley, Rob Woollen, and Sandra Emerson http://learnWebLogic.com
as according to javadocs this exception is thrown for one of these reasons
· The serial version of the class does not match that of the class
descriptor read from the stream
· The class contains unknown datatypes
· The class does not have an accessible no-arg constructor
The most common I find to be the first one
HTH
- Rajeev
Matthew <matthe...@tonservices.com> wrote in message
news:3c6841d7$1...@newsgroups.bea.com...
1. The SFSB has a no-argument (empty) create (ejbCreate) method in
addition to others.
2. The classes for the member objects all have no-argument
constructors and serializable.
3. several times deleted and recompiled all classes and still getting
the same error.
The problem is with Weblogic 6.1 SP2.
If anybody has solved this problem, I would appreciate posting the
solution.
Rchandran
"Matthew" <matthe...@tonservices.com> wrote in message news:<3c6841d7$1...@newsgroups.bea.com>...
In the same method :
// serialize
Handle handle = tc.getHandle();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(handle);
oos.flush();
String decoded_handle = baos.toString();
...
// deserialize
byte[] datas = decoded_handle.getBytes();
ByteArrayInputStream sbis = new ByteArrayInputStream(datas);
ObjectInputStream ois = new ObjectInputStream(sbis);
Handle handle2 = (Handle)ois.readObject(); // <-- Execption here
Exception :
java.io.InvalidClassException: java.lang.Long; Local class not
compatible: stream classdesc serialVersionUID=4290774032661291999
local class serialVersionUID=4290774380558885855
at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:523)
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:936)
Everything is clean in my classpath !!!
Any help ???
String decoded_handle = baos.toString();
...
byte[] datas = decoded_handle.getBytes();
and datas is not the same as baos.toString()
If you really need to store handle as String you can do something like this:
import javax.mail.internet.MimeUtility;
...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(MimeUtility.encode(baos,"base64"));
oos.writeObject(handle);
oos.flush();
String decoded_handle = baos.toString();
...
byte[] datas = decoded_handle.getBytes();
ByteArrayInputStream sbis = new ByteArrayInputStream(MimeUtility.decode(datas,"base64"));
ObjectInputStream ois = new ObjectInputStream(sbis);
Handle handle2 = (Handle)ois.readObject();
> In the same method :
--
Dimitri