Java.io.NotSerializableException: java.awt.BasicStroke - really confusing

I have a class Box which has two member Size and Location, both Serializable.
Then I have several classes (e.g. Node) which extend Box.
None of all the classes (Box, Size, Location and all extensions of Box e.g. Node) use BasicStroke. I commented out the import of BasicStroke in all classes that are Serializable, so it cannot be used anywhere.
The problem is I use drag and drop, and when Box is also Serializable I get the following error when trying to drop:
java.io.NotSerializableException: java.awt.BasicStroke
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
     at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1251)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
     at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
     at java.util.Vector.writeObject(Vector.java:1018)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
     at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
     at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
     at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
     at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
     at sun.awt.datatransfer.TransferableProxy.getTransferData(TransferableProxy.java:66)
     at java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(DropTargetContext.java:359)
     at kfotobook.kgui.KPageViewer.getFlavorData(KPageViewer.java:767)
     at kfotobook.kgui.KPageViewer.getFlavorData(KPageViewer.java:750)
     at kfotobook.kgui.KPageViewer.drop(KPageViewer.java:791)
     at java.awt.dnd.DropTarget.drop(DropTarget.java:430)
     at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
     at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
     at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:812)
     at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:736)
     at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
     at java.awt.Component.dispatchEventImpl(Component.java:3826)
     at java.awt.Container.dispatchEventImpl(Container.java:2024)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
     at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:3963)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3817)
     at java.awt.Container.dispatchEventImpl(Container.java:2010)
     at java.awt.Window.dispatchEventImpl(Window.java:1774)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
I do not know how to better describe the error, because I have no clue why BasicStrokes is tried to serialize at all. I am really confused, but perhaps somebody has seen something similar and can give a hint.
Message was edited by:
kudi

