Serializable problem.

I have a great problem in using Object IO Streaming, I need to send the Message class from client side to server side, but the error occur. Since I cannot amend the code of ASN1Template class, so it causes me a huge diseaster! Anyone can help me? Thanks!!
The following is class Message code:
public class Message implements Serializable{
private String type;
private Object content;
public Message(){}
public Message(X509Certificate X509cert){
type = "x509cert";
content = X509cert;
public X509Certificate getX509Cert(){
return (X509Certificate)content;
And I need to pass the Message object from client to server, however the following error occur:
java.io.WriteAbortedException: Writing aborted by exception; java.io.NotSerializableException: com.rsa.asn1.ASN1Template
and I cannot amend the code of ASN1Template, so what can I do, in order to send it to server?
Thanks your kindly help!
Alva

You can't do anything. The ASN1Template class is not serializable for a reason - they don't want you sharing certificates between servers. Granted, that's not what you're trying to do, but you're violating their security model nonetheless.
What are you trying to do, exactly? Maybe I can help you find another way to accomplish your objective?

Similar Messages

  • Serialization problem with FlashPlayer 10.1

    Hi,
    here is a message that I have post in the AS3 section (http://forums.adobe.com/message/2938096), but someone gave the hint that this section should be more appropriate.
    A call in remote method, using amf/BlazeDS, is failing for the following reason :
    "The expected argument types are  (int, myPackage.MyClassVO[])  but the supplied types were (java.lang.Double, java.lang.Object[]) and converted to (java.lang.Integer, null).
    Cannot convert typeflex.messaging.io.amf.ASObject with remote type specified as 'null' toan instance of class myPackage.MyClassVO"
    So the serialization is failing.
    MyClassVO have only int variables, so nothing fancy.
    The point is that it works perfectly with previous versions of Flash, except 10.1
    So the definitions of the VOs are not the problem.
    Does any change have been done in the new flash player, with the serialization ? Does someone have also experience serialization problems with this new flash player ?
    Thanks for any help.
    M.
    Environment : Windows 32bits (but happens on Mac OS as well)
    Flash version : WIN 10,1,53,64
    Browser : Firefox, Opera, IE... they all have the problem

    Hi,
    by digging more and more, it appears that the problem is really on flash side.
    This error appears on java side :
    "Cannot convert type flex.messaging.io.amf.ASObject with remote type specified as 'null' to an instance of class myPackage.MyClassVO
    flex.messaging.io.amf.translator.decoder.DecoderFactory.invalidType(DecoderFact ory.java:369)"
    So after a look on the function invalidType in DecoderFactory, it apprears that
    object.getClass().getName();
    returns "flex.messaging.io.amf.ASObject" instead of "myPackage.MyClassVO"
    So Java don't recieve the correct type MyClassVO, but ASObject.
    And that only in FlashPlayer 10.1, but not FlashPayer 9 or FlashPlayer 10, where Java recieve the correct type, MyClassVO.
    Any help will be gladly appreciated, I'm running out of idea !
    Thanks !
    M.

  • Web Service From Java class, serialization problem

    Hi,
    I want to create Web Service from Java class, I made java project, generated web service from it, create web service archive project and deployed it to WAS 6.40.
    My class have 2 methods,
    public int add(int a, int b);
    public MyResponse doSomthing(MyRequest req);
    I can succesfully call add method from Web Service Navigator, it works fine but when I call doSomthing methods I get the following error:
    <b>
    Deserializing fails. Nested message: XML Deserialization Error. Result class [com.mycomp.sap_tech.ws.MyRequest] does not have property [Amount] of type [java.lang.String]. It is required to load XML..
    </b>
    Any ideas how to resolve it?
    P.S. MyRequest class is exposed throw VI, has default constractor and public getters and setters for all properties. It implements Serializable as well. Any guesses?
    Thanks in advance,
    Victor.

    Hi Bhavik, thanks for response.
    as I already mentioned it implements Serializable, so it is not the problem.
    Thanks Avi but it didn't helps iether
    Victor

  • Bussiness object serialization problem

    Hi, I have a little problem with serialization, when I want to create xml from Business object. Example:
    MyBoObject obj = new MyBoObject ();
    obj.atr1 = "aaa";
    obj.atr2 = "bbb";
    String xml = DynamicXml.createXmlTextFor(object : obj, topLevelTag : "something");
    display(xml);
    And displayed result is:
    <something>
    <atr2>bbb</atr2>
    </something>
    atr1 is attribute, which is inherited from db table.
    atr2 is atribute, which I created (it is not inherited from db table)
    Whole problem is, that it only serialize atr2 - from some reason it completely ignores atr1 and his value.
    Like I can't serialize attributes, which are inherited from db table.
    But when I created new attribute atr2 in my Business Object (which is not inherited from db table), everything work ok. Where's the problem? I read docs, but found nothing...
    Edited by: user12189610 on Nov 9, 2009 2:42 AM
    Edited by: user12189610 on Nov 9, 2009 2:46 AM

    If you need a simple project that duplicates this problem for customer support, here's where I put one: http://www.4shared.com/file/181611971/d21e9444/_2__DynamicXMLBug.html.
    Have them import the project, start Studio's Engine, login as "test" and start the Workspace. Create a work item instance and then run the work item when it reaches the "Test" activity. When you run the logic, you'll see this displayed:
    <?xml version="1.0" encoding="UTF-8"?>
    <poHeir xmlns="http://bea.com/albpm/DynamicXml/version/2.0">
        <nameForPO>Dan</nameForPO>
    </poHeir>They should note that only the "nameForPO" tag is created by the DynamicXml.createXmlTextFor() method. "nameForPO" is an attribute I manually added to the XML Heir BPM Object. The attributes of the inherited heir (e.g. "poHeir.orderDate" and "poHeir.billTo") are not included as tags in the generated XML even though these attributes have been set in the logic.

  • Isolation level SERIALIZABLE problem

    Hi there,
    I have a problem with my stored procedures when the isolation level of the connection is serializable. I need to set this isolation level because of data consistency reasons.
    When in this isolation level and a transaction tries to update or delete data modified by a transaction that commits after the serializable transaction began, I get this error:
    ORA-08177: Cannot serialize access for this transaction
    This is normal. The thing to do in this case is catch the error in the exception handler, rollback to a certain savepoint and try to do the update again.
    The stored procedure that I use to test this is:
    CREATE OR REPLACE PROCEDURE nm_test IS
    tmpVar NUMBER;
    err_num NUMBER;
    err_msg VARCHAR2(200);
    teller number;
    BEGIN
    teller := 0;
    savepoint sp1;
    <<try_every_thing_again>>
    begin
    tmpVar := 0;
    update stock_prices set price = price + 1
    where ric = 1;
    DBMS_OUTPUT.Put_Line('teller = ' || teller);
    EXCEPTION
    WHEN others THEN
    err_num := SQLCODE;
    --err_msg := SUBSTR(SQLERRM, 1, 200);
         if (err_num = -8177) then
              rollback to savepoint sp1;
              --DBMS_LOCK.SLEEP(1);
              teller := teller + 1;
              if (teller < 10) then
                   goto try_every_thing_again;
              end if;
              DBMS_OUTPUT.Put_Line('exception: teller = ' || teller);
         end if;
    end;
    END nm_test;
    I test this using 2 connections to the database. In the first connection I run the stored proc (without committing). Then I run the same stored proc in the second connection. This will block on the update (the is an implicit lock), which is ok. Then I commit the first connection. The second catches the error, rolls back and tries the update again....but then it catches the exception again, and again???
    When I replace the "rollback to savepoint" by just "rollback", everything works fine (the exception is then caught only once) and the update succeeds on the second try.
    But I can not work with just a "rollback" because my stored procedures might be called by others for which I don't want to undo all the work.
    Do any of you know why I keep getting this error (the program ends up in an infinite loop if I didn't keep a counter and exit after 10 times)?
    Marcel van Vuure

    Marcel,
    First of all, I'd be interested in hearing why you think you need serializable transactions (why 'read committed' doesn't work for your application). In the 8 years I've been building Oracle apps, I've never deemed it necessary to use serializable transactions. Maybe an optimistic locking strategy will solve your problem.
    Secondly, if I were designing the interface, I wouldn't have a procedure in charge of both executing business logic AND retrying the logic in case of failure. I'd build a helper procedure that calls the procedure that does the work, looks for certain exceptions, and retries the procedure when necessary.
    Lastly, if your interface doesn't have transactional control (the caller is in charge of commits and rollbacks), maybe you should simply attempt the update statement and throw an exception to the caller and let them handle it.
    I'm sorry if I haven't directly solved your problem, but sometimes the best way to solve a problem is to question the decisions that got you there in the first place.
    Hi there,
    I have a problem with my stored procedures when the isolation level of the connection is serializable. I need to set this isolation level because of data consistency reasons.
    When in this isolation level and a transaction tries to update or delete data modified by a transaction that commits after the serializable transaction began, I get this error:
    ORA-08177: Cannot serialize access for this transaction
    This is normal. The thing to do in this case is catch the error in the exception handler, rollback to a certain savepoint and try to do the update again.
    The stored procedure that I use to test this is:
    CREATE OR REPLACE PROCEDURE nm_test IS
    tmpVar NUMBER;
    err_num NUMBER;
    err_msg VARCHAR2(200);
    teller number;
    BEGIN
    teller := 0;
    savepoint sp1;
    <<try_every_thing_again>>
    begin
    tmpVar := 0;
    update stock_prices set price = price + 1
    where ric = 1;
    DBMS_OUTPUT.Put_Line('teller = ' || teller);
    EXCEPTION
    WHEN others THEN
    err_num := SQLCODE;
    --err_msg := SUBSTR(SQLERRM, 1, 200);
         if (err_num = -8177) then
              rollback to savepoint sp1;
              --DBMS_LOCK.SLEEP(1);
              teller := teller + 1;
              if (teller < 10) then
                   goto try_every_thing_again;
              end if;
              DBMS_OUTPUT.Put_Line('exception: teller = ' || teller);
         end if;
    end;
    END nm_test;
    I test this using 2 connections to the database. In the first connection I run the stored proc (without committing). Then I run the same stored proc in the second connection. This will block on the update (the is an implicit lock), which is ok. Then I commit the first connection. The second catches the error, rolls back and tries the update again....but then it catches the exception again, and again???
    When I replace the "rollback to savepoint" by just "rollback", everything works fine (the exception is then caught only once) and the update succeeds on the second try.
    But I can not work with just a "rollback" because my stored procedures might be called by others for which I don't want to undo all the work.
    Do any of you know why I keep getting this error (the program ends up in an infinite loop if I didn't keep a counter and exit after 10 times)?
    Marcel van Vuure

  • 2D objects Serialization problem

    Welcome!
    I'm making a net game using RMI and I have this problem.
    When I'm trying to join my client with the server an error occures:
    Error: error marshalling arguments; nested exception is:
         java.io.NotSerializableException: java.awt.geom.Ellipse2D$Double
    My client contains an Object extending a JPanel class. There are 2D object used to make the map, and that's why this error occures.
    It's a funny thing, cause I'm not sending a whole Object of my client, but only it's refference (using "this" in the join() method) so I dont know why does the 2D object need to be serialized and sent :|?
    Any way, my question is how to make 2D objects serializable!? I have jdk1.5.0_06 and as far as I remember they should be srializable in this version. Mabey I'm dooing something wrong!? Mabey it's nessesary to ad an appropreate code-line or import sth... i don't know
    please help me... I have little time to finish my project, and this thing is blocking my work.
    Big thanks to anybodey who will help.
    regards floW

    I'll tel u the whole story then, my problem is as follows:
    public class BounceThread{
       public static void main(String[] args)   {
          JFrame ramka = new BounceFrame();
             ramka.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             ramka.setVisible(true);
    class BounceFrame extends JFrame{
    public BounceFrame()
          setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
          setTitle("MiniGolf v 1.0");
          panel = new BallPanel(); // this contains maps made with 2D objects
          panel.setBackground(Color.green);
          panel.setVisible(panel.czy_wida&#263;_panel());
          add(panel, BorderLayout.CENTER);
    // I add a menu bar, that starts a net game:
    JMenuBar pasekMenu = new JMenuBar();
              setJMenuBar(pasekMenu);
              JMenu menuGra = new JMenu("Game");
           // and so on... and finaly I add an option:
              menuGame_Nowa.add(new
                        AbstractAction("Net game")
                             public void actionPerformed(ActionEvent event)
                                  net_game(panel);
    // here i write my net_game method:
    public void net_game(BallPanel aPanel)
         //here, i make an Client object, and connect him with my server
         client = new mgClient(panel);
         client.join();
         // I give panel as a paramete, cause I cant think of another way of leting my server to uce it's (panels) methods
         // If I join only a name of my client, then how can I change the panel in my BounceFrame from the Clients method
         // "shouted" by the server!? It has to be a field in the client's object.
         // Is there any other way out!?
    // Class BouceFrame holds the panel as a field:
    private mgClient client;
    private BallPanel panel;
    //and so on...
    }and that's the real problem I'm facing here. Is there any solution!? I think, that making a Client's field out of my panel is the only way ot. And that means I need those 2D objects serialized... :(
    Please help if u can.
    Regards floW

  • [WL6.1 SP2] RMI and Serialization problems

    Greetings. I've got a strange question.
    I have a rather large object graph that's produced by an EJB. This
    object graph is then serialized and sent across the network to a waiting
    client, or is passed to the web tier.
    The object graph is of variable size, but huge in any case - some
    examples are 10 megs in size when serialized to disk.
    The big problem is that it takes a lot of ram to serialize this object
    to push it over the network. Now, this wouldn't be a big problem (because
    objects are not requested very often), but for the fact that weblogic
    doesn't seem to release the memory for these objects after the serialization
    takes place.
    Is there some way to make sure that the object stream is closed after
    the object is sent, so the memory can be GC'd for other processes? We're
    currently giving the server about 600 Megs of ram max for the heap (the
    server is a ES40 dual), and the server can die in a matter of hours.
    Would SP3 help things at all?
    Is there some way to force memory cleanup?
    Thanks!
    -Jim Nemesh

    "Jim Nemesh" <[email protected]> writes:
    The big problem is that it takes a lot of ram to serialize this object
    to push it over the network. Now, this wouldn't be a big problem (because
    objects are not requested very often), but for the fact that weblogic
    doesn't seem to release the memory for these objects after the serialization
    takes place.This sounds like a bug, although if you leave any reference to the
    object it will not get GC'd. Are nulling out all your references after
    you are done with the object?
    Is there some way to make sure that the object stream is closed after
    the object is sent, so the memory can be GC'd for other processes? We're
    currently giving the server about 600 Megs of ram max for the heap (the
    server is a ES40 dual), and the server can die in a matter of hours.If the stream is not being closed then its a bug.
    Would SP3 help things at all?
    Is there some way to force memory cleanup?Garbage collection should do this.
    andy

  • Image Serializable problem.

    Hi,
    I have provided a hacked down version of my source code. I am trying to send ClassA across the network. Problem is Image is not serializable so java.io.NotSerializableException is thrown when writeObject is called. How can I get around it?
    public ClassA implements Serilizable{
    Image img;
    public ClassA(Image img){
    this.img = img;
    public ClassB{
    public void send(){
    out = new ObjectOutputStream(clientSocket.getOutputStream());
    out.writeObject(classAInstance);
    }

    is this Image from the swing package? if so, use ImageIcon instead of Image.

  • Help Needed: Serialization Problem

    I've got a problem with serialization, which is better illustrated with an example (slightly modified version of example in Tech Tips, February 29, 2000, Serialization in the Real World. The problem is that comparing serialized static final fields doesn't return correct result. Any help on how to fix this problem would be greatly appreciated. Thanks in advance. Here is the code:
    ====================
    import java.io.*;
    class Gender implements Serializable {
    String val;
    private Gender(String v) {
    val = v;
    public static final Gender male = new Gender("male");
    public static final Gender female = new Gender("female");
    public String toString() {
    return val;
    public class Person implements Serializable {
    public String firstName;
    public String lastName;
    private String password;
    transient Thread worker;
    public Gender gender;
    public Person(String firstName,
    String lastName,
    String password,
    Gender gender) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.password = password;
    this.gender = gender;
    public boolean isMale() {
    return gender == Gender.male;
    public boolean isFemale() {
    return gender == Gender.female;
    public String toString() {
    return new String(firstName + " " + lastName);
    public static void main(String [] args) {
    Person p = new Person("Fred", "Wesley", "cantguessthis", Gender.male);
    //-NOTE: there ia no problem with this check
    if (p.isMale()) {
    System.out.println("a male: " + p);
    } else if (p.isFemale()) {
    System.out.println("a female: " + p);
    } else System.out.println("strange");
    class WritePerson {
    public static void main(String [] args) {
    Person p = new Person("Fred", "Wesley", "cantguessthis", Gender.male);
    ObjectOutputStream oos = null;
    try {
    oos = new ObjectOutputStream(
    new FileOutputStream(
    "Person.ser"));
    oos.writeObject(p);
    catch (Exception e) {
    e.printStackTrace();
    finally {
    if (oos != null) {
    try {oos.flush();}
    catch (IOException ioe) {}
    try {oos.close();}
    catch (IOException ioe) {}
    class ReadPerson {
    public static void main(String [] args) {
    ObjectInputStream ois = null;
    try {
    ois = new ObjectInputStream(
    new FileInputStream(
    "Person.ser"));
    Person p = (Person)ois.readObject();
    //-NOTE: this is the problem: the check returns false
    if (p.isMale()) {
    System.out.println("a male: " + p);
    } else if (p.isFemale()) {
    System.out.println("a female " + p);
    } else System.out.println("strange");
    catch (Exception e) {
    e.printStackTrace();
    finally {
    if (ois != null) {
    try {ois.close();}
    catch (IOException ioe) {}
    }

    The Gender class implements a type-safe enumeration, but its implementation needs to be improved to ensure that re-creating a Gender object via deserialization doesn't create new objects but uses the existing objects. See this article for details on how that's done:
    http://developer.java.sun.com/developer/Books/shiftintojava/page1.html

  • Jaxb strange (de)serialization problem

    Hi!
    I have strange a problem in which deserialization of xml to an object generated by jaxb in some cases results in a classcastexception.
    Please bare with me...
    The problem occurs when I generate code for two schema's which both have an imported common schema which contain common data types and elements. Now I use 2 ant xjc task to generate the sources (to the same target folder). Whichever schema is created LAST works. That is, the sample xml for that schema can be deserialized. Now if I swap the order of generation the service for which the deserialization worked now fails and the other one works.
    If I add both schema's into a single call to xjc then it works but then I have a problem that I can't add any custom serialization because the additional of multiple binding files result in "not part of the compilation.." errors.
    This problem has been bugging me for days now and I wonder if anyone had the same problem? Or better, has a solution....
    Cheers,
    Robin

    sorry for the question already asked here. Actually I found the answer here
    http://forum.java.sun.com/thread.jspa?forumID=62&threadID=793180
    the problem was in the header, each time appended to the file. Anyhow, thanks to arnaud63 and ejp.

  • Very strange serialization problem(in what should be a simple solution)

    I'm trying to serialize a hashTable. And i'm trying to do it the same way that I serialized my binaryTree(which had no problems)
    But, for some reason it isn't working. I'm getting a SER file of only 3kb, and when I try to read the file after writing it my hashTable is coming out null.
    Here is a few code snippets:
    public class DictionaryController implements Serializable
         private static final long serialVersionUID = 1L;
         private HashTable hash;
         private Input inputer;
         private RandomAccessFile raf;
         public DictionaryController()
              if(checkDictionary() == true)
                   try
                        FileInputStream inFile = new FileInputStream("res/dictionaryHash.ser");
                        ObjectInputStream inStream = new ObjectInputStream(inFile);
                        hash = (HashTable) inStream.readObject();
                        inStream.close();
                   catch(IOException ioe)
                   catch(ClassNotFoundException cnfe)
              else
                   hash = new HashTable(50000, 0.8);
                   createRandomDictionary();
         }This is where I try to open it. when I say hash = new HashTable, hash is coming as null when I debug it.
         public void save()
              try
                   FileOutputStream outFile = new FileOutputStream("res/dictionaryHash.ser");
                   ObjectOutputStream outStream = new ObjectOutputStream(outFile);
                   outStream.writeObject(hash);
                   outStream.close();
              catch(IOException ioe)
         }That is the save. It only writes the file to the hard drive when I close the GUI.
    I've got all of my other classes implementing serializable, so I really can't figure out what is wrong.
    Anyone have any ideas? I have long values being stored in my hashTable, but all primitives are already Serializable right??
    argg. this seems like it should be such a simple problem but it just won't work. And its almost exactly the same as what I did before...

    Yeah, my fault for leaving the catch statements empty.
    Anyway, it is the output stream IO that is throwing the exception
    What do you mean by: You're probably hiding an instance variable with a member variable, but it's impossible to tell from the little bit of code you've shown.
    I can print out more code just need to know what stuff to post.
    Here is what i get from the printstacktrace:
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: hashTable.HashTable$TableEntry
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1278)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at dictionary.DictionaryController.<init>(DictionaryController.java:50)
         at dictionary.MainClass.main(MainClass.java:11)
    Caused by: java.io.NotSerializableException: hashTable.HashTable$TableEntry
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1224)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1050)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at dictionary.DictionaryController.save(DictionaryController.java:157)
         at dictionary.DictionaryGUI$ButtonHandler.actionPerformed(DictionaryGUI.java:91)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • Transformer serialize problem

    Hello
    I have a Java application which has a little method to serialize a javax.xml.transform.Transformer into a byte[].
    Here is the method:
    Object obj = transformer; 
    ByteArrayOutputStream bos = new ByteArrayOutputStream() ; 
    ObjectOutput out = new ObjectOutputStream(bos); 
    out.writeObject(obj); 
    out.close(); 
    // Get the bytes of the serialized object 
    byte[] buf = bos.toByteArray(); 
    ...  However, I am getting the following error:
    java.io.NotSerializableException: net.sf.saxon.Controller
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
    at .processing.transform.cache.CacheTransformers.addTransformer(CacheTransformers.java:62)
    How can I solve the problem? Is there any other way to serialize a javax.xml.transform.Transformer object?
    Thanks
    Regards

    Thanks for your reply.
    My main concern is, as you guess, the performance.
    When I create the transformer
        Transformer foTrans = tFactoryXML2FO.newTransformer(streamSource);
      where "streamSource" is a StreamSource object with my XSLT, the time taken just for this line is more or less 8 seconds (which its a lot).
    So, to try, reduce the time taken, I have tried several approaches. One of them is using Caching. For caching, I searched over the Internet and I found Apache JSC. I tried it but I got an error :
    "java.io.NotSerializableException: net.sf.saxon.Controller"
    This error happens when I try to write the Transformer object into an ObjectOutput (line ***):
           ByteArrayOutputStream bos = new ByteArrayOutputStream() ;
           ObjectOutput out = new ObjectOutputStream(bos);
           out.writeObject(transformer); (***)
           out.close();
         // Get the bytes of the serialized object
         byte[] buf = bos.toByteArray();
            cache.put(key, buf);
            ....Did you understood my problem?
    Thanks again

  • Version ID and Serializable problem...

    Ok the problem is this. I have a class for some items that will be saved to disk using the Serializable interface. Now to be able to load old files after I have edited the class I need to include the version id in the class like:
    static final long serialVersionUID = 1407381982932730981L;The thing is, to get that version ID you need to compile the class and go into a commandline and run the serialver tool on the class.
    Now, i will have a lot of new files that will extend the main class. And these will also be saved down to files (and it is critical that old files can be deserialized when the program starts again). So for each new class, i will have to go and get the version id.
    Is there some easier way for this?

    It's not entirely clear to me what your problem is. You talk about new classes that extend the main class. Serialization version issues cannot be a problem there.
    However, it is possible to run the serialver program directly from another class by invoking its main method. It's the class sun.tools.serialver.SerialVer. You'll need to include the tools. jar file in your class path. By capturing its output (using System.setOut()) you can automate this process to whatever degree you feel is worthwhile.
    Sylvia.

  • Map serialization problem

    Greetings, gurus.
    I have a weird problem I cannot overcome quite a long time now.
    I have a client-server application I am developing. Server holds a handler, which accepts requests and sends responses.
    In one scenario, the request is received, response object is created (some custom class I have written), and an attachment is added to response.
    Now, on application loading, the Response is sent with Map (HashMap actually) attached, everything is good by now.
    On some client interaction, I send the same response once again (of course a new object), and I attach new updated Map to it.
    The problem is that attachment received on client side is the old map, and not the new one.
    I have debugged the whole process several times, and it is as weird as it can get.
    The Map on the exit is OK, it is up-to-date, but when I receive it on the client side - it is the old one.
    Looks like it is some cache issue.
    Has anyone encountered such problems before?
    Any advice will be helpful.

    However, the way I would do it is use an api like mine [Essence RMI|http://www.freshvanilla.org:8080/display/essence/Essence+Remote+Method+Invocation] so that you don't need to keep resending the Map but instead have a proxy to the map.
    eg. In this unit test I create a proxy from the client to the server and then access it as if it were local. RmiMapTest
    The latency can be 20-120 microseconds depending on your configuration and is much faster than Java Serialization/Java RMI.
    Note: the client can update the Map as well are get the latest values.
    I have another example for sharing a BlockingQueue for distributing work to multiple clients.

  • Object send using Serializable problem

    My broblem here is that client send an object throw a socket and make some update in the server and send the object back to client but it seem that there is a problem in the following code :
    in = new ObjectInputStream(clientSocket.getInputStream());
    out = new ObjectOutputStream(clientSocket.getOutputStream());
    in the clientTCP class and in connection class .. this problem that it seem that the server doesn't get the object send by the Client .. can any one help me ..
    This is the code for the object to be send:
    public class Msgmsg{
    private String type;
    private String cur1;
    private String cur2;
    private double value;
    Msgmsg(String type,String cur1,String cur2,double value){
    this.type=type;
    this.cur1=cur1;
    this.cur2=cur2;
    this.value=value;
    void setType (String type){this.type = type;}
    void setCur1 (String cur1){this.cur1=cur1;}
    void setCur2 (String cur2){this.cur2=cur2;}
    void setValue(double value){this.value=value;}
    String getType (){return type;}
    String getCur1 (){return cur1;}
    String getCur2 (){return cur2;}
    double getValue(){return value;}
    This is the code for TCPServer
    import java.net.*;
    import java.io.*;
    public class TCPServer implements Serializable{
    public static void main (String args[]){
    try{
    int serverPort =8080;
    ServerSocket listenSocket = new ServerSocket(serverPort);
    while(true){
    Socket clientSocket = listenSocket.accept();
    Connection c = new Connection(clientSocket);
    catch (IOException e){System.out.println("listen: "+e.getMessage());}
    This is the connection class
    import java.net.*;
    import java.io.*;
    class Connection extends Thread{
    ObjectInputStream in;
    ObjectOutputStream out;
    Socket clientSocket;
    public Connection (Socket aClientSocket){
    try{
    clientSocket = aClientSocket;
    in = new ObjectInputStream(clientSocket.getInputStream());
    out = new ObjectOutputStream(clientSocket.getOutputStream());
    this.start();
    catch (IOException e){System.out.println("Connection: "+e.getMessage());}
    public void run(){
    try{
    Msgmsg message =(Msgmsg) in.readObject();
    if (message.getType().equals("Request")){
    message.setType("Reply");
    if (message.getCur1().equals("Dollar")&&
    message.getCur1().equals("Dinar")){
    message.setCur1("Dinar");
    message.setCur2("Dollar");
    double changeValue = message.getValue();
    changeValue = changeValue * 71 / 100;
    message.setValue(changeValue);
    else
    if (message.getCur1().equals("Dinar")&&
    message.getCur1().equals("Dollar")){
    message.setCur1("Dinar");
    message.setCur2("Dollar");
    double changeValue = message.getValue();
    changeValue = changeValue * 100 / 71;
    message.setValue(changeValue);
    else {
    message.setCur1("Undefined Currency");
    message.setCur2("Undefined Currency");
    message.setValue(0);
    else{
    message.setType("Undefined Message");
    message.setCur1("Error Message");
    message.setCur2("Error Message");
    message.setValue(0);
    out.writeObject(message);
    out.flush();
    catch(EOFException e){System.out.println("EOF: "+e.getMessage());}
    catch(IOException e){System.out.println("IO "+e.getMessage());}
    catch(ClassNotFoundException e){System.out.println("Class: "+e.getMessage());}
    finally {
    try{
    clientSocket.close();
    catch(IOException e){/*close failed*/}
    This is the code for TCPClient
    import java.net.*;
    import java.io.*;
    public class TCPClient implements Serializable{
    public static void main (String args[]){
    Msgmsg message;
    Socket s = null;
    ObjectInputStream in;
    ObjectOutputStream out;
    try{
    message = new Msgmsg("Request","Dinar","Dollar",50.5);
    int serverPort = 8080;
    s = new Socket("localhost",serverPort);
    in = new ObjectInputStream(s.getInputStream());
    out = new ObjectOutputStream (s.getOutputStream());
    out.writeObject(message);
    out.flush();
    message = (Msgmsg)in.readObject();
    System.out.println("Recieved1: "+message.getType());
    System.out.println("Recieved2: "+message.getCur1());
    System.out.println("Recieved3: "+message.getCur2());
    System.out.println("Recieved4: "+message.getValue());
    catch(UnknownHostException e){System.out.println("Sock: "+e.getMessage());}
    catch(EOFException e){System.out.println("EOF: "+e.getMessage());}
    catch(IOException e){System.out.println("IO: "+e.getMessage());}
    catch(ClassNotFoundException e){System.out.println("Class: "+e.getMessage());}
    finally {
    if (s!=null)
    try{
    s.close();
    }catch (IOException e){System.out.println("Close: "+e.getMessage());}
    Thanks for ur time

    You need to create ObjectOutputStream first and
    flush() it before creating the ObjectInputStreamwhat the difference I work these clases like another clases I have but the problem here is difference .. coz Imake tracing but it couldn't reach the following code:
    in = new ObjectInputStream(s.getInputStream);
    out = new ObjectOutputStream(s.getOutputStream);

Maybe you are looking for

  • Need to know the size of the variable declared as Xstring

    Hi All, I have got all the files from the applications server(for a given path) and have zipped all in to one file. But now need to find the size of it and throw a error message if it is less than a byte. Variable whick holds all the zipped data is "

  • My procedure hang and wait long time

    i have a procedure that runs only following sql statement when i execute this procedure it take long time!!one day !!how could i improve the speed?? for job in (select r.job_name,r.run_id from applsys.fnd_sch_job_runs r where r.start_date< add_months

  • Configure OpenSSO Policy Based on nsroledn?

    Hi It seems I can configure a url policy based on "authenticated users", "group", or "filter role", however, no luck on "nsroledn"? Does openSSO policy supports subject type of "managed role"? Thanks in advance

  • Pages won't open if edited by iCloud

    I have newest versions of Pages for both iPad and Mac. They open and sync fine through iCloud. The problem is when I use the iCloud beta to edit one of my documents. After that it will no longer open in either the iPad app or the desktop. It seems th

  • Anyone ever use the global plan for an 5c

    Going to France next week with a iPhone 5c.  Has anyone used the global plan?  How's it work, dialing numbers both in France and US?