Serialize and Deserialize
Serialize and Deserialize with Oracle 9 and Oracle 10
We have developed a client/server application. Client is a Java application and Server is written in C-Language; link between Java and C is RPC/JRPC.
We have to serialize and then deserialize a stream in a clob field in Oracle DB. When we deserialize with Oracle 9 we have no problem; now, after a migration to Oracle 10G, the deserialize failed at client level.
If we test in test environment (Oracle 9) with the same client and the same server we have no problem. The only difference between two enviroenment is only the version of Oracle (9 is OK - 10G is KO).
We use the OCI api.
The error message at client level is:
java.io.InvalidClassException: rpc.wDichiarazione; local class incompatible: stream classdesc serialVersionUID = 2960125282182152041, local class serialVersionUID = 2960125281578161001
Thanks of all
Marco
You've changed a class definition. It has nothing to do with the Oracle version. Recompile that class with
private static long serialVersionUID = 2960125282182152041L;If you then get another exception, you need to evaluate the changes you've made to the class in the light of what it says about Versioning in the Serialization specification.
Similar Messages
-
Revision: 22429
Revision: 22429
Author: [email protected]
Date: 2011-09-07 08:04:46 -0700 (Wed, 07 Sep 2011)
Log Message:
Adding the default fallback of serializer and deserializer classes to amf deserializer and amf serializer
Modified Paths:
blazeds/trunk/modules/core/src/flex/messaging/io/SerializationContext.java -
Using serialize and deserialize methods generated by clientgen
I am trying to use the classes generated by the weblogic.webservice.clientgen tool
from the weblogic 8.1 release. I would like to be able to make direct use of
the serialize and
deserialize methods in the "Codec" classes that correspond to the various request
and
response object classes. However, these methods require SerializationContext
and
deserializationContext objects as inputs. Are these context objects things I
can construct,
manufacture and/or access? Are there any coding examples for using these methods?
Thanks.
MichaelBruce,
Thanks for the response. I have seen the documentation before. What that shows
me is how
to write customized Serialize and Deserialize methods. What I want to do is call
the ones that
clientgen has already created for me. I would love to have these called by the
internals of the
generated code as part of the handling of service calls. My problem is that the
web site
that I'm calling for these services uses SSL, and every attempt to use the clientgen-generated
services results in the following exception being raised:
javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable
certificate was received.
Since I am successful in making SOAP calls to this same site -- certificate aren't
an issue
for these SOAP calls -- I thought that what I should try is to make the service
calls myself
using SOAP, but to use the generated Serialize and Deserialize methods
to create the request body and process the response body surrounding the SOAP
call.
However, what I'd really like to do
is figure out the cause of the SSLKeyException, and to make the service calls
the way weblogic
intended them to be made. So if you have any suggestions about what might
be causing the exception, I'd appreciate the help.
BTW. In addition to being able to make SOAP calls myself, I've also had some success
making
web service calls using code generated by Apache AXIS's wsdl2java tool and JWSDP's
wscompile
tool; however, neither of these wsdl processors are replacements for clientgen
because they
both have problems dealing with the complex structures described by wsdl files
for the web
services I'm trying to use.
Bruce Stephens <[email protected]> wrote:
Hi Michael,
The De/SerializationContext are internal/private objects. The example
in the doc (you have probably already seen) is a good starting point:
http://e-docs.bea.com/wls/docs81/webserv/customdata.html#1052981
Regards,
Bruce
BTW, Have you considered using XMLBeans?
http://dev2dev.bea.com/technologies/xmlbeans/index.jsp
Michael Horton wrote:
I am trying to use the classes generated by the weblogic.webservice.clientgentool
from the weblogic 8.1 release. I would like to be able to make directuse of
the serialize and
deserialize methods in the "Codec" classes that correspond to the variousrequest
and
response object classes. However, these methods require SerializationContext
and
deserializationContext objects as inputs. Are these context objectsthings I
can construct,
manufacture and/or access? Are there any coding examples for usingthese methods?
Thanks.
Michael -
Hi everyone:
I just want to know, say if you serialize an Object, obviously, the object will be stored in memory. But let us say if you deserialize it later on,
will the object be clean by the Garbage Collector?Your question suggests you might misunderstand the terms serialize and deserialize. You serialize an object to send it to another computer or store it out of memory, for example in a file. The serialized object can then be deserialized back into an in-memory object. Did you already know that, or does that help clear it up?
-
Serialization and circular dependancies
I am hoping to save some objects using serialization. However, I am worried about some circular dependacies.
I have a list of authors and books. Each book is associated with an author. And each other has a list of books. Therefore there is a circular depedancy in that in each author is a reference to a book which has a reference to the author.
Does std serialization take care of this or does it cause a problem?
Thanks.I am hoping to save some objects using serialization.
However, I am worried about some circular
dependacies.
I have a list of authors and books. Each book is
associated with an author. And each other has a list
of books. Therefore there is a circular depedancy in
that in each author is a reference to a book which
has a reference to the author.
Does std serialization take care of this or does it
cause a problem?What happened when you wrote a little program to test this?
Did it create an infinitely large file? Were you able to serialize and deserialize successfully? -
Singleton serialization and weblogic - help!
hi everyone,
I'm trying to serialize a singleton cache object we're using for our (intranet)
website running on weblogic 6.1. I've made sure the singleton class
implements serializable, and i've also put the following method in the
singleton class (ChartCache.java):
private Object readResolve()
return theInstance; //which is of type ChartCache
By the way I'm using jdk 1.3. I've trawled the web and can't find anything to help me yet...
Basically I've written a jsp to get the current instance of the cache
and serialize it to a file. When I invoke another jsp i want it to
reinflate the object and place it back into the weblogic jvm so it can
once again be accessed as a singleton by all classes in the webapp. At
the moment its just not working - the cache object will eventually
take over half an hour to create (huge database processing going on)
so I want the option, if weblogic falls over, to reinstantiate the
cache without having to rebuild it from scratch. The cache will only
be refreshed once a day.
I'll c&p my jsp code below...
======================= restoreCache.jsp
<%@ page import = "java.util.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "com.drkw.agencylending.website.chartcache.*" %>
<%@ page import = "com.drkw.agencylending.log.Logger" %>
<%
ChartCache theCache = null;
try
String filename = "chartCache.dat";
FileInputStream fis = new FileInputStream(filename);
ObjectInputStream in = new ObjectInputStream(fis);
theCache = (ChartCache)in.readObject();
in.close();
catch(Exception e)
Logger.log(e);
%>
Resurrected chart cache from file.
======================= saveCache.jsp
<%@ page import = "java.util.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "com.drkw.agencylending.website.chartcache.*" %>
<%@ page import = "com.drkw.agencylending.log.Logger" %>
<%
ChartCache theCache = ChartCache.getInstance();
String fileName = "chartCache.dat";
try
FileOutputStream fos = new FileOutputStream(fileName);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(theCache);
oos.flush();
oos.close();
catch(Exception e)
Logger.log(e);
%>
Wrote cache object to file.
============================
At the moment, a file is getting written but it seems suspiciously
small (73 bytes!) for what is a very large object. When I try to load
it up again, I get no errors but when I call ChartCache.getInstance()
(my singleton) it recreates the cache rather than using the one I've
reinflated. BTW I don't need to worry about server clustering/JNDI to
ensure I have a truly singleton instance - there will only ever be one
JVM to worry about.
Any help greatly appreciated!solved the problem using another technique. Rather
than serialize the entire singleton object, I just
serialized the hashmap (the only bit I really care
about). Then in the private constructor, the class
checks a database flag to see whether the singleton
was created today - if not, I refresh the cache,
otherwise load in the serialized hashmap and set that
as my class member. No complicated jndi/ejb registry
needed to get around it..!singleton serialization is not recommended in ejb enviroment, it will cause problems. in what you are doing, it is far better to persist the data values in a database.
just for the sake of writing a serializable sington: in addition to what you do in a regular object, you would first check to see if this obj has been serialized, if it is, deserialize it and return this one. you would have to write your own method to do serialization, making sure you have only one place to serialize it, and let the object know where the file is. -
MTS with batch management, serialization and Handling unit
Hello All,
I am testing a scenario for MTS with batch management, serialization and Handling unit for discrete manufacturing.
Everything worked fine till I created the Handling unit for the finished product.
The production order has a quantity of 3 EA.
It has three serial numbers 1, 2 and 3. (serial numbers can be displayed from order->Header->serial numbers)
I created one Handling unit for production order quantity of 3 EA.
I tried to do a goods receipt for the production order using transaction COWBHUWE.
I get the following error when I try to post the GR:
Only 0 serial numbers entered instead of 3
Message no. IO304
Diagnosis
There is a serial number obligation, so the number of serial numbers must equal the number of serial numbers in the material document.
You can post the operation only if you entered the correct number of serial numbers previously.
System Response
Depending on the context in which the error arises, the system continues processing, or the required function cannot be performed.
Procedure
You have the following options, for example:
Check that the serial numbers are entered fully.
If necessary, display an error log.
If necessary, contact your system administrator.
What did I miss?
How to fix this problem?
Please help.
Thanks in advance
GeorgeI added the serialization procedure HUSL to the serial number profile and it fixed the problem.
-
Diff between Serialization and Synchronization
Hi I am new to java.
Pl. give me the difference between Serialization and Synchronization.
Thankq
SridharDon't you look at the timestamps of posts? They could
have been typing at the same time.
/KajPlease stop! I'll die laughing. LOL
Re: Diff between Serialization and Synchronization
Author: Annie. Apr 11, 2005 10:30 AM (reply 1 of 4)
Re: Diff between Serialization and Synchronization
Author: glrao Apr 12, 2005 8:31 AM (reply 2 of 4) I really like your sense of humor.
xH4x0r -
Diff between Serialization and Synchonization
Hi I am new to java.
Pl. give me the difference between Serialization and Synchonization.
Thankq
SridharPl. give me the difference between Serialization and
Synchonization.Object serialization is the process of saving an object's state to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. The Java Serialization API provides a standard mechanism for developers to handle object serialization.
Synchronization is intended to make the code thread safe by setting locks on objects.
They are totally different concepts. I fail to understand how you intend to compare them. -
Regarding Serializable and subclasses.
I have a an abstract parent class called 'Information'
which implements Serializable and which has an abstract
method called init().
There are 2 subclasses that extend the parent class Information
called SInformation_1 and SInformation_2 and implement the method init().
Now as the parent class is Serialized,will the concrete subclasses
also be Serializable?How long does it take to write a demo?
import java.io.*;
abstract class Base implements Serializable {
public abstract void init();
class D1 extends Base {
public void init() {}
class D2 extends Base {
public void init() {}
public class SerializableExample {
public static void main(String[] args) throws IOException, ClassNotFoundException {
Base obj1 = new D1();
Base obj2 = new D2();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(obj1);
out.writeObject(obj2);
out.flush();
out.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream in = new ObjectInputStream(bais);
D1 d1 = (D1) in.readObject();
D2 d2 = (D2) in.readObject();
} -
Difference between serialization and externalization
Can any body explain me the difference between serialization and externalization
with some example.Have you tried google?
Serializable indicates that the object can be serialized by the default serializer, Externalizable means that the object itself will handle the serialization of the object.
/Kaj -
Serialization and Class Integration
I have a class that I want to serialize in order to save it to a file. In terms of OO design what is the best way to go about integrating serialization into my classes?
I was going to have two static methods that would read/write an object of the class from/to a stream, where both the stream and object are paramters to the method. Would it make sense to implement it this way or would it be considered messy?
Thanks!All you have to do is add implements java.io.Serializable to the class definition and make sure that any non-static non-transient data members are also serializable (and so on recursively until closure).
-
Serializable and externalizable
Hi all,
What is the diffrence between the externalizable and serializable and when do we use each one of them ?
Thanks in advance
HarishBoth are interfaces with Externalizable extending Serializable. However where Serializable is a tagging interface (an interface with no methods to implement) Externalizable contains two methods to implement: readExternal and writeExternal. Use Serializable when you require default serialization (i.e., all non-transient, serializable attributes of a class and it's superclass(es) are serialized). Use Externalizable when you require complete control over the serialization process (i.e., you determine what attributes to serialize and how far up the hiearchical chain to traverse although this can be achieved via the Serializable interface as well by providing implementations of the ObjectInputStream and ObjectOutputStream class's readObject and writeObject methods respectively).
-
What is serialization and serializable
what is serialization and serializable,Can any body explain me please.
hi
Serialization in java is the process of making the object flat which can later be stored on your disk like a normal flat file. the serailized object can be found useful mainly when using RMI and EJB where we persist cobjects so that they can be sent online (thru cable) by this we mean for objects to be distributed the prerequiste is tht they should be serialized. For this we have a interfacein java called "Serializable". the class tht needs serialization of its object should implement this class. this is a marker interface(the interface tht contains nmo methods)
hope the concept is clear if not please mail me to : [email protected]
bye
thnx and regards
bhaskara navuluri -
Object Serialization and IO Error
Hi,
I am trying to serialize 3 hashtable objects, with serializable keys and elements, on to disk. Here is a snippet of the code disk management code:
public void loadData(StoreManager s_man) {
// read from disk
Hashtable o = (Hashtable)readObjects();
Hashtable c = (Hashtable)readClasses();
Hashtable i = (Hashtable)readIndex();
//Hashtable e = (Hashtable)readEnv();
Integer id = (Integer)readEnv();
// set the store manager objects
s_man.setObjects(o);
s_man.setClasses(c);
s_man.setIndex(i);
Env.setCurrentID(id);
Here is what the readObject method looks like:
* Deserialize disk data and return Object data.
public synchronized Object readObjects() {
if (!objectdatafile.exists())
return null;
Object o = new Object();
try {
FileInputStream istream = new FileInputStream(objectdatafile);
ObjectInputStream pack = new ObjectInputStream(istream);
o = pack.readObject();
istream.close();
catch (Exception e) {
e.printStackTrace();
Occasionally, when starting the program (i.e. when it initially reads all data from disk), I am getting the following exceptions:
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2426)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1238)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:325)
at java.util.Hashtable.readObject(Hashtable.java:799)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:42)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:28)
at java.lang.reflect.Method.invoke(Method.java:327)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:812
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1736)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
639)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:325)
at DiskManager.readObjects(DiskManager.java:165)
at DiskManager.loadData(DiskManager.java:42)
at LoadDataAction.run(LoadDataAction.java:30)
at java.lang.Thread.run(Thread.java:539)
java.lang.ClassCastException: java.lang.Object
at DiskManager.loadData(DiskManager.java:42)
at LoadDataAction.run(LoadDataAction.java:30)
at java.lang.Thread.run(Thread.java:539)
I would like to repeat that I am not getting this error everytime, but about once every two runs. Please share your feelings about possible errors I am making or if there is an inherent bug with serialization of hashtables.
Thanksthe java.io.EOFException looks like you did not properly close the stream on writing. to me this seems like there is an error in the writing code rather than the reading code. although there are some things you can improve...
robert
Maybe you are looking for
-
Delegated Object's event not appearing in the "start event" tab
Hi, I have created a object type say Y00Mara( copy of BUS1001) ....then created a subtype from it ...called Ymara00. then I created a deleegation ...if I test the supertype i can now see the new objects/attributes etc... I also added one event "old_
-
How can I delete Adobe's intro folio from Content Viewer on iPad?
I've been building a demo folio for my boss to use pitching to a client, on the iPad. We would like the opening screen of Adobe Content Viewer to list only our own folio(s), not Adobe's intro one about how to use the content viewer. This folio does
-
Combining 2 quicktime movies into 1
i'm using qicktime pro 7.5.5 for windows I wento to help to follow the instructions to do it, i already did the first step open the movie and i choose edit> select the entire contents of the first movie. My problem is in the step #2 choose edit> copy
-
Hi all, Is it possible to track iphone or ipads3g using the OSX Lion Server's Profile Manager? So if let's say I added my iphone into OSX Lion Server and then I want to know where my iphone is located, can we do that inside the OSX Lion other than us
-
List exceptions from FacesMessages
Hi all, I want to get the corresponding FacesException from a FacesMessage. How can I do it? Thanks!