Thanks for the hint. Actually I must say once more that I was too tired that I have overseen a memeber field because of bad code layout :-( I better went to sleep...
But there is still something confusing, that is also the reason why I did not search for the fields in the right class.
So I have a class Box and a class Node which extends Box. Node is the one which contains the evil AWT references. When I declare only Node as Serializable, it works. But when I also declare the super class Box as Serializable the error occured.
In my opinion a Serializable sub class with a super class which does not implement Serializable does not make sence, but as an accident I did it. What is the semantic in such a case? (At least I know it could not serialize the sub class as expected...)
Message was edited by:
kudi

Similar Messages

  • Java.io.NotSerializableException: java.awt.AWTEventMulticaster

    I have an Applet. When I try to use the "print" feature on IE to print out the applet. I'm getting this Exception. java.io.NotSerializableException: java.awt.AWTEventMulticaster
    What should I do?
    Andy

    please help!!

  • Java.io.NotSerializableException: sun.awt.image.BufferedImageGraphics2D

    Hi all!
    This problem is in relation to a very complex bean for data visualization which is jarred and bridged as an activex control.
    I am able to create the activex control and embed it in a vb form. But when I try to run the application in vb I get the following message and the application does not start.
    java.io.NotSerializableException: sun.awt.image.BufferedImageGraphics2D The bean has not used the class mentioned above anywhere. It uses the
    Image
    class though. I have used other beans, which use the same drawing techniques as the bean in question, as activex controls, with no errors.
    What could be the problem?
    tia
    Shailesh
    PS: the actual error dump is 1 page long I can send it by email on request.

    Hello,
    Have you implemented the Serializable Interface? I usually receive that error when I forgot to implement that interface. It is mandatory for a JavaBean to implement this interface.
    As an example:
    import java.io.Serializable;
    public class SimpleBean implements Serializable
    I hope it helps.
    Antonio Castro

  • Help needed to solve "java.io.NotSerializableException: java.util.Vector$1"

    hi to all,
    i am using a session less bean A to querry a Entity Bean B , which inturns calls another EntityBean C ,
    finally a ' find' method is invoked on the EntityBean C, In this a vector is created which holds 3 different vectors at different indexes, now the problem i am facing is that when Enity Bean B is returning the final vector to the A , it's firing out a errors that :-
    TRANSACTION COULD NOT BE COMPLETED: RemoteException occurred in server thread;
    ested exception is:
    java.rmi.RemoteException: null; nested exception is:
    java.rmi.ServerException: RemoteException occurred in server thread; ne
    ted exception is:
    java.rmi.RemoteException: null; nested exception is:
    java.io.NotSerializableException: java.util.Vector$1
    java.rmi.ServerException: RemoteException occurred in server thread; nested exc
    ption is:
    java.rmi.RemoteException: null; nested exception is:
    java.rmi.ServerException: RemoteException occurred in server thread; ne
    ted exception is:
    java.rmi.RemoteException: null; nested exception is:
    java.io.NotSerializableException: java.util.Vector$1
    java.rmi.RemoteException: null; nested exception is:
    java.rmi.ServerException: RemoteException occurred in server thread; ne
    ted exception is:
    java.rmi.RemoteException: null; nested exception is:
    java.io.NotSerializableException: java.util.Vector$1
    java.rmi.ServerException: RemoteException occurred in server thread; nested exc
    ption is:
    java.rmi.RemoteException: null; nested exception is:
    java.io.NotSerializableException: java.util.Vector$1
    java.rmi.RemoteException: null; nested exception is:
    java.io.NotSerializableException: java.util.Vector$1
    java.io.NotSerializableException: java.util.Vector$1
    <<no stack trace available>>
    ur any help would be highly appricated to solve out this prob.
    If i try to iterate through this vector it's gives IOR:0232003x343242344asdsd................................................blabla....................
    thanxs in adavance
    Deepak

    Hi I think you are using the method elements() in a remote method.
    This method can't be Serializable!! Because it returns an Interface. Interfaces are never Serializable.
    Regards,
    Peter

  • Java.io.NotSerializableException: java.util.RandomAccessSubList

    Hi,
    I'm testing a software but I receive this error message:
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.util.RandomAccessSubList
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)
            at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
            at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
            at $Proxy7.getDataPackage(Unknown Source)
            at gaia.dpct.cu3.avu.gsr.server.GsrSourceIdServerRmiImpl.getDataPackage(GsrSourceIdServerRmiImpl.java:73)
            at gaia.dpct.cu3.avu.gsr.reader.GsrSystemRowReaderStrategy.loadData(GsrSystemRowReaderStrategy.java:52)
            at gaia.dpct.pfs.infraimpl.PFSGenericPersistenceManager.loadData(PFSGenericPersistenceManager.java:455)
            at gaia.dpct.pfs.infraimpl.PFSPersistenceManagerAdpaterImpl.loadData(PFSPersistenceManagerAdpaterImpl.java:318)
            at gaia.cu1.tools.infraimpl.GenericDataTrain.run(GenericDataTrain.java:546)
            at gaia.dpct.pfs.infraimpl.PFSDataTrainAdapterImpl.run(PFSDataTrainAdapterImpl.java:166)
            at gaia.dpct.pfs.nodes.TrainManager$TrainExecution.run(TrainManager.java:735)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.util.RandomAccessSubList
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
            at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
            ... 16 more
    Caused by: java.io.NotSerializableException: java.util.RandomAccessSubList
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
            at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:315)
            at sun.rmi.transport.Transport$1.run(Transport.java:159)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
            ... 3 moreI checked all the code but the objects I use are instantiated from Serializable classes.
    I read something about "java.util.RandomAccessSubList" but what is this? I use List and Map.
    Are there problem with the List and the Map I use?
    Could someone help me?
    Thanks, bye bye.

    You have a List member whose value is derived from List.subList(), which is implemented by the class named in the exception, which isn't serializable. Change it to
    subList = new LinkedList<T>(list.subList());where T is whatever it should be.
    You should do this anyway, as the subList is merely a view of the original list, so if it was serializable it would take the entire original list with it.

  • Java.io.NotSerializableException: java.util.Vector$1

    I am using Java 2 in the API it says that the Vector implements Serializable but I am getting an exception java.io.NotSerializableException: java.util.Vector$1 I don't know why please help.
    Thank you
    palanisr

    Although Vectors are Serializable that doesn't mean that the contents of a Vector are necessarily Serializable. What are the contents of your Vector? Are they objects of a Serializable class? If not that is your problem. The attached sample code demonstrates the problem of serializing a Vector that contains non-serializable data. If you make the Employee class Serializable the code works.
    import java.util.*;
    import java.io.*;
    public class Serialize
    public static void main(String args[])
      ObjectOutputStream oos = null;
      FileOutputStream fos = null;
      Vector v = new Vector();
      v.add(new Employee("Smith","John"));
      v.add(new Employee("Jones","Albert"));
      try
       fos = new FileOutputStream("vector.ser");
       oos = new ObjectOutputStream(fos);
       oos.writeObject(v);
      catch(FileNotFoundException fnfe)
       fnfe.printStackTrace();
      catch(IOException ioe)
       ioe.printStackTrace();
      finally
       try
        if (oos != null)
         oos.close();
       catch(IOException ioe)
       try
        if (fos != null)
         fos.close();
       catch(IOException ioe)
    class Employee //implements Serializable
    private String lastName;
    private String firstName;
    public Employee(String lastName, String firstName)
      this.lastName = lastName;
      this.firstName = firstName;
    }

  • Java.io.NotSerializableException: java.util.Hashtable$KeySet

    Hi,
    i have a
        private Hashtable<IDInterface, String> globalPeerFarmMap_=new Hashtable<IDInterface,String>();    in one class and it can be serialized OK.
    In another class, however i have a     private Hashtable<IDInterface, PeerBasic> thesePeers_=new Hashtable<IDInterface, PeerBasic>();     and a java.io.NotSerializableException is thrown - on the KeySet it seems.
    However, ID (which implements IDInterface) is serializable (and all its fields are serializable) and it works in the first case.
    Any ideas? Didn't want to be confusing, but if simplistic i will post some code.
    Thanks

    Found it. The compiler didn't provice much info. Somewhere inside PeerBasic, i call keySet on a Hashtable. I don't understand why this cause a problem.

  • Thread unserialized exception: NotSerializableException: java.lang.Thread

    hello experts,
    i have this exception coming; seems to be coming from some thread but i removed all the threads from my code, i thought its because of some object which is still unserialized, i am not sure whether this is because of one unserialized object or its because of more reasons, please have a look:
    Exception in client main: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Thread
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Thread
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173)
         at BallServerImpl_Stub.getAllBallProxies(Unknown Source)
         at CopyOfManyMovingBalls.<init>(CopyOfManyMovingBalls.java:80)
         at CopyOfManyMovingBalls$2.run(CopyOfManyMovingBalls.java:294)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: java.lang.Thread
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
         ... 11 more
    this is coming  when i m accessing this method:
    class BallServerImpl extends UnicastRemoteObject
    implements BallServer
    * @return an enumeration of all Balls as proxy objects
    public Ball[] getAllBallProxies() throws java.rmi.RemoteException
         Ball[] locations1 = new Ball[hash.size()];
    java.util.Enumeration iter = hash.elements();
    int idx = 0;
    while (iter.hasMoreElements())
         BallImpl impl = (BallImpl)iter.nextElement();
    locations1[idx++] = new BallProxy(impl);
    return locations1;
    why this function is running fine when i m calling this from client unlike getAllBallProxies() nevertheless both are returning the same thing:
    * @return an enumeration of all Balls as remote references
    public Ball[] getAllBalls()
         Ball[] locations = new Ball[hash.size()];
    java.util.Enumeration iter = hash.elements();
    int idx = 0;
    while (iter.hasMoreElements())
    locations[idx++] = (Ball)iter.nextElement();
    return locations;
    the proxy Class:
    * The Proxybouncing ball.
    public class BallProxy implements Serializable,Ball {
    * The Real bouncing ball.
    public class BallImpl extends UnicastRemoteObject implements IBallRemote,Serializable
    *load of thanks as this is "SHOW STOPPER",
    jibbylala*
    Edited by: 805185 on Oct 25, 2010 8:33 PM
    Edited by: 805185 on Oct 25, 2010 8:39 PM
    Edited by: 805185 on Oct 25, 2010 9:21 PM
    Edited by: 805185 on Oct 25, 2010 9:25 PM
    Edited by: 805185 on Oct 25, 2010 9:27 PM
    Edited by: 805185 on Oct 25, 2010 9:46 PM

    that there was some thread there in BallProxy but i removed all from them and now testingIf you don't post the code people ask to see, you may never get a useful answer here.
    P.S i didn't know that threads are not SerializedThe Thread class is not Serializable. Precision please.
    Now i m updating the code, i needed the confirmationConfirmation of what?
    and now trying to avoid them.Them?
    But what if i need them.Them?
    Please make the effort to express yourself clearly. You've already been told you're not making much sense and you haven't done anything about it.
    how can we make serialized?The concept of serializing a Thread makes no sense whatsoever. You don't want to do it. You don't need to do it. You can't do it. It wouldn't work if you could do it.
    Somewhere or other you have a class member that is a reference to a Thread. Remove it or make it transient. If you post the code somebody may help you. If you don't, nobody can possibly do that.

  • Java.io.NotSerializableException when overwrite the JTable data into .txt file

    hi everyone
    this is my first time to get help from sun forums
    i had java.io.NotSerializableException: java.lang.reflect.Constructor error when overwrite the JTable data into .txt file.
    At the beginning, the code will be generate successfully and the jtable will be showing out with the data that been save in the studio1.txt previously,
    but after i edit the data at the JTable, and when i trying to click the save button, the error had been showing out and i cannot succeed to save the JTable with the latest data.
    After this error, the code can't be run again and i had to copy the studio1.txt again to let the code run 1 more time.
    I hope i can get any solution at here and this will be very useful for me.
    the following is my code...some of it i create it with the GUI netbean
    but i dunno how to attach my .txt file with this forum
    did anyone need the .txt file?
    this is the code that suspect maybe some error here
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String filename = "studio1.txt";
              try {
                  FileOutputStream fos = new FileOutputStream(new File(filename));
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                   oos.writeObject(jTable2);
                   oos.close();
              catch(IOException e) {
                   System.out.println("Problem creating table file: " + e);
                   return;
              System.out.println("JTable correctly saved to file " + filename);
    }the full code will be at the next msg

    this is the part 1 of the code
    this is the full code...i had /*....*/ some of it to make it easier for reading
    package gui;
    import javax.swing.*;
    import java.io.*;
    public class timetables extends javax.swing.JFrame {
        public timetables() {
            initComponents();
        @SuppressWarnings("unchecked")
        private void initComponents() {
            jDialog1 = new javax.swing.JDialog();
            buttonGroup1 = new javax.swing.ButtonGroup();
            buttonGroup2 = new javax.swing.ButtonGroup();
            buttonGroup3 = new javax.swing.ButtonGroup();
            buttonGroup4 = new javax.swing.ButtonGroup();
            jTextField1 = new javax.swing.JTextField();
            jLayeredPane1 = new javax.swing.JLayeredPane();
            jLabel6 = new javax.swing.JLabel();
            jTabbedPane1 = new javax.swing.JTabbedPane();
            jScrollPane3 = new javax.swing.JScrollPane();
            jTable2 = new javax.swing.JTable();
            jScrollPane4 = new javax.swing.JScrollPane();
            jTable3 = new javax.swing.JTable();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
    /*       org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane());
            jDialog1.getContentPane().setLayout(jDialog1Layout);
            jDialog1Layout.setHorizontalGroup(
                jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 400, Short.MAX_VALUE)
            jDialog1Layout.setVerticalGroup(
                jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jLayeredPane1.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);
            String filename1 = "studio1.txt";
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   jTable2 = (JTable) ois.readObject();
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   jTable3 = (JTable) ois.readObject();
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
            jTable2.setRowHeight(20);
            jTable3.setRowHeight(20);
            jScrollPane3.setViewportView(jTable2);
            jScrollPane4.setViewportView(jTable3);
            jTable2.getColumnModel().getColumn(4).setResizable(false);
            jTable3.getColumnModel().getColumn(4).setResizable(false);
            jTabbedPane1.addTab("STUDIO 1", jScrollPane3);
            jTabbedPane1.addTab("STUDIO 2", jScrollPane4);
            jTextField1.setText("again n again");
            jLabel6.setText("jLabel5");
            jLabel6.setBounds(0, 0, -1, -1);
            jButton2.setText("jButton2");
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
          

  • Java.io.NotSerializableException when overwrite the JTable data into .txt

    hi everyone
    i had java.io.NotSerializableException: java.lang.reflect.Constructor error when overwrite the JTable data into .txt file.
    At the beginning, the code will be generate successfully and the jtable
    will be showing out with the data that been save in the studio1.txt
    previously,
    but after i edit the data at the JTable, and when i trying to click the
    save button, the error had been showing out and i cannot succeed to
    save the JTable with the latest data.
    After this error, the code can't be run again and i had to copy the studio1.txt again to let the code run 1 more time.
    I hope i can get any solution at here and this will be very useful for me.
    but i dunno how to attach my .txt file with this forum
    did anyone need the .txt file?
    the following is my suspect code
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String filename1 = "studio1.txt";
              try {
                  FileOutputStream fos = new FileOutputStream(new File(filename1));
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                   oos.writeObject(jTable2.getModel());
                   oos.flush();
                   oos.close();
                   fos.close();
              catch(IOException e) {
                   System.out.println("Problem creating table file: " + e);
                            e.printStackTrace();
                   return;
              System.out.println("JTable correctly saved to file " + filename1);
    }this is the reading code
    String filename1="studio1.txt";
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   TableModel model = (TableModel)ois.readObject();
                    jTable3.setModel(model);
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
              }Edited by: Taufulou on Jan 8, 2009 11:43 PM
    Edited by: Taufulou on Jan 8, 2009 11:44 PM
    Edited by: Taufulou on Jan 8, 2009 11:45 PM

    is this the code u mean?
    i had put this code inside it but the problem still remain the same
    if (jTable2.isEditing()) {
                jTable2.getCellEditor().stopCellEditing();
            }i had found a new thing that when i just double click the cell without change any data inside the table
    and click the button "Save". the same exception which is
    java.io.NotSerializableException: java.lang.reflect.Constructor
    will come out again.

  • Java.io.NotSerializableException

    I am running iplanet ias 6.0 sp3 with web server 6.0 sp1. I
    successfully deployed an ear file that contains the war and the jar to
    the APPS dir. The session ejbs and the entity ejbs are packed into the
    jar file which are deployed with the ear.
    I have two piece of testing code. One is a standalone java program.
    The other one is a jsp page together with the jsp bean which are packed
    into the war file in the ear. The jsp bean code and the standalone
    program are doing the same thing. They call a session ejb which calls an
    entity bean.
    I have made 2 experiments
    1> Start server, run the standalone test, got the correct result.
    Then run the jsp from the browser, got the correct result.
    2> Start server, run the jsp from the browser, fail to get the
    result. run the standalone test, fail to get the result
    The paten is very consistent. The code and the error msg for test 2 are
    attached. Could any one tell me what might cause the problem in the
    second test and how to resolve the it ?
    Thank in advance
    Xiao
    When the test fails, I got the following error msg from the console.
    [10/Nov/2001 12:08:08:3] info: --------------------------------------
    [10/Nov/2001 12:08:11:0] error: EBFP-serialize: error during
    serialization of me
    thod, exception = java.io.NotSerializableException: java.util.Vector$1
    java.io.NotSerializableException: java.util.Vector$1
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at
    java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:811)
    at
    java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOut
    putStream.java:432)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:337)
    at
    java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:
    1567)
    at
    java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java
    :453)
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at com.kivasoft.ebfp.FPSerializable.serialize(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    [10/Nov/2001 12:08:11:0] warning: EB-invalidate_delegate: instance
    com.plateausy
    [email protected] threw
    an unche
    cked or system exception, ex = ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    [10/Nov/2001 12:08:11:0] error: Exception Stack Trace:
    ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.HolidayProfileManagerBe
    an.getHolidayProfileHolidays(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_skel_com_plateausys
    tems_elms_bo_holidayprofile_ejb_HolidayProfileManagerBean.getHolidayProfileHolid
    ays(ejb_skel_com_plateausystems_elms_bo_holidayprofile_ejb_HolidayProfileManager
    Bean.java:207)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_kcp_skel_HolidayPro
    fileManager.getHolidayProfileHolidays__seq_com_plateausystems_elms_bo_holidaypro
    __13918743(ejb_kcp_skel_HolidayProfileManager.java:326)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    ERROR [Thread-37] (?:?) - <HolidayProfileManagerJB:getHolidayVOs>Can't
    get Holid
    ayVOs by holiday profile id.java.rmi.ServerException: RemoteException
    occurred i
    n server thread; nested exception is:
    javax.transaction.TransactionRolledbackException
    *************************************************************end of
    error msg
    The attached is session and entity bean code segment.
    In the entity bean:
    public Enumeration ejbFindByHolidayProfileID(String id) {
    Vector list = new Vector();
    try {
    Connection connection = DBUtil.getConnection();
    try {
    PreparedStatement s =
    connection.prepareStatement(sqlFindByHolidayProfileID);
    try {
    s.setString(1, id);
    ResultSet rs = s.executeQuery();
    try {
    while (rs.next()) {
    HolidayProfileHolidayPK pk = new
    HolidayProfileHolidayPK();
    pk.holidayProfileID = rs.getString("hol_prfl_id");
    pk.holidayID = rs.getString("hol_id");
    list.add(pk);
    } finally {
    rs.close();
    } finally {
    s.close();
    } finally {
    connection.close();
    } catch (Exception e) {
    throw new EJBException(e);
    return list.elements();
    In the session bean:
    public HolidayProfileHolidayVO[] getHolidayProfileHolidays(String
    holidayProfileID) throws ElmsFinderException
    HolidayProfileHolidayVO[] vos = null;
    ArrayList alst = new ArrayList();
    HolidayProfileHolidayHome hphHome =
    this.getHolidayProfileHolidayHome();
    try {
    java.util.Enumeration enum =
    hphHome.findByHolidayProfileID(holidayProfileID);
    while (enum.hasMoreElements()) {
    Object obj = enum.nextElement();
    HolidayProfileHoliday bean =
    (HolidayProfileHoliday)javax.rmi.PortableRemoteObject.narrow(obj,
    HolidayProfileHoliday.class);
    alst.add(bean.getVO());
    } catch (FinderException e) {
    // throw as new ElmsCheckedException subclass
    throw new ElmsFinderException("getHolidayProfileHolidays(id):
    Could not find HolidayProfileHolidays.", e);
    } catch (RemoteException e) {
    // throw as new ElmsUncheckedException
    throw new ElmsUncheckedException(
    "getHolidayProfileHolidays()", e);
    } catch (RuntimeException e) {
    throw new ElmsUncheckedException(e);
    if (alst.size()>0) vos =
    (HolidayProfileHolidayVO[])alst.toArray(new HolidayProfileHolidayVO[1]);
    return vos;
    }

    Xiao,
    We have the same problem.
    The reason why your stand alone works, but your browser based doesn't,
    is because the iPlanet Application server requires that all EJBs, all
    objects held in any EJB, all objects held in attributes in an
    HttpSession, and all objects held in those objects MUST implement
    java.io.Serializable.
    The unfortunate reason why iPlanet does this is because iPlanet does not
    preserve the state of objects in memory across hits to the server.
    iPlanet serializes each and every object mentioned above when the HTML
    is returned to the client, and then un-serializes all the objects again
    when it receives another hit from the client. This is true even in the
    case of no-dsync sticky load balancing.
    This is ridiculous. We use sticky load balancing and we have many
    objects stored in HttpSession attributes which we do not want to be
    serialized every hit to the server, in the interest of speed. It takes
    too long to serialize all the objects, and it would take way too long to
    save them in a database every hit.
    David Shade
    xluo888 wrote:
    >
    I am running iplanet ias 6.0 sp3 with web server 6.0 sp1. I
    successfully deployed an ear file that contains the war and the jar to
    the APPS dir. The session ejbs and the entity ejbs are packed into the
    jar file which are deployed with the ear.
    I have two piece of testing code. One is a standalone java program.
    The other one is a jsp page together with the jsp bean which are packed
    into the war file in the ear. The jsp bean code and the standalone
    program are doing the same thing. They call a session ejb which calls an
    entity bean.
    I have made 2 experiments
    1> Start server, run the standalone test, got the correct result.
    Then run the jsp from the browser, got the correct result.
    2> Start server, run the jsp from the browser, fail to get the
    result. run the standalone test, fail to get the result
    The paten is very consistent. The code and the error msg for test 2 are
    attached. Could any one tell me what might cause the problem in the
    second test and how to resolve the it ?
    Thank in advance
    Xiao
    When the test fails, I got the following error msg from the console.
    [10/Nov/2001 12:08:08:3] info: --------------------------------------
    [10/Nov/2001 12:08:11:0] error: EBFP-serialize: error during
    serialization of me
    thod, exception = java.io.NotSerializableException: java.util.Vector$1
    java.io.NotSerializableException: java.util.Vector$1
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at
    java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:811)
    at
    java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOut
    putStream.java:432)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:337)
    at
    java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:
    1567)
    at
    java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java
    :453)
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at com.kivasoft.ebfp.FPSerializable.serialize(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    [10/Nov/2001 12:08:11:0] warning: EB-invalidate_delegate: instance
    com.plateausy
    [email protected] threw
    an unche
    cked or system exception, ex = ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    [10/Nov/2001 12:08:11:0] error: Exception Stack Trace:
    ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.HolidayProfileManagerBe
    an.getHolidayProfileHolidays(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_skel_com_plateausys
    tems_elms_bo_holidayprofile_ejb_HolidayProfileManagerBean.getHolidayProfileHolid
    ays(ejb_skel_com_plateausystems_elms_bo_holidayprofile_ejb_HolidayProfileManager
    Bean.java:207)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_kcp_skel_HolidayPro
    fileManager.getHolidayProfileHolidays__seq_com_plateausystems_elms_bo_holidaypro
    __13918743(ejb_kcp_skel_HolidayProfileManager.java:326)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    ERROR [Thread-37] (?:?) - <HolidayProfileManagerJB:getHolidayVOs>Can't
    get Holid
    ayVOs by holiday profile id.java.rmi.ServerException: RemoteException
    occurred i
    n server thread; nested exception is:
    javax.transaction.TransactionRolledbackException
    *************************************************************end of
    error msg
    The attached is session and entity bean code segment.
    In the entity bean:
    public Enumeration ejbFindByHolidayProfileID(String id) {
    Vector list = new Vector();
    try {
    Connection connection = DBUtil.getConnection();
    try {
    PreparedStatement s =
    connection.prepareStatement(sqlFindByHolidayProfileID);
    try {
    s.setString(1, id);
    ResultSet rs = s.executeQuery();
    try {
    while (rs.next()) {
    HolidayProfileHolidayPK pk = new
    HolidayProfileHolidayPK();
    pk.holidayProfileID = rs.getString("hol_prfl_id");
    pk.holidayID = rs.getString("hol_id");
    list.add(pk);
    } finally {
    rs.close();
    } finally {
    s.close();
    } finally {
    connection.close();
    } catch (Exception e) {
    throw new EJBException(e);
    return list.elements();
    In the session bean:
    public HolidayProfileHolidayVO[] getHolidayProfileHolidays(String
    holidayProfileID) throws ElmsFinderException
    HolidayProfileHolidayVO[] vos = null;
    ArrayList alst = new ArrayList();
    HolidayProfileHolidayHome hphHome =
    this.getHolidayProfileHolidayHome();
    try {
    java.util.Enumeration enum =
    hphHome.findByHolidayProfileID(holidayProfileID);
    while (enum.hasMoreElements()) {
    Object obj = enum.nextElement();
    HolidayProfileHoliday bean =
    (HolidayProfileHoliday)javax.rmi.PortableRemoteObject.narrow(obj,
    HolidayProfileHoliday.class);
    alst.add(bean.getVO());
    } catch (FinderException e) {
    // throw as new ElmsCheckedException subclass
    throw new ElmsFinderException("getHolidayProfileHolidays(id):
    Could not find HolidayProfileHolidays.", e);
    } catch (RemoteException e) {
    // throw as new ElmsUncheckedException
    throw new ElmsUncheckedException(
    "getHolidayProfileHolidays()", e);
    } catch (RuntimeException e) {
    throw new ElmsUncheckedException(e);
    if (alst.size()>0) vos =
    (HolidayProfileHolidayVO[])alst.toArray(new HolidayProfileHolidayVO[1]);
    return vos;

  • Java.io.NotSerializableException Problem

    I am getting the following exception when trying to serialize a Stack of objects.
    java.io.NotSerializableException: java.lang.reflect.Method
    The objects that I am trying to serialize already implements serializable.
    What could be the problem?

    The problem is that java.lang.Method is not serializable and some class somewhere has a non-static non-transient reference to a Method.

  • Java.io.NotSerializableException in WL6

    All,
              I have a servlet calling a user/group manager stateless session bean.
              The same code works well in WL5.1.0.
              Recently I migrated to WL6 and found there is a serialization problem.
              Rebuild the EJB jar with WL6 ejb
              compiler did not solve the problem. Here is the detail:
              In the remote interface I have a method called assignGroups().
              public interface InfUserGroupManager extends EJBObject {
              public void assignGroups(InfIIPSession session, InfDBObjectPK userPk,
              Collection groupIds)
              throws RemoteException, InfInsufficientPrivilegeException;
              In a servlet I have code like this:
              InfUserGroupManager mgr = ....; // Gets a reference to InfUserGroupManager
              stateless session bean.
              HashMap groups = .....; // Both keys and values are java.lang.Integer
              objects.
              Collection assignedGroups = groups.values();
              mgr.assignGroups(iipSession, userPk, assignedGroups);
              java.util.HashMap and java.lang.Integer are both serializable. However, when
              trying to invoke the
              assignGroups() method on the InfUserGroupManager object will raise
              exception.
              javax.servlet.ServletException: failed to marshal
              public abstract void
              com.informatica.security.manager.InfUserGroupManager.assignGroups
              (com.informatica.session.InfIIPSession,com.informatica.repository.InfDBObjec
              tPK,java.util.Collection)
              throws
              java.rmi.RemoteException,com.informatica.util.InfInsufficientPrivilegeExcept
              ion;
              nested exception is:
              java.io.NotSerializableException: java.util.HashMap$2
              at
              com.informatica.viewer.portal.servlets.commands.InfUserCmd.assignGroups(InfU
              serCmd.java:168)
              at
              com.informatica.viewer.portal.servlets.commands.InfUserCmd.saveModel(InfUser
              Cmd.java:132)
              at
              com.informatica.servlet.command.InfAbstractMultiFormCommand.execute(InfAbstr
              actMultiFormCommand.java:100)
              at
              com.informatica.servlet.InfCommandServlet.processRequest(InfCommandServlet.j
              ava:89)
              at
              com.informatica.servlet.InfCommandServlet.doPost(InfCommandServlet.java:67)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :208)
              at
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              ntext.java:1127)
              at
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              :1529)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

    We are getting this same error. Was any resolution found?
    "Steve Rolls" <[email protected]> wrote in message
    news:[email protected]..
    When binding non-serializable objects into the JNDI tree with WL6 + SP1,
    a java.io.NotSerializableException is thrown. This is in a non-cluster
    environment and the context's replicate bindings flag is set to false.
    Here is the WL portion of the exception's stack trace
    at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
    at java.util.Hashtable.writeObject(Hashtable.java:757)
    at java.lang.reflect.Method.invoke(Native Method)
    atjava.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java:1878)
    at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1210)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
    atweblogic.rmi.internal.CBVOutputStream.writeObjectInternal(CBVOutputStream.ja
    va:220)
    atweblogic.rmi.internal.CBVOutputStream.writeObject(CBVOutputStream.java:213)
    atweblogic.rmi.internal.CBVOutputStream.writeObject(CBVOutputStream.java:190)
    at weblogic.rmi.internal.ObjectIO.writeObject(ObjectIO.java:19)
    atweblogic.rmi.internal.BasicRemoteRef.marshalArgs(BasicRemoteRef.java:121)
    atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :246)
    atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :225)
    atweblogic.jndi.internal.ServerNamingNode_WLStub.bind(ServerNamingNode_WLStub.
    java:436)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:337)
    at javax.naming.InitialContext.bind(InitialContext.java:358)
    Is there some new setting in WL6 that controls this bevavior or is this abug?
    >
    thanks,
    Steve

  • Java.io.NotSerializableException in Query

    All,
    I am encountering a strange java.io.NotSerializable error on certain
    queries. I am using Kodo Std 2.2.6 (trial version) on RH7.1 with Postgres
    7.1 (inside a Struts 1.1 servlet running inside Tomcat 4.1).
    The error is the following: I am attempting to find "Resources" that have
    associated "File"s, where those files have "FileRole" == a particular
    FileRole object.
    The objects (simplified) are:
    public class Resource {
    File file;
    String driver;
    String driverId;
    public class File {
    FileRole fileRole;
    public class FileRole {
    String name;
    The query is:
    public List findByDriver(String driver, String driverId, FileRole fileRole)
    List li = null;
    try {
    String filter = "driver == driverString && driverId ==
    driverIdString && file.fileRole == theFileRole";
    Extent beanExtent =
    JDOManager.getInstance().getPersistenceManager().getExtent(Resource.class,
    false);
    Query q =
    JDOManager.getInstance().getPersistenceManager().newQuery(Resource.class,
    beanExtent, filter);
    q.declareImports("import lepton.core.file.File;" + "import
    lepton.core.file.FileRole");
    q.declareParameters("String driverString, String driverIdString,
    FileRole theFileRole);
    ArrayList queryArray = new ArrayList();
    queryArray.add(driver);
    queryArray.add(driverId);
    queryArray.add(fileRole);
    Collection results = (Collection) q.execute(queryArray);
    li = new ArrayList(results);
    } catch (Exception e) {
    throw new LeptonException(e);
    return li;
    The error is:
    javax.jdo.JDOException: lepton.core.file.FileRole
    NestedThrowables:
    java.io.NotSerializableException: lepton.core.file.FileRole
    at
    com.solarmetric.kodo.impl.jdbc.schema.dict.GenericDictionary.toSQL(GenericDi
    ctionary.java:169)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory$Constant.(JDBCE
    xpressionFactory.java:465)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory.getConstant(JDB
    CExpressionFactory.java:229)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCExpressionFactory.getParameter(JD
    BCExpressionFactory.java:249)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:563)
    at com.solarmetric.kodo.query.FilterParser.getValue(FilterParser.java:669)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:582)
    at
    com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:678)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:653)
    at
    com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:678)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:653)
    at
    com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:678)
    at com.solarmetric.kodo.query.FilterParser.eval(FilterParser.java:653)
    at
    com.solarmetric.kodo.query.FilterParser.getExpression(FilterParser.java:678)
    at com.solarmetric.kodo.query.FilterParser.evaluate(FilterParser.java:530)
    at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:502)
    at com.solarmetric.kodo.query.QueryImpl.getExpression(QueryImpl.java:468)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.getExpression(JDBCQuery.jav
    a:190)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:342)
    at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:529)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:314)
    at lepton.knowledgebase.ResourceHome.findByDriver(ResourceHome.java:91)
    My jdo mappings (simplified) are:
    Resource:
    <jdo>
    <package name="lepton.knowledgebase">
    <class name="Resource" >
    <field name="driver">
    </field>
    <field name="driverId">
    </field>
    <field name="file">
    </field>
    </class>
    </package>
    </jdo>
    File:
    <jdo>
    <package name="lepton.core.file">
    <class name="File" >
    <field name="fileRole">
    </field>
    </class>
    </package>
    </jdo>
    FileRole:
    <jdo>
    <package name="lepton.core.file">
    <class name="FileRole" >
    <field name="name">
    <extension vendor-name="kodo"
    key="column-index"
    value="true" />
    </field>
    </class>
    </package>
    </jdo>
    Any help/suggestions would be greatly appreciated. I am seeing this error
    in one other query, with a similar (but slightly more involved) syntax.
    (The point of commonality is querying a somewhat distant--but
    related--portion of the object graph, in the form xx.xx.xx == yy).
    Thanks,
    David
    David Sachs
    Redpoint Ventures
    [email protected]

    Abe,
    Thanks again for your help. I discovered (much to my embarassment) that
    this was a case of a massively silly error on my part, and a somewhat
    misleading error message.
    The cause of the problem was my query--Kodo is working great.
    I had:
    public List findByDriver(String driver, String driverId, FileRole fileRole)
    q.declareParameters("String driverString, String driverIdString,
    FileRole theFileRole);
    ArrayList queryArray = new ArrayList();
    queryArray.add(driver);
    queryArray.add(driverId);
    queryArray.add(fileRole);
    Collection results = (Collection) q.execute(queryArray);
    This should be:
    q.declareParameters("String driverString, String driverIdString,
    FileRole theFileRole);
    Map queryMap = new HashMap();
    queryMap.add(driver);
    queryMap.add(driverId);
    queryMap.add(fileRole);
    Collection results = (Collection) q.executeWithMap(queryMap);
    It works perfectly, as does the other case in which I saw a
    java.io.NotSerializable error.
    Anyway, sorry to have wasted your time on this, but maybe there is some way
    to make the reported error slightly more specific. As an aside, I did try
    to track down whether a superfluous jdo/kodo.jar was lurking anywhere in
    Kodo's classpath, but I didn't find anything. Clearly (since this now
    works), the properly enhanced FileRole class is present, but the error
    message was didn't indicate that I was wildly misusing the q.executeXXX
    facility.
    Anyway, thanks very much for your assistance, and sorry to have led you
    astray chasing down a user error.
    David
    "Abe White" <[email protected]> wrote in message
    news:[email protected]...
    I wasn't able to find a class called"javax.jdo.spi.PersistenceCapable"--did
    you mean just "javax.jdo.PersistenceCapable?"Yeah, sorry. In JDO 1.0 they moved PersistenceCapable to the 'spi'subpackage;
    Kodo 2.2.6 (unlike 2.3, which is out now), uses an older version of the spec.
    >
    Assuming that you meant javax.jdo.PersistenceCapable, my class reportsthat
    it IS persistence capable.Well I've checked our code (the version that you're using), and itcouldn't
    really be more clear. It's basically:
    if (obj instanceof PersistenceCapable)
    ... 1 ...
    else
    ... 2 ...
    And your stack trace ends up in position 2. That means that to Kodo, that
    object is not persistence capable. This has to be a class loader issue.
    I assume your install script is run outside of the servlet? Or in a
    different web app? Tomcat does some funky things with class loaders; ifyou
    have multiple JDO jars floating around there might also technically be
    multiple PersistenceCapable classes, and the one Kodo sees is differentthan
    the one your application sees. Make sure both the kodo jars and the jdojars
    are only in a single location.
    This makes sense, since I have been able to create and make persistent
    instances of the FileRole class. (I can successfully create a bunch of
    FileRoles and persist them to my database as part of my install script,
    which would alos fail were FileRole not enhanced).
    Any ideas?
    Thanks very much,
    David
    "Abe White" <[email protected]> wrote in message
    news:[email protected]...
    David --
    Before you execute the query, can you please check to see that
    (fileRole instanceof javax.jdo.spi.PersistenceCapable) ?
    If a parameter isn't persistence-capable, we try to convert it to SQL;
    for complex types, this means serializing it. I have a feeling there
    is
    a class loader issue or something where an unenhanced version of your
    class is sneaking in. Let us know what you find out.

  • Java.io.NotSerializableException when using POF over Extend

    I changed a class to use POF and it seems to work fine among TCMP cluster members but when apps connect with Extend I get an exception indicating that maybe either the extend proxy or client app is not correctly configured to use POF.
    (Wrapped) java.io.NotSerializableException: dj_quotes.DJ_Quote
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:269)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:22)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
            at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
            at com.tangosol.coherence.component.net.extend.Channel.send(Channel.CDB:6)
            at com.tangosol.coherence.component.net.extend.Channel.receive(Channel.CDB:55)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer$DaemonPool$WrapperTask.run(Peer.CDB:9)
            at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
            at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
            at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: java.io.NotSerializableException: dj_quotes.DJ_Quote
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
            at com.tangosol.util.ExternalizableHelper.writeSerializable(ExternalizableHelper.java:2252)
            at com.tangosol.util.ExternalizableHelper.writeObjectInternal(ExternalizableHelper.java:2696)
            at com.tangosol.util.ExternalizableHelper.serializeInternal(ExternalizableHelper.java:2600)
            at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
            at com.tangosol.coherence.component.net.extend.proxy.serviceProxy.CacheServiceProxy$ConverterToBinary.convert(CacheServiceProxy.CDB:3)
            at com.tangosol.util.ConverterCollections$AbstractConverterEntry.getValue(ConverterCollections.java:3547)
            at com.tangosol.io.pof.PofBufferWriter.writeMap(PofBufferWriter.java:1977)
            at com.tangosol.coherence.component.net.extend.message.Response.writeExternal(Response.CDB:23)
            at com.tangosol.coherence.component.net.extend.message.response.PartialResponse.writeExternal(PartialResponse.CDB:1)
            at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor.encodeMessage(TcpAcceptor.CDB:8)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
            ... 9 moreLooks like it failed while attempting default serialization, right?
    My extend proxy servers start with
    -Dtangosol.coherence.cacheconfig=cache-config-extend-proxy.xml
    here:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <!-- ***********  SCHEME MAPPINGS  ***********  -->
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>quotes.*</cache-name>
                   <scheme-name>quotes-scheme</scheme-name>
              </cache-mapping>   
         </caching-scheme-mapping>
         <!-- ******************************** -->
         <caching-schemes>
              <proxy-scheme>
          <service-name>ExtendTcpProxyService</service-name>
          <thread-count>8</thread-count>
          <acceptor-config>
            <tcp-acceptor>
              <local-address>
                <address system-property="tangosol.coherence.proxy.address">localhost</address>
                <port system-property="tangosol.coherence.proxy.port">9090</port>
              </local-address>
            </tcp-acceptor>
          </acceptor-config>
          <proxy-config>
                  <cache-service-proxy>
                    <lock-enabled>true</lock-enabled>
                  </cache-service-proxy>
                </proxy-config>
          <autostart>true</autostart>
        </proxy-scheme>
              <distributed-scheme>
                   <scheme-name>quotes-scheme</scheme-name>
                   <service-name>DistributedQuotesCacheService</service-name>
                   <serializer>
                        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                        <init-params>
              <init-param>
                <param-type>string</param-type>
                <param-value system-property="pof.config">z:/coherence/pof-config.xml</param-value>
              </init-param>
            </init-params>
                   </serializer>
                   <backing-map-scheme>
                        <local-scheme/>
                   </backing-map-scheme>
                   <autostart>true</autostart>
              </distributed-scheme>
    </caching-schemes>
    </cache-config>extend client apps start with
    -Dtangosol.coherence.cacheconfig=z:/coherence/cache-config-extend-client.xml
    here:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <!-- ***********  SCHEME MAPPINGS  ***********  -->
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>quotes.*</cache-name>
                   <scheme-name>extend-scheme</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <!-- ******************************** -->
         <caching-schemes>
              <remote-cache-scheme>
                    <scheme-name>extend-scheme</scheme-name>
                    <service-name>ExtendTcpCacheService</service-name>
                    <initiator-config>
                    <tcp-initiator>
              <remote-addresses>
                 <socket-address>
                  <address>192.168.3.6</address>
                  <port>9090</port>
                </socket-address>
              </remote-addresses>
              <connect-timeout>12s</connect-timeout>
            </tcp-initiator>
            <outgoing-message-handler>
              <request-timeout>6s</request-timeout>
            </outgoing-message-handler>
          </initiator-config>
        </remote-cache-scheme>
              <!-- ALSO TRIED THIS IN PLACE OF extend-scheme -->
                    <remote-cache-scheme>
          <scheme-name>extend-scheme-pof</scheme-name>
          <service-name>ExtendPofTcpCacheService</service-name>
                   <serializer>
                        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                        <init-params>
              <init-param>
                <param-type>string</param-type>
                <param-value system-property="pof.config">z:/coherence/pof-config.xml</param-value>
              </init-param>
            </init-params>
                   </serializer>
          <initiator-config>
            <tcp-initiator>
              <remote-addresses>
                <!-- mothra -->
                 <socket-address>
                  <address>192.168.3.6</address>
                  <port>9090</port>
                </socket-address>
              </remote-addresses>
              <connect-timeout>12s</connect-timeout>
            </tcp-initiator>
            <outgoing-message-handler>
              <request-timeout>6s</request-timeout>
            </outgoing-message-handler>
          </initiator-config>
        </remote-cache-scheme>
    </caching-schemes>
    </cache-config>pof-config.xml should be fine...
    <!DOCTYPE pof-config SYSTEM "pof-config.dtd">
    <pof-config>
      <user-type-list>
        <include>coherence-pof-config.xml</include>
        <user-type>
          <type-id>10001</type-id>
          <class-name>dj_quotes.DJ_Quote</class-name>
        </user-type>
      </user-type-list>
    </pof-config>Any ideas what I missed?
    Thanks,
    Andrew

    Looks like I spoke too soon. Moving the <serializer> to the correct location in the Extend client XML config did fix the problem I was seeing but it created a new problem. It appears the Extend client wants to use POF for everything including non-POF services like the one handling the Serializable (non-POF) object oms.Order. That's what I gather from this exception
    Exception in thread "AWT-EventQueue-0" (Wrapped) java.io.IOException: unknown user type: oms.Order
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:269)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:22)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
            at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
            at com.tangosol.coherence.component.net.extend.Channel.request(Channel.CDB:18)
            at com.tangosol.coherence.component.net.extend.Channel.request(Channel.CDB:1)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache$BinaryCache.putAll(RemoteNamedCache.CDB:10)
            at com.tangosol.util.ConverterCollections$ConverterMap.putAll(ConverterCollections.java:1702)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache.putAll(RemoteNamedCache.CDB:1)
            at com.tangosol.coherence.component.util.SafeNamedCache.putAll(SafeNamedCache.CDB:1)
            at oms.Order.sendMultiple(Order.java:357)
            at order_entry_window.OrderEntryPanel$SubmitListener.sendOrder(OrderEntryPanel.java:1307)
            at order_entry_window.OrderEntryPanel$SubmitListener.actionPerformed(OrderEntryPanel.java:1321)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
            at java.awt.Component.processMouseEvent(Component.java:6504)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
            at java.awt.Component.processEvent(Component.java:6269)
            at java.awt.Container.processEvent(Container.java:2229)
            at java.awt.Component.dispatchEventImpl(Component.java:4860)
            at java.awt.Container.dispatchEventImpl(Container.java:2287)
            at java.awt.Component.dispatchEvent(Component.java:4686)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
            at java.awt.Container.dispatchEventImpl(Container.java:2273)
            at java.awt.Window.dispatchEventImpl(Window.java:2713)
            at java.awt.Component.dispatchEvent(Component.java:4686)
            at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
            at java.awt.EventQueue.access$000(EventQueue.java:101)
            at java.awt.EventQueue$3.run(EventQueue.java:666)
            at java.awt.EventQueue$3.run(EventQueue.java:664)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
            at java.awt.EventQueue$4.run(EventQueue.java:680)
            at java.awt.EventQueue$4.run(EventQueue.java:678)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.io.IOException: unknown user type: oms.Order
            at com.tangosol.io.pof.ConfigurablePofContext.serialize(ConfigurablePofContext.java:341)
            at com.tangosol.util.ExternalizableHelper.serializeInternal(ExternalizableHelper.java:2596)
            at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache$ConverterToBinary.convert(RemoteNamedCache.CDB:4)
            at com.tangosol.util.ConverterCollections$AbstractConverterEntry.getValue(ConverterCollections.java:3547)
            at com.tangosol.io.pof.PofBufferWriter.writeMap(PofBufferWriter.java:1977)
            at com.tangosol.coherence.component.net.extend.messageFactory.NamedCacheFactory$PutAllRequest.writeExternal(NamedCacheFactory.CDB:3)
            at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
            ... 47 more
    Caused by: java.lang.IllegalArgumentException: unknown user type: oms.Order
            at com.tangosol.io.pof.ConfigurablePofContext.getUserTypeIdentifier(ConfigurablePofContext.java:420)
            at com.tangosol.io.pof.ConfigurablePofContext.getUserTypeIdentifier(ConfigurablePofContext.java:409)
            at com.tangosol.io.pof.PofBufferWriter.writeUserType(PofBufferWriter.java:1660)
            at com.tangosol.io.pof.PofBufferWriter.writeObject(PofBufferWriter.java:1622)
            at com.tangosol.io.pof.ConfigurablePofContext.serialize(ConfigurablePofContext.java:335)
            ... 56 moreSo I posted a follow-up question here:
    Can an extend client use both POF and java.io.Serializable?
    Thanks,
    Andrew

Maybe you are looking for