Deserializing a string

I need help with deserializing a string. The string looks like
FirstName1
LastName1
Address1
FirstName2
LastName2
Address2
FirstName3
LastName3
Address3
I want to deserialise this string into an array of person objects.
Thanks in advance.

J2ME does not support deserialize.
Create a format like below one
<firstName?lastName?address>
you encrypt your information in this formatted String. After that you can call getBytes() method it will give byte[]. you can store this byte array into recored Store (setRecord in RMS).
Whenever retrieve you can get byte array ,pass byte array to string constructor than you can get you information in above format.

Similar Messages

  • I need to send Obj A but not Obj B which is referenced

    I'm having a problem with my serialization. Here's the set up:
    The server creates an instance of Obj A and Obj B, which contain references to each other. I want to serialize Obj A and send it to the client, but not Obj B.
    First I tried setting Obj A's reference of Obj B to null right before I sent it to the client, but I kept getting Null Pointer Exception.
    Then I tried adding "transient" to Obj A's reference to Obj B, but now when Obj A appears on the client, the other fields are also blank. I assume this is because Java is ignoring Obj B and all of it's references including Obj A.
    Is there some way to void Obj A's reference to Obj B right before it's sent, without nulling Obj B completely?
    Thanks!
    Matt

    Then I tried adding "transient" to Obj A's reference to Obj B, but now when Obj A appears on the client, the other fields are also blank. I assume this is because Java is ignoring Obj B and all of it's references including Obj A.No. Something wrong here. Make objB transient in objA, and send objA. Everything else in objA should appear at the client. That's how I thought it should work, which is why I tried it in the first place...
    Is there some way to void Obj A's reference to Obj B right before it's sent, without nulling Obj B completely? Setting objA.objB to null doesn't 'null objB completely'. It does nothing to the object B, only to A's reference to it.
    That's what I thought, but it again it didn't work, so I guess I then wrongly assumed that it was nullying Obj B (which doesn't really make sense, and of course it's wrong).
    Ok here's the object I serialize and send:
    public class Info implements Serializable{
        Client clientInfo;
        String cmd;
        ArrayList<String> handleList = new ArrayList<String>();
        ArrayList<Territory> list = new ArrayList<Territory>();
    some methods....Then there's the Client class, which is where the problem is (Obj A from my first post)
    public class Client implements Serializable {
        public int ID;
        String handle;
        public ClientThread threadName;
        public int money;
        public ArrayList<Territory> ownTerrList = new ArrayList<Territory>();
        public ArrayList moveList = new ArrayList();
        public ArrayList attackList = new ArrayList();
        public ArrayList buildList = new ArrayList();
    some methods....Then the ClientThread class (Obj B from my first post), which is what's causing the problems because I think it cannot be serialized because it's a thread, is that correct?
    Notice that the Client class above contains a reference to ClientThread threadName, which is the corresponding instance/thread of the class below, which contains a reference to the Client class above, Client client (so Obj A has a reference to Obj B and Obj B has a reference to Obj A):
    public  class ClientThread implements Runnable, Serializable{
            Client client;
            Socket connection;
            String msg;
            ObjectInputStream objIn;
            ObjectOutputStream objOut;
            Info courier = new Info();
            C2Server server = null;
            public ClientThread(Socket connection, C2Server server, int id){
                this.server = server;
                this.client = new Client();
                this.client.ID = id;
                this.connection = connection;
                this.client.threadName = this;
                server.addClient(client);
    a run method...
    some other methods....
           My normal procedure for sending the information across the network is:
    1) Update the Client instance which is inside the Info instance, which is the object sent.
    2)Send
    Then I started getting errors and problems so I started doing this:
    1)Update the Client instance which is inside the Info instance, which is the object sent.
    2) Set the Client instance's reference to the ClientThread instance to null (threadName =null)
    3) Send
    When the Info instance "gets" to the other side and is deserialized, the String cmd and ArrayList handleList are intact, but the ArrayList list and ArrayList ownTerrList (inside the Client instance) are both empty. I know those ArrayLists are full before I send because I do a System.out.println on them and they print out correctly with objects for each of my threads. They are full on the server side, then empty on the client side, and I can't figure out what the problem is. What might cause some of the fields in an object to be deserialized incorrectly while others are fine?
    Thanks.
    Matt

  • How to fix a problem with the order of strings in a JSON response for a CFHTTP request?

    Good morning, guys! (It's 10:50 a.m. in Brazil)
    First of all, I'm still new at CF and my questions may seem too much silly and my English's not the best, so, please be patient with me. hehe
    Well, I'm accessing a link via CFHTTP that gives me a JSON response. I'm not familiar with JSON yet, so I'm working it as a string and using string functions (Find,RemoveChars,Replace,etc), but it happens to me that I'm receiving a certain kind of order of the strings list from the JSON when I access it directly from the browser and other kind of order totally different when I access it from the CFHTTP.
    I only figured it out because I was working at home with my code and there everything went just fine as expected. Then I brought to my job to develop a little bit more as soon as I get a free time and here my code doesn't work anymore. When I took a look at the JSON by a CFOUTPUT, I realized the strings were in a different order.
    Does anyone know why is it happening?
    Link to the JSON: http://sigmine.dnpm.gov.br/ArcGIS/rest/services/extra/dados_dnpm/MapServer/0/query?text=83 0620/2012&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelInter sects&where=&returnGeometry=true&outSR=&outFields=FID,Shape,PROCESSO,ID,NUMERO,ANO,AREA_HA ,FASE,ULT_EVENTO,NOME,SUBS,USO,UF&f=pjson
    Basic code simplified to find out that the order of strings were coming different when access by CFHTTP:
    <cfhttp url="#URLAbove#" method="get" result="DadosDoDNPM" charset="utf-8" timeout="10000" />
    <cfset DadosJSON = deserializeJSON(DadosDoDNPM.FileContent) />
    <cfif arrayLen(DadosJSON.features)>
        <cfset CodigoFonteJSON = ToString(serialize(DadosJSON.features)) />   
        <cfoutput> #CodigoFonteJSON# </cfoutput>
    </cfif>
    Is there a way to fix it and to make my code work everywhere?
    If it matters, I use Railo at home and at my job.
    Since now, I thank you.

    When you deserialize JSON data, ColdFusion converts it into native structures and arrays (roughly equivalent to JavaScript objects and arrays).  In ColdFusion, structures are unordered (that is, they don't maintain keys in any particular ordered sequence).
    This really shouldn't be a problem though, at least not if you just want to work with the data contained in the deserialized JSON structure.  So DadosJSON should be a native ColdFusion structure, and you can interact with it like any other structure in ColdFusion.  In fact, you should not have to re-serialize it at all unless you need to send it to an external application using JSON.
    Why are you reserializing the data?  And why use serialize() instead of serializeJSON()?
    -Carl V.

  • How to get XMP MetaData as an XML String in a process?

    Hi there,
    I have a process where I would like to export a documents XMP MetaData, manipulate the XMP MetaData and then import the MetaData again to the document.
    I thougt first I will use the service Name "XMPUtilityService" with the Service Operation "Export XMP" to export the XMP MetaData as a document.
    Hoewer I am not sure how to manipulate the output document from the Export XMP service.
    When I print out the document.toString() in a execute Script Service I get the following:
    <document state="active" senderVersion="0" persistent="false" senderPersistent="false" passivated="false" senderPassivated="false" deserialized="false" senderHostId="null" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="3440" contentType="null" length="-1"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGl obalBackendId/><inline><?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="A...</inline><senderPullServantJndiName/><attributes/></document>
    Actually I expected something like this:
    <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-jc006 DEBUG-1.0, 2009 Jun 23 11:07:21-PDT">
       <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
          <rdf:Description rdf:about=""
                xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
             <pdf:Producer>Adobe LiveCycle PDF Generator ES2</pdf:Producer>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
             <xmp:ModifyDate>2010-04-20T20:43:59+02:00</xmp:ModifyDate>
             <xmp:MetadataDate>2010-04-20T20:43:59+02:00</xmp:MetadataDate>
          </rdf:Description>
          <rdf:Description rdf:about=""
                xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
             <xmpMM:DocumentID>uuid:0cf2c6c6-2fba-2b39-5fb6-33ad8ccf58aa</xmpMM:DocumentID>
             <xmpMM:InstanceID>uuid:187bc5a2-acb0-2fa9-711d-33ad8ccf58aa</xmpMM:InstanceID>
          </rdf:Description>
       </rdf:RDF>
    </x:xmpmeta>
    <?xpacket end="w"?>
    What do I need to do to get the XMPMeta data as an XML String from a document within a process?
    Thanks in advance!
    Paul

    Hi,
    thanks for the answer.
    I know that I can retrieve the XMPUtilityMetadata object, but this object provides only access to a few information suche as creator, subject, producer, etc.
    However I would like to retrieve the whole XML String of the XMP Metadata.
    How is this possible?
    Thanks.
    Paul

  • [java.nio] StreamCorruptedException when deserializing objects

    Hello everybody!
    I made a messaging (chat) program using java.io where all the client-server communication is done by serializing small objects. Now I would like to covert the server side to the NIO concept and I'm already struck. I successfully pass objects to the client and the client deserializes them, but only the first one! When it try to read the second it fails with a StreamCorruptedException.
    Here�s a sample (testing) code. In the server run() method I first serialize a string, then get its byte array from ByteArrayOutputStream and in the loop periodically send this byte array through the channel. On the client side I just read the deserialized object.
    Server run():
    public void run() {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                oos.writeObject("abcdefgh");
                byte[] objectArr = baos.toByteArray();
                baos.close();
                oos.close();
                ByteBuffer buff = ByteBuffer.allocate(objectArr.length);
                buff.put(objectArr);
                buff.flip();
                while(true) {
                    selector.select();
                    Set keys = selector.selectedKeys();
                    for (Object o : keys) {
                        SelectionKey key = (SelectionKey)o;
                        if (key.isAcceptable()) {
                            ServerSocketChannel server = (ServerSocketChannel) key.channel();
                            clientChannel = server.accept();
                            if (clientChannel == null)
                                continue;
                            clientChannel.configureBlocking(false);
                            SelectionKey clientKey = clientChannel.register(selector, SelectionKey.OP_WRITE);
                        } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                    try {
                        Thread.currentThread().sleep(2000);
                    } catch (InterruptedException e) {
                        return;
            } catch (IOException e) {
                e.printStackTrace();
        }Client run():
    public void run() {
            try {
                soc = new Socket("localhost", 4000);
                ObjectInputStream ois = new ObjectInputStream(soc.getInputStream());
                while(true) {
                    Object d = ois.readObject();
                    System.out.println("data = " + d.toString());
            } catch (Exception ex) {
                ex.printStackTrace();
        }At the second read I get a StreamCorruptedException.
    Apart from this I would like some hints in how to implement the application with NIO. For example how can I tell the objects apart on the client side � should I send every time a byte array before the object, which tells the length of the next coming object? This is probably not a 100% bulletproof solution and presents additional data transfer?
    Than you in advance!

    OK, I found a solution but I don't like it, because I don't understand it.
    The ObjectOutputStream adds a header (4 bytes) to the stream - if I send the array with those four bytes I get an StreamCorruptedException. If I send the array without the header I also get a StreamCorruptedException: "invalid stream header".
    If I reconstruct the object, by calling ObjectOutputStream.writeObject() and get it's byte array from ByteArrayOutputStream.toByteArray(), every time I have to fill the ByteBuffer, then it works.
    Here's the modified sending block, for the above example:
    } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                //* ---- added code ---------
                                baos.reset();
                                oos.writeObject("abcdefgh");
                                objectArr = baos.toByteArray();
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                        }   I really don't understand why I have to write the object in the object stream every time. I used ObjectOS and ByteArrayOS, to get the object byte array and then I thought I could forget about those streams and use this array to fill the ByteBuffer. What changes if I send the object through this process with every iteration (and how this harms speed - it's like sending everything twice)? If someone would explain this to me I would appreciate it much.

  • A very very strange issue on BlazeDS Deserializing

    Hi all,
    I run into a very very strange issue on BlazeDS Deserializing. Is there any hint or idea?  Thanks a lot!
    Scenario 1:
    Both the browser(firefox or IE) and the midtier (BlazeDS ,java) are on the same machine.
    Actual result:
    Everything works fine.  All the properties in the Flex Object could be mapped to the Java Class
    Scenario 2:
    The browser(firefox or IE) and the midtier (BlazeDS ,java) are on the different machine.
    Actual result:
    Sometimes it works fine.
    And most of the time it does not work fine. Only the data in List is mapped correctly. All the values of simple data type such as int are mapped to 0 .
    Let me simplify the problem.
    The objects of Class B is always stored in the ArrayCollection  assocItems of Class A
    Flex side:
    public class A {
    public var id: int;
    public var  name: String;
    public var assocItems: ArrayCollection=new ArrayCollection();
    public class B {
    public var id: int;
    public var  assocItems : ArrayCollection=new ArrayCollection();
    The id , name in Flex Class A and assocItems in Class B could be  deserialize to correct value .  But the id of Class B is always mapped to 0. This is not correct.
    The log level of BlazeDS is configured to Debug. From the log I can see that  each value is passed from Flex side to Java server side correctly.
    [BlazeDS][INFO] Channel endpoint my-amf received request.
    [BlazeDS][DEBUG] Deserializing AMF/HTTP request
    Version: 3
    (Message #0 targetURI=null, responseURI=/18)
    (Array #0)
    [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
    However, the Java object does not get the correct value of B.id.
    In conclusion,
    1. It’s an issue with only default types
    2. It does not occur every time
    3. It does not occur when the browser(firefox or IE) and the midtier (BlazeDS ,java) are on the same machine
    Have you ever run into the similar problems? And what’s your solution?

    I checked, when I hard-code the constant in linq, the generated sql is like this:
    SELECT "Extent1"."AA" AS "AA"
    FROM (SELECT "TBL"."AA" AS "AA"
    FROM "USERNAME"."TBL" "TBL") "Extent1"
    WHERE ('1062303212007000121' = "Extent1"."AA")
    if I pass a variable to the query with same value, the sql is like this:
    SELECT "Extent1"."AA" AS "AA"
    FROM (SELECT "TBL"."AA" AS "AA"
    FROM "USERNAME"."TBL" "TBL") "Extent1"
    WHERE ("Extent1"."AA" = '1062303212007000121' /* @p__linq__0 */) (@p__linq__0 is passed as parameter)
    The only difference is a paramter. I can't figure out why there is such a impact on performance.

  • Deserializing an XML to object in an RFC : HELP

    The requirement in my project is that I pass the Serialized XML String to a Remote Function Module by calling the RFC. In the RFC, I need to deserialize the XML to corresponding class instances/Objects.
    CALL TRANSFORMATION id
    SOURCE XML i_xml
    RESULT ref = O2 .
    But this stmt throws an exception in d RFC stating
    XML_INVALID_REF A non-existent objectID was referenced (property href).
    I have no ideas of getting this work. Please help me if u have any information about it. Looking fwd.. U can as well mail me ur inputs to [email protected]
    Thanks,
    Srikanth

    i am not sure about  deserializing xml ..check this blog ..it has some information about it..
    /people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
    <b>reward if useful..</b>
    Message was edited by: Ashok Kumar Prithiviraj

  • Problems displaying deserialized components

    I'm trying to save the state of some objects which extend JComponent and JLayeredPane, and they don't all redisplay on deserializing, although they seem to be in the containment tree.
    Basically, I have a class GamePanel which extends JLayeredPane. Also classes Square and Region both of which extend JComponent and use 2D graphics for painting themselves. It seems to serialize OK (but how does one tell?). But when I deserialize, only the lower level of the GamePanel is painted. However, the higher level is populated.
    Does anyone have any idea why they're not displaying? The code is below (TestKiller and its menus are generated by NetBeans - hence the slightly odd code). There are 5 menu items (I've simplified a lot from the original so it's a bit clunky): Add Region (you can only do this once in this version), Save As which serializes to a file, Restore which deserializes from a file, Exit which is obvious and Print which outputs the containment hierarchy of GamePanel to standard output.
    If you want to try it out, fire up the program, do a File|Add to add a Region (see the dotted lines) and File|Print to see that there's a Square at level 2 and a Region at level 3. Then File|Save as... to save it. Quit the program.
    Fire it up again and do a File|Restore and a File|Print. You'll see from the output that the Square and Region are there with identical parameters to the output before, but the Region hasn't displayed its outline.
    The output's below, with java-like comments added to show what I've done:
    D:>java -jar test*
    Painting gridlayer
    // File|Add Region
    New region 1
    Selecting square
    Checking region 1
    Painting gridlayer
    Painting region 1
    //File|Print
    Printing Gamepanel components
    com.ptoye.TestSBug1.Region[Region-1,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minim
    umSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 3
    com.ptoye.TestSBug1.Square[Square-0:0,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=16777224,maximumSi
    ze=,minimumSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 2
    \\File|Save
    Saving game to bug1.ksd
    D:>java -jar test*
    Painting gridlayer
    \\File|Restore
    Restoring game bug1.ksd
    Restored
    \\File|Print - same as above but only Square is displayed
    Printing Gamepanel components
    com.ptoye.TestSBug1.Region[Region-1,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minim
    umSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 3
    com.ptoye.TestSBug1.Square[Square-0:0,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=16777224,maximumSi
    ze=,minimumSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 2
    D:>
    Please someone tell me what I'm doing wrong. As a serialization newbie it's probably something simple, but no amount of validate() and pack() makes any difference.
    The code's below - a bit long I'm afraid but it's difficult to cut it down much more and display the problem. The main class (TestKiller) was generated by NetBeans.
    * TestKiller.java
    * Created on 01 August 2006, 22:13
    package com.ptoye.TestSBug1;
    import java.io.File;
    import java.io.FileFilter;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    * @author  PToye
    public class TestKiller extends javax.swing.JFrame {
      private GamePanel p;
      final String fileExtension="ksd";
       * Creates new form TestKiller
      public TestKiller() {
        initComponents();
        p=new GamePanel();
        setContentPane(p);
        p.setOpaque(true);
        setSize(p.getPreferredSize());
        pack();
      public static void showMessage(String s) {
        JOptionPane.showMessageDialog(null,s,"Error",JOptionPane.ERROR_MESSAGE);
      /** This method is called from within the constructor to
       * initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is
       * always regenerated by the Form Editor.
      private void initComponents() {                         
        jMenuBar1 = new javax.swing.JMenuBar();
        jmFile = new javax.swing.JMenu();
        jmiAddRegion = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jmiSaveAs = new javax.swing.JMenuItem();
        jmiRestore = new javax.swing.JMenuItem();
        jmiExit = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jmiPrint = new javax.swing.JMenuItem();
        FormListener formListener = new FormListener();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Restore bug");
        jmFile.setText("File");
        jmiAddRegion.setText("Add region");
        jmiAddRegion.addActionListener(formListener);
        jmFile.add(jmiAddRegion);
        jmFile.add(jSeparator2);
        jmiSaveAs.setMnemonic('s');
        jmiSaveAs.setText("Save as...");
        jmiSaveAs.addActionListener(formListener);
        jmFile.add(jmiSaveAs);
        jmiRestore.setMnemonic('r');
        jmiRestore.setText("Restore");
        jmiRestore.addActionListener(formListener);
        jmFile.add(jmiRestore);
        jmiExit.setMnemonic('x');
        jmiExit.setText("Exit");
        jmiExit.addActionListener(formListener);
        jmFile.add(jmiExit);
        jmFile.add(jSeparator1);
        jmiPrint.setText("Print");
        jmiPrint.addActionListener(formListener);
        jmFile.add(jmiPrint);
        jMenuBar1.add(jmFile);
        setJMenuBar(jMenuBar1);
        pack();
      // Code for dispatching events from components to event handlers.
      private class FormListener implements java.awt.event.ActionListener {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          if (evt.getSource() == jmiSaveAs) {
            TestKiller.this.jmiSaveAsActionPerformed(evt);
          else if (evt.getSource() == jmiRestore) {
            TestKiller.this.jmiRestoreActionPerformed(evt);
          else if (evt.getSource() == jmiExit) {
            TestKiller.this.jmiExitActionPerformed(evt);
          else if (evt.getSource() == jmiPrint) {
            TestKiller.this.jmiPrintActionPerformed(evt);
          else if (evt.getSource() == jmiAddRegion) {
            TestKiller.this.jmiAddRegionActionPerformed(evt);
      private void jmiAddRegionActionPerformed(java.awt.event.ActionEvent evt) {                                            
        p.dummyAdd();
        jmiAddRegion.setEnabled(false);
      private void jmiPrintActionPerformed(java.awt.event.ActionEvent evt) {                                        
        p.print();
      private void jmiSaveAsActionPerformed(java.awt.event.ActionEvent evt) {                                         
        File f;
        ObjectOutputStream oos=null;
        JFileChooser jfc=new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jfc.setMultiSelectionEnabled(false);
        jfc.addChoosableFileFilter(jfc.getAcceptAllFileFilter());
        jfc.addChoosableFileFilter(new KDSFileFilter());
        jfc.showSaveDialog(this);
        f=jfc.getSelectedFile();
        if (f==null) {
          showMessage("Null file found");
        int i=f.getName().lastIndexOf(".");
        if (i==-1) {
          f=new File(f.getAbsolutePath()+"."+fileExtension);
        try {
          oos=new ObjectOutputStream(new FileOutputStream(f));
        } catch (FileNotFoundException ex) {
          showMessage("Cannot find file "+f.getName());
          return;
        } catch (IOException ex) {
          showMessage("Cannot open file "+f.getName());
          return;
        if (oos!=null) {
          System.out.println("Saving game to "+f.getName());
          try {
            oos.writeObject(p);
          } catch (IOException ex) {
            showMessage("Cannot write game to "+f.getName()+"\n"+ex.getMessage());
          } finally {
            try {
              oos.close();
            } catch (IOException ex) {
      private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {                                       
        System.exit(0);
      private void jmiRestoreActionPerformed(java.awt.event.ActionEvent evt) {                                          
        File f;
        ObjectInputStream ois=null;
        JFileChooser jfc=new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jfc.setMultiSelectionEnabled(false);
        jfc.addChoosableFileFilter(jfc.getAcceptAllFileFilter());
        jfc.addChoosableFileFilter( new KDSFileFilter());
        jfc.showOpenDialog(this);
        f=jfc.getSelectedFile();
        if (f!=null) {
          try {
            ois=new ObjectInputStream(new FileInputStream(f));
          } catch (FileNotFoundException ex) {
            showMessage("Cannot find file "+f.getName());
            return;
          } catch (IOException ex) {
            showMessage("Cannot open file "+f.getName());
            return;
          if (ois!=null) {
            System.out.println("Restoring game "+f.getName());
            try {
              p=(GamePanel) ois.readObject();
            } catch (IOException ex) {
              showMessage("Cannot read game from file "+f.getName());
            } catch (ClassNotFoundException ex) {
              showMessage("Cannot restore game - wrong object type");
            try {
              ois.close();
            } catch (IOException ex) {
            pack();
            p.validate();
            p.repaint();
            System.out.println("Restored");
      private class KDSFileFilter extends javax.swing.filechooser.FileFilter {
        public boolean accept(File f) {
          if (f.isDirectory()) {
            return true;
          String ext = null;
          String s = f.getName();
          int i = s.lastIndexOf('.');
          if (i > 0 &&  i < s.length() - 1) {
            ext = s.substring(i+1).toLowerCase();
          return (ext==null || ext.equalsIgnoreCase(fileExtension));
        public String getDescription() {
          return "Killer Su Doku games";
       * @param args the command line arguments
      public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
            new TestKiller().setVisible(true);
      // Variables declaration - do not modify                    
      private javax.swing.JMenuBar jMenuBar1;
      private javax.swing.JSeparator jSeparator1;
      private javax.swing.JSeparator jSeparator2;
      private javax.swing.JMenu jmFile;
      private javax.swing.JMenuItem jmiAddRegion;
      private javax.swing.JMenuItem jmiExit;
      private javax.swing.JMenuItem jmiPrint;
      private javax.swing.JMenuItem jmiRestore;
      private javax.swing.JMenuItem jmiSaveAs;
      // End of variables declaration                  
    * GamePanel.java
    * Created on 10 January 2007, 18:45
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
    import javax.swing.JLayeredPane;
    * @author PToye
    public class GamePanel extends JLayeredPane implements Serializable {
      private static final int GRID_LEVEL=2;
      private static final int REGIONS_LEVEL=3;
      private static final int THICK_WIDTH=4;
      private static final int THIN_WIDTH=1;
      static final int SQUARE_SIZE=60;
      private static final int SQUARES=1;  // test size
      static final int BIGSQUARES=SQUARES*SQUARES;
      static final int TotalSize=(SQUARES+1)*THICK_WIDTH+SQUARES*(SQUARES-1)*THIN_WIDTH+
          BIGSQUARES*SQUARE_SIZE;
      public final Color NORMAL_BACK_COLOUR=Color.WHITE;
      public final Color SELECTED_BACK_COLOUR=Color.PINK;
      int coordArray;  // used to be an array of start coords of each square
      private Region newRegion;
      private int regionId=1;
      private Square squareArray; // used to be an array
      private Region regions; // used to be a set
      /** Creates a new instance of GamePanel */
      public GamePanel() {
        super();
        regions=null;
        makeGridLayer();  //adds the white square
        setPreferredSize(new Dimension(TotalSize,TotalSize));
        setVisible(true);
        newRegion=null;
        setFocusable(true);
      public void dummyAdd() {
        setupRegion(squareArray);
        if (newRegion.checkNewRegion(1)) {
          addRegion(newRegion);
      public void addRegion(Region r) {
        if (regions==null) {
          regions=r;
          add(r,new Integer(REGIONS_LEVEL));
          r.repaint();
      void print() {
        Component[] cList=getComponents();
        System.out.println("Printing Gamepanel components");
        for (int i = 0; i < cList.length; i++) {
          Component c=cList;
    System.out.println(c.toString());
    System.out.println(" Bounds "+c.getBounds());
    System.out.println(" Layer "+getLayer(c));
    if (c instanceof Container) {
    printContainer((Container)c," ");
    void printContainer(Container c, String preString) {
    Component[] cList1=c.getComponents();
    for (int i = 0; i < cList1.length; i++) {
    Component comp=cList1[i];
    System.out.println(preString+comp.toString());
    System.out.println(preString+" Bounds "+comp.getBounds());
    if (comp instanceof Container) {
    printContainer((Container)comp,preString+" ");
    private void setupRegion(Square s) {
    if (newRegion==null) {
    newRegion=new Region(regionId++,this);
    Region r=s.getRegion();
    if (r==null) {
    newRegion.addSquare(s);
    selectSquare(s);
    s.setRegion(newRegion);
    } else {
    System.exit(1); // should not happen
    private void makeGridLayer() {
    int currentXCoord;
    int currentYCoord;
    int arrayIndex=0;
    Square sq;
    currentXCoord=THICK_WIDTH;
    currentYCoord=THICK_WIDTH;
    coordArray=currentYCoord;
    sq=new Square(0,0, NORMAL_BACK_COLOUR,this);
    add(sq,new Integer(GRID_LEVEL));
    squareArray=sq;
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    System.out.println("Painting gridlayer");
    g2.setBackground(Color.BLACK);
    g2.setColor(Color.BLACK);
    g2.fillRect(0,0,TotalSize,TotalSize);
    void selectSquare(Square s) {
    System.out.println("Selecting square");
    s.setBackColour(SELECTED_BACK_COLOUR);
    * Square.java
    * Created on 28 December 2006, 15:53
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.io.Serializable;
    import javax.swing.JComponent;
    * @author PToye
    class Square extends JComponent implements Serializable {
    * X index in grid
    private int xIndex;
    * Y index in grid
    private int yIndex;
    * The square's parent grid
    private GamePanel parent;
    * Region it belongs to (or null if none)
    private Region region;
    * The background colour
    private Color backColour;
    private boolean marked;
    // public Square() {
    // System.out.println("New Square - null constructor");
    // addMouseListener(parent);
    * Create a new square
    public Square(int x, int y, Color bcol, GamePanel parent) {
    this.parent=parent;
    xIndex=x;
    yIndex=y;
    backColour=bcol;
    region=null;
    setName("Square-"+x+":"+y);
    setBounds(parent.coordArray,parent.coordArray,
    GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    setOpaque(true);
    setVisible(true);
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    // System.out.println("Painting square "+xIndex+","+yIndex+":"+getBounds());
    g2.setColor(backColour);
    g2.fillRect(0,0,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    g2.setColor(Color.BLACK);
    public Dimension getPreferredSize() {
    return new Dimension(GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    public void setBackColour(Color backColour) {
    this.backColour = backColour;
    repaint(0,0,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    public Region getRegion() {
    return region;
    public void setRegion(Region region) {
    this.region = region;
    * Region.java
    * Created on 28 December 2006, 15:59
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.GeneralPath;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JComponent;
    * @author PToye
    * Class representing a region whose total sum is known
    public class Region extends JComponent implements Serializable {
    private static final float BORDER_WIDTH=1f;
    private static final float DASH_LENGTH=4f;
    private static final float[] dashes={DASH_LENGTH,DASH_LENGTH};
    private static final BasicStroke borderStroke=
    new BasicStroke(BORDER_WIDTH,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,
    1f,dashes,0);
    private static final int borderInset=3;
    private GamePanel parent;
    * The sum as given
    private int total;
    private String totalString;
    private int id;
    * The squares constituting the region
    private Square contents; // the square in the region
    private Square leadSquare; // top left-hand square
    private int leadXCoord,leadYCoord; // X, Y coords of lead square wrt border
    private GeneralPath border=null;
    public Region(int id, GamePanel parent) {
    super();
    this.id=id;
    this.parent=parent;
    setName("Region-"+id);
    contents=null;
    border=new GeneralPath();
    System.out.println("New region "+id);
    public void addSquare(Square s) {
    if (contents!=null) {
    contents=s;
    public boolean checkNewRegion(int tot) {
    System.out.println("Checking region "+id);
    border.moveTo(borderInset,borderInset);
    border.lineTo(GamePanel.SQUARE_SIZE-borderInset,borderInset);
    border.lineTo(GamePanel.SQUARE_SIZE-borderInset,GamePanel.SQUARE_SIZE-borderInset);
    border.lineTo(borderInset,GamePanel.SQUARE_SIZE-borderInset);
    border.lineTo(borderInset,borderInset);
    setBounds(parent.coordArray,parent.coordArray,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    repaint();
    return true;
    public void paintComponent(Graphics g) {
    int newX, newY;
    System.out.println("Painting region "+id);
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    g2.setColor(Color.BLACK);
    g2.setStroke(borderStroke);
    g2.draw(border);

    OK, I asked the FTE team and got this reply: "Lucida Grande is CTS's fallback font for Thai.  This font on OS 10.7 and 10.6 are not supporting Thai anymore.  The version on 10.5 was supporting it." This means that it's our bug that we keep using Lucida Grande as fallback font even Apple dropped support Thai script with that font after 10.6. Unfortunately this bug was deferred from current development release (11.2) because of time constraint. If this support is critical for your business, can you open a bug in our public bugbase and ask as many vote as possible? In this way I may be able to convince internal team to fix this bug in next release.
    Thank you for your feedback!
    Hitomi

  • Error deserializing arguments, xml tag without a recognized type

    I am trying to run a webservice created using Weblogic Workshop 8.1sp2 that communicates
    with an ejb control. When I test in debug mode, I get the above error, specifically:
    <detail>
    <jwErr:jwErrorDetail xmlns:jwErr="http://www.bea.com/2002/04/jwErrorDetail/">
    com.bea.wlw.runtime.core.request.RequestValidationException: Error deserializing
    arguments.
    Encountered an xml tag without a recognized type: the type must be declared with
    an xsi:type attribute.
    Caused by: com.bea.xml.marshal.XmlEncodingException: Encountered an xml tag with
    out a recognized type: the type must be declared with an xsi:type attribute.
    </detail>
    I am passing a Request object to the jws method (to the ejb) that has a Collection
    as an instance member. This Collection references objects of another type, Param
    (code for both objects below). Before passing the object, I convert the Collection
    to an array of objects. When I call the operation via a java client, I get the
    above message.
    In Workshop, I've included the Request and Param classes as the parameter xml
    and the soap style is rpc. I've tested the ejb by itself and it is working fine.
    Request.java:
    import java.util.*;
    public class Request implements java.io.Serializable
    protected Collection params=null;
    public Collection getParams()
    { return params; }
    public void setParams(Collection data)
    { params=data; }
    Param.java:
    public class Param implements java.io.Serializable
    private String name=null;
    private Object value=null;
    public String getName()
    { return name; }
    public void setName(String data)
    { name = data; }
    public Object getValue()
    { return value; }
    public void setValue(Object data)
    { value=data; }
    Here's the code from the jws:
    public class MyWS implements com.bea.jws.WebService
    * @common:control
    private control.PSEjbControl psEJB;
    static final long serialVersionUID = 1L;
    * @common:operation
    * @jws:parameter-xml
    * include-java-types="mypackage.Request mypackage.Param"
    * @jws:protocol soap-style="rpc"
    public void addData(mypackage.Request arg0) throws java.rmi.RemoteException
    System.out.println("arg0 : " + arg0);
    psEJB.addData(arg0);
    *Note: in the server console, arg0 comes through as null when called from my client.
    Here's the bit from my client:
    import weblogic.jws.proxies.*;
    import org.openuri.www.encodedTypes.Request;
    import org.openuri.www.encodedTypes.Param;
    public void go(String wsdl) throws Exception {
    MyWSSoap mw = null;
    mw = new MyWS_Impl().getMyWSSoap();
    Request req = new Request();
    Collection reqColl = new ArrayList();
    Param param1 = new Param();
    param1.setName("NAME");
    param1.setValue("Joe Tester");
    Param param2 = new Param();
    param2.setName("ADDRESS");
    param2.setValue("345 Test Drive");
    reqColl.add(param1);
    reqColl.add(param2);
    Object[] obs = reqColl.toArray();
    req.setParams(obs);
    mw.addData(req);
    Not sure if this enough to go by. Please let me know if you need more information.
    Any help is really appreciated. Thanks.

    Hi Keith,
    My only suggestion is to factor out the java.util.Collection (see the
    docs here [1]) with either primitive types or XMLBeans [2].
    Sorry, not much help. You might also ask your question in the workshop
    [3] newsgroup.
    Bruce
    [1]
    http://e-docs.bea.com/workshop/docs81/doc/en/integration/reference/refJavaClassConversion.html
    [2]
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/xmlbeans/conXMLBeansSupportBuiltInSchemaTypes.html
    [3]
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.workshop
    Keith wrote:
    >
    Hi Bruce, thanks for the reply. I set the operation for document-style soap and
    still get the deserialization exception as mentioned in my original note. Below
    is the wsdl. Note: in my original note, the problematic operation was addData()
    which is now named addBusinessLocation(). As always, your help is greatly appreciated.
    Keith
    <?xml version="1.0" encoding="utf-8"?>
    <!-- @editor-info:link autogen="true" source="PublicServiceWS.jws" -->
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/"
    xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    targetNamespace="http://www.openuri.org/">
    <types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/"
    xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:ope="http://www.openuri.org/">
    <s:element name="addBusinessLocation">
    <s:complexType>
    <s:sequence>
    <s:element name="arg0" type="ope:Request" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    <s:element name="addBusinessLocationResponse">
    <s:complexType>
    <s:sequence/>
    </s:complexType>
    </s:element>
    <s:element name="getBusinessLocation">
    <s:complexType>
    <s:sequence/>
    </s:complexType>
    </s:element>
    <s:element name="getBusinessLocationResponse">
    <s:complexType>
    <s:sequence>
    <s:element name="getBusinessLocationResult" type="ope:Response" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    <s:element name="Response" nillable="true" type="ope:Response"/>
    <s:element name="repeat">
    <s:complexType>
    <s:sequence>
    <s:element name="in" type="s:string" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    <s:element name="repeatResponse">
    <s:complexType>
    <s:sequence>
    <s:element name="repeatResult" type="s:string" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    <s:element name="string" nillable="true" type="s:string"/>
    <s:complexType name="Request">
    <s:sequence>
    <s:element name="Params" type="ope:Collection" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    <s:complexType name="Collection">
    <s:sequence>
    <s:element name="item" type="s:anyType" nillable="true" minOccurs="0"
    maxOccurs="unbounded"/>
    </s:sequence>
    </s:complexType>
    <s:complexType name="Param">
    <s:sequence>
    <s:element name="Name" type="s:string" minOccurs="0"/>
    <s:element name="Value" type="s:anyType" minOccurs="0"/>
    </s:sequence>
    </s:complexType>
    <s:complexType name="Response">
    <s:complexContent>
    <s:extension base="ope:Request">
    <s:sequence/>
    </s:extension>
    </s:complexContent>
    </s:complexType>
    </s:schema>
    </types>
    <message name="addBusinessLocationSoapIn">
    <part name="parameters" element="s0:addBusinessLocation"/>
    </message>
    <message name="addBusinessLocationSoapOut">
    <part name="parameters" element="s0:addBusinessLocationResponse"/>
    </message>
    <message name="getBusinessLocationSoapIn">
    <part name="parameters" element="s0:getBusinessLocation"/>
    </message>
    <message name="getBusinessLocationSoapOut">
    <part name="parameters" element="s0:getBusinessLocationResponse"/>
    </message>
    <message name="repeatSoapIn">
    <part name="parameters" element="s0:repeat"/>
    </message>
    <message name="repeatSoapOut">
    <part name="parameters" element="s0:repeatResponse"/>
    </message>
    <message name="getBusinessLocationHttpGetIn"/>
    <message name="getBusinessLocationHttpGetOut">
    <part name="Body" element="s0:Response"/>
    </message>
    <message name="repeatHttpGetIn">
    <part name="in" type="s:string"/>
    </message>
    <message name="repeatHttpGetOut">
    <part name="Body" element="s0:string"/>
    </message>
    <message name="getBusinessLocationHttpPostIn"/>
    <message name="getBusinessLocationHttpPostOut">
    <part name="Body" element="s0:Response"/>
    </message>
    <message name="repeatHttpPostIn">
    <part name="in" type="s:string"/>
    </message>
    <message name="repeatHttpPostOut">
    <part name="Body" element="s0:string"/>
    </message>
    <portType name="PublicServiceWSSoap">
    <operation name="addBusinessLocation">
    <input message="s0:addBusinessLocationSoapIn"/>
    <output message="s0:addBusinessLocationSoapOut"/>
    </operation>
    <operation name="getBusinessLocation">
    <input message="s0:getBusinessLocationSoapIn"/>
    <output message="s0:getBusinessLocationSoapOut"/>
    </operation>
    <operation name="repeat">
    <input message="s0:repeatSoapIn"/>
    <output message="s0:repeatSoapOut"/>
    </operation>
    </portType>
    <portType name="PublicServiceWSHttpGet">
    <operation name="getBusinessLocation">
    <input message="s0:getBusinessLocationHttpGetIn"/>
    <output message="s0:getBusinessLocationHttpGetOut"/>
    </operation>
    <operation name="repeat">
    <input message="s0:repeatHttpGetIn"/>
    <output message="s0:repeatHttpGetOut"/>
    </operation>
    </portType>
    <portType name="PublicServiceWSHttpPost">
    <operation name="getBusinessLocation">
    <input message="s0:getBusinessLocationHttpPostIn"/>
    <output message="s0:getBusinessLocationHttpPostOut"/>
    </operation>
    <operation name="repeat">
    <input message="s0:repeatHttpPostIn"/>
    <output message="s0:repeatHttpPostOut"/>
    </operation>
    </portType>
    <binding name="PublicServiceWSSoap" type="s0:PublicServiceWSSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="addBusinessLocation">
    <soap:operation soapAction="http://www.openuri.org/addBusinessLocation"
    style="document"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    <operation name="getBusinessLocation">
    <soap:operation soapAction="http://www.openuri.org/getBusinessLocation"
    style="document"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    <operation name="repeat">
    <soap:operation soapAction="http://www.openuri.org/repeat" style="document"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <binding name="PublicServiceWSHttpGet" type="s0:PublicServiceWSHttpGet">
    <http:binding verb="GET"/>
    <operation name="getBusinessLocation">
    <http:operation location="/getBusinessLocation"/>
    <input>
    <http:urlEncoded/>
    </input>
    <output>
    <mime:mimeXml part="Body"/>
    </output>
    </operation>
    <operation name="repeat">
    <http:operation location="/repeat"/>
    <input>
    <http:urlEncoded/>
    </input>
    <output>
    <mime:mimeXml part="Body"/>
    </output>
    </operation>
    </binding>
    <binding name="PublicServiceWSHttpPost" type="s0:PublicServiceWSHttpPost">
    <http:binding verb="POST"/>
    <operation name="getBusinessLocation">
    <http:operation location="/getBusinessLocation"/>
    <input>
    <mime:content type="application/x-www-form-urlencoded"/>
    </input>
    <output>
    <mime:mimeXml part="Body"/>
    </output>
    </operation>
    <operation name="repeat">
    <http:operation location="/repeat"/>
    <input>
    <mime:content type="application/x-www-form-urlencoded"/>
    </input>
    <output>
    <mime:mimeXml part="Body"/>
    </output>
    </operation>
    </binding>
    <service name="PublicServiceWS">
    <port name="PublicServiceWSSoap" binding="s0:PublicServiceWSSoap">
    <soap:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
    </port>
    <port name="PublicServiceWSHttpGet" binding="s0:PublicServiceWSHttpGet">
    <http:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
    </port>
    <port name="PublicServiceWSHttpPost" binding="s0:PublicServiceWSHttpPost">
    <http:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
    </port>
    </service>
    </definitions>
    Bruce Stephens <[email protected]> wrote:
    Hi Keith,
    As a quick test, you might try changing the protocol style to use
    doc/lit (@jws:protocol soap-style="document") to see if this provides
    another view on the real issue.
    Could you post the generated WSDL?
    Thanks,
    Bruce
    Keith wrote:
    I am trying to run a webservice created using Weblogic Workshop 8.1sp2that communicates
    with an ejb control. When I test in debug mode, I get the above error,specifically:
    <detail>
    <jwErr:jwErrorDetail xmlns:jwErr="http://www.bea.com/2002/04/jwErrorDetail/">
    com.bea.wlw.runtime.core.request.RequestValidationException: Errordeserializing
    arguments.
    Encountered an xml tag without a recognized type: the type must bedeclared with
    an xsi:type attribute.
    Caused by: com.bea.xml.marshal.XmlEncodingException: Encountered anxml tag with
    out a recognized type: the type must be declared with an xsi:type attribute.
    </detail>
    I am passing a Request object to the jws method (to the ejb) that hasa Collection
    as an instance member. This Collection references objects of anothertype, Param
    (code for both objects below). Before passing the object, I convertthe Collection
    to an array of objects. When I call the operation via a java client,I get the
    above message.
    In Workshop, I've included the Request and Param classes as the parameterxml
    and the soap style is rpc. I've tested the ejb by itself and it isworking fine.
    Request.java:
    import java.util.*;
    public class Request implements java.io.Serializable
    protected Collection params=null;
    public Collection getParams()
    { return params; }
    public void setParams(Collection data)
    { params=data; }
    Param.java:
    public class Param implements java.io.Serializable
    private String name=null;
    private Object value=null;
    public String getName()
    { return name; }
    public void setName(String data)
    { name = data; }
    public Object getValue()
    { return value; }
    public void setValue(Object data)
    { value=data; }
    Here's the code from the jws:
    public class MyWS implements com.bea.jws.WebService
    * @common:control
    private control.PSEjbControl psEJB;
    static final long serialVersionUID = 1L;
    * @common:operation
    * @jws:parameter-xml
    * include-java-types="mypackage.Request mypackage.Param"
    * @jws:protocol soap-style="rpc"
    public void addData(mypackage.Request arg0) throws java.rmi.RemoteException
    System.out.println("arg0 : " + arg0);
    psEJB.addData(arg0);
    *Note: in the server console, arg0 comes through as null when calledfrom my client.
    Here's the bit from my client:
    import weblogic.jws.proxies.*;
    import org.openuri.www.encodedTypes.Request;
    import org.openuri.www.encodedTypes.Param;
    public void go(String wsdl) throws Exception {
    MyWSSoap mw = null;
    mw = new MyWS_Impl().getMyWSSoap();
    Request req = new Request();
    Collection reqColl = new ArrayList();
    Param param1 = new Param();
    param1.setName("NAME");
    param1.setValue("Joe Tester");
    Param param2 = new Param();
    param2.setName("ADDRESS");
    param2.setValue("345 Test Drive");
    reqColl.add(param1);
    reqColl.add(param2);
    Object[] obs = reqColl.toArray();
    req.setParams(obs);
    mw.addData(req);
    Not sure if this enough to go by. Please let me know if you need moreinformation.
    Any help is really appreciated. Thanks.

  • ClassNotFoundException deserializing

    I am having an strange problem: in a servlet, when I serialize and then deserialize it's session I happen to get:
    1.- Serialization and Deserialization goes OK when session has no attributes;
    2.- Serialization and Deserialization goes OK when session has only attributes of type in JDK;
    3.- Serialization goes OK but Deserialization goes NOT OK when session has attributes from custom classes;
    The following servlet code and custom object code exemplify this behaviour. I am using WebLogic 8.1 SP4. It all happens regardless of archived or exploded deployment, and also in standalone or clustered instances. It also happens regardless of wether session is replicated or not.
    Any help or clue about what is happening or what I am doing wrong would be appreciated. To test it, you only need to deploy the following objects onto any existing or new web app. Then, the catch block with comment <i>// this code will be executed :o(</i> will be executed...
    Thank you in advance.
    <b>package test;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.PrintWriter;
    import java.io.Serializable;
    import java.io.StringWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class CustomServlet
              extends HttpServlet
              implements Serializable
    public void doGet (HttpServletRequest pHttpServletRequest,
                        HttpServletResponse pHttpServletResponse)
              throws ServletException,
                        IOException
         HttpSession wHttpSession = pHttpServletRequest.getSession(true);
         pHttpServletResponse.setStatus(HttpServletResponse.SC_OK);
    pHttpServletResponse.setContentType("text/html");
    check (pHttpServletRequest,
    pHttpServletResponse);     
    return;
    public void doPost (HttpServletRequest pHttpServletRequest,
                                       HttpServletResponse pHttpServletResponse)
              throws ServletException,
                        IOException
    HttpSession wHttpSession = pHttpServletRequest.getSession(true);
    pHttpServletResponse.setStatus(HttpServletResponse.SC_OK);
    pHttpServletResponse.setContentType("text/html");
    check (pHttpServletRequest,
    pHttpServletResponse);
    return;
    private void check (HttpServletRequest pHttpServletRequest,
                                       HttpServletResponse pHttpServletResponse)
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "<b>checking session " + pHttpServletRequest.getSession ().getId () + "</b>");
    ByteArrayOutputStream wByteArrayOutputStream = null;
    byte [] wByte = null;
    ByteArrayInputStream wByteArrayInputStream = null;
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "<b>test 1: no attributes</b>");
    try
    wByteArrayOutputStream = new ByteArrayOutputStream ();
    ObjectOutputStream wObjectOutputStream = new ObjectOutputStream (wByteArrayOutputStream);
    wObjectOutputStream.writeObject (pHttpServletRequest.getSession ());
    wObjectOutputStream.flush ();
    wObjectOutputStream.close ();
    wByteArrayOutputStream.close ();
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "serialization OK!");
    catch (Exception wException)
    logHTML (pHttpServletRequest,
              pHttpServletResponse,
              "exception serializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
                   pHttpServletResponse,
                   Exception2String (wException));
    wByte = wByteArrayOutputStream.toByteArray ();
    try
    wByteArrayInputStream = new ByteArrayInputStream (wByte);
    ObjectInputStream wObjectInputStream = new ObjectInputStream (wByteArrayInputStream);
    wObjectInputStream.readObject ();
    wObjectInputStream.close ();
    wByteArrayInputStream.close ();
    logHTML (pHttpServletRequest,
              pHttpServletResponse,
              "deserialization OK!");
    catch (Exception wException)
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "exception deserializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
                        pHttpServletResponse,
                        Exception2String (wException));
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "<b>test 2: one JDK attribute</b>");
    pHttpServletRequest.getSession ().setAttribute ("t02", new Integer (5));
    try
    wByteArrayOutputStream = new ByteArrayOutputStream ();
    ObjectOutputStream wObjectOutputStream = new ObjectOutputStream (wByteArrayOutputStream);
    wObjectOutputStream.writeObject (pHttpServletRequest.getSession ());
    wObjectOutputStream.flush ();
    wObjectOutputStream.close ();
    wByteArrayOutputStream.close ();
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "serialization OK!");
    catch (Exception wException)
    logHTML (pHttpServletRequest,
              pHttpServletResponse,
              "exception serializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
                   pHttpServletResponse,
                   Exception2String (wException));
    wByte = wByteArrayOutputStream.toByteArray ();
    try
    wByteArrayInputStream = new ByteArrayInputStream (wByte);
    ObjectInputStream wObjectInputStream = new ObjectInputStream (wByteArrayInputStream);
    wObjectInputStream.readObject ();
    wObjectInputStream.close ();
    wByteArrayInputStream.close ();
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "deserialization OK!");
    catch (Exception wException)
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "exception deserializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
                        pHttpServletResponse,
                        Exception2String (wException));
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
                   "<b>test 3: one custom attribute</b>");
    pHttpServletRequest.getSession ().setAttribute ("t03", new CustomObject ());
    try
    wByteArrayOutputStream = new ByteArrayOutputStream ();
    ObjectOutputStream wObjectOutputStream = new ObjectOutputStream (wByteArrayOutputStream);
    wObjectOutputStream.writeObject (pHttpServletRequest.getSession ());
    wObjectOutputStream.flush ();
    wObjectOutputStream.close ();
    wByteArrayOutputStream.close ();
    logHTML (pHttpServletRequest,
              pHttpServletResponse,
                   "serialization OK!");
    catch (Exception wException)
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
                   "exception serializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         Exception2String (wException));
    wByte = wByteArrayOutputStream.toByteArray ();
    try
    wByteArrayInputStream = new ByteArrayInputStream (wByte);
    ObjectInputStream wObjectInputStream = new ObjectInputStream (wByteArrayInputStream);
    wObjectInputStream.readObject ();
    wObjectInputStream.close ();
    wByteArrayInputStream.close ();
    logHTML (pHttpServletRequest,
              pHttpServletResponse,
              "deserialization OK!");
    catch (Exception wException)
    // this code will be executed :o(
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         "exception deserializing session " + pHttpServletRequest.getSession ().getId ());
    logHTML (pHttpServletRequest,
         pHttpServletResponse,
         Exception2String (wException));
    private void logHTML (HttpServletRequest pHttpServletRequest,
                                            HttpServletResponse pHttpServletResponse,
                                            String pString)
    try
    pHttpServletResponse.getOutputStream ().println ("<br><br>" + pString);
    catch (IOException wIOException)
    private String Exception2String (Exception pException)
    String rException;
    StringWriter wStringWriter = new StringWriter ();
    PrintWriter wPrintWriter = new PrintWriter (wStringWriter);
    pException.printStackTrace (wPrintWriter);
    wPrintWriter.close ();
    rException = wStringWriter.toString();
    rException = rException.replaceAll ("\n", "<br>     ");
    return rException;
    package test;
    import java.io.Serializable;
    public class CustomObject
              implements Serializable
    public Integer myInteger = null;
    public CustomObject ()
    super ();
    myInteger = new Integer (10);
    }</b>

    For sure, as you can see at the very bottom of my original message. Also remember from my original post I am having no problem serializing. The problem comes when I try to deserialize.
    Regards.

  • Elements Type lost when deserializing a collection in Flex

    I am running FlexBuilder, BlazeDS, SBI (Spring Blaze Integration), Hibernate with Tomcat 6 on a local machine.
    I have a layoutStructure object that holds layoutModule objects in its layoutStructure.children ArrayCollection. On the server LayoutStructure.java contains a List<LayoutModule> children collection annotated OneToMany to the LayoutModule table. I can see in the BlazeDS debugger that the List<LayoutModule> being sent from the server correctly contains LayoutModule objects but when it is being deserialized in Flex all of them lose their type and are translated into Object type.
    Can anyone please let me know why do you thing that is? I have all the [RemoteClass(alias=" ... ")] mappings correctly done. Here is some of the code (omitting all the packaging information):
    LayoutStructure.java:
    @Entity
    @Table (name="layoutstructure")
    public class LayoutStructure implements Serializable
        private static final long serialVersionUID = 8935662122890799233L;
        @Id 
        @GeneratedValue(strategy=GenerationType.AUTO)
        @Column(name="layoutStructureId")
        public Integer id ;
        @OneToOne(
            cascade=CascadeType.ALL,
            optional=false)
        public User user;
        @OneToMany(
            fetch = FetchType.EAGER,
            cascade = CascadeType.ALL )
        @JoinColumn(
            name = "fk_layoutId",
            nullable = false )
        @org.hibernate.annotations.IndexColumn(
            name = "position")
        public List<LayoutModule> children ;
    LayoutModule.java:
    @Entity
    @Table (name = "layout_module")
    public class LayoutModule implements Serializable
        private static final long serialVersionUID = -4413201380054375907L;
         * NanToNullProxy() needed in order to null out the id:Number
         * property coming from Flex in a newly created object (it
         * defaults to NaN in Flex but I need it NULL for Hibernate
         * to persist it as a new object).
        public LayoutModule(){
            BeanProxy bp = new NanToNullProxy();
            bp.setIncludeReadOnly(true);
            PropertyProxyRegistry.getRegistry().register(LayoutModule.class, bp);
        private Integer id;
        @Id @GeneratedValue( strategy=GenerationType.AUTO )
        public Integer getId() {
            return id;
        public void setId(Integer id) {
            this.id = id;
    LayoutModule.as:
        [Bindable]
        [RemoteClass(alias="test.layout.LayoutModule")]
        public class LayoutModule extends EventDispatcher implements IUID
             * The id number to store in the database.
            public var id : Number ;
             * Unique Id needed for proper identification
             * in the tree component when it is being
             * reopened to the same LayoutUnit after refreshing
             * the dataProvider.
            public function get uid():String
                return String(id) + "c";
            public function set uid( uid:String ):void
    Any help would be greatly apprectiated. Thanks. Dahn.

    Hi DJ
    Thanks for the quick reply.
    The good news is that what you suggest simplifies my process a lot. So thanks for that.
    The bad news in the order in still wrong. I.E it's not as the collection order, but it is the same order as the Process Multiple file route!
    So a step forward, but not quite there yet.
    Thanks so far!
    Chris

  • Hashtable imcompletely deserialized?!

    If anyone could help me with this I would be most appreciative.
    I appear to have a situation where a serializable class with an internal Hashtable is not deserilizing correctly. The class containing the Hashtable is called PropDb. In PropDb I have this method...
    protected Hashtable  m_names = new Hashtable();
    public synchronized String getStringVal(String key) {
      if ((key != null) && (key.length() != 0))
        return (String)m_names.get(key);
      else
        return null;
    }Now here is the exception that is sometimes thrown...
    java.lang.NullPointerException
            at java.util.Hashtable.get(Unknown Source)
            at util.PropertyDB.getString(PropertyDB.java:635)Given that the key is not null, and looking at the source for Hashtable... the only other entities in Hashtable.get() that could throw the NullPointer are the internal data array or one of the data items in the data array!
    The reason I'm suspecting the serializing/deserializing is because it this NullPointer seems to come up "randomly"-- often enough to be a problem, but with no identifiable pattern!! So, can anyone tell me there are know issues with Hashtables deserializing in an incorrect state?
    Thank you very much.

    Hi there,
    I just wanted to mention that Hashtable's actions are strongly
    dependent by the hashcodes of the keys. Let's say that your
    KEY objects don't have constant hashCodes. Then the result of
    get() method is often wrong 'cause of the formula
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
       So if you want to serialize /deserialize Hashtable , I recommend you
    to override the hashCode() method of you Keys and write it in a way
    that gives you assurance that your key's hashcodes will remain constant after serialize/deserialize
    regards, Kaloyan

  • JMS getObject() Error deserializing object for client

    I am using WL6.1 and having a problem deserializing an object for a
              client that doesn't have access to the corresponding implementation
              object in its CLASSPATH (it only deals with the interface). From
              previous posts, I read that upgrading to SP3 would fix this issue, but
              I am still having this problem on both Solaris and Windows using SP3.
              If I modify the client CLASSPATH to include the Server-side JAR file
              that contains the implementation class, I don't have the problem and I
              can successfully perform getObject() and deserialize the object. The
              following is the code for the client:
              public void onMessage(Message msg)
              String msgText;
              if(msg instanceof ObjectMessage)
              try
              ObjectMessage objMsg = (ObjectMessage) msg;
              ActivityCreationEvent msgEvent =
              (ActivityCreationEvent) objMsg.getObject();
              System.out.println("Got a creation event");
              catch(Exception ex)
              System.out.println("Error getting JMS message:" + ex);
              ex.printStackTrace();
              the following is the code for the server:
              objMsg = tSess.createObjectMessage(null);
              ActivityCreationEvent createEvent=new ActivityCreationEventImpl();
              objMsg.setObject(createEvent);
              tPublisher.publish(objMsg);
              and the following is the client stack trace:
              Error getting JMS message:weblogic.jms.common.JMSException: Error
              deserializing object
              weblogic.jms.common.JMSException: Error deserializing object
              at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:141)
              at com.test.producer.tck.CreateProducerByValue.onMessage(CreateProducerByValue.java:566)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1865)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:1819)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.Kernel.execute(Kernel.java:257)
              at weblogic.kernel.Kernel.execute(Kernel.java:269)
              ----------- Linked Exception -----------
              at weblogic.jms.client.JMSSession.pushMessage(JMSSession.java:1733)
              at weblogic.jms.client.JMSSession.invoke(JMSSession.java:2075)
              at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:510)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:429)
              at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown
              Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
              at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              java.lang.ClassNotFoundException:
              com.test.activity.ri.ActivityCreationEventImpl
              at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:190)
              at weblogic.jms.common.ObjectMessageImpl$ObjectInputStream2.resolveClass(ObjectMessageImpl.java:277)
              at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:913)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:361)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
              at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1181)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:381)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
              at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:127)
              at com.test.producer.tck.CreateProducerByValue.onMessage(CreateProducerByValue.java:566)
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1865)
              at weblogic.jms.client.JMSSession.execute(JMSSession.java:1819)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.Kernel.execute(Kernel.java:257)
              at weblogic.kernel.Kernel.execute(Kernel.java:269)
              at weblogic.jms.client.JMSSession.pushMessage(JMSSession.java:1733)
              at weblogic.jms.client.JMSSession.invoke(JMSSession.java:2075)
              at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:510)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:429)
              at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown
              Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
              at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              The client doesn't need to have access to the implementation class for
              any other aspect of the code, and I would like to keep it that way.
              Does anyone have information as to the cause of the problem and a
              solution?
              Thanks in advance
              

    Hi James,
              Just having the interface is not sufficient, as the JVM must be able to
              find the implementation class of an object in order to unserialize it - this is not a WebLogic
              thing, it is a java thing. Either package the required class in the .ear that contains
              the MDB or put it in your classpath.
              Tom
              James J wrote:
              > I am using WL6.1 and having a problem deserializing an object for a
              > client that doesn't have access to the corresponding implementation
              > object in its CLASSPATH (it only deals with the interface). From
              > previous posts, I read that upgrading to SP3 would fix this issue, but
              > I am still having this problem on both Solaris and Windows using SP3.
              > If I modify the client CLASSPATH to include the Server-side JAR file
              > that contains the implementation class, I don't have the problem and I
              > can successfully perform getObject() and deserialize the object. The
              > following is the code for the client:
              >
              > public void onMessage(Message msg)
              > {
              > String msgText;
              >
              > if(msg instanceof ObjectMessage)
              > {
              > try
              > {
              > ObjectMessage objMsg = (ObjectMessage) msg;
              > ActivityCreationEvent msgEvent =
              > (ActivityCreationEvent) objMsg.getObject();
              > System.out.println("Got a creation event");
              > }
              > catch(Exception ex)
              > {
              > System.out.println("Error getting JMS message:" + ex);
              > ex.printStackTrace();
              > }
              > }
              > }
              >
              > the following is the code for the server:
              >
              > objMsg = tSess.createObjectMessage(null);
              > ActivityCreationEvent createEvent=new ActivityCreationEventImpl();
              > objMsg.setObject(createEvent);
              > tPublisher.publish(objMsg);
              >
              > and the following is the client stack trace:
              >
              > Error getting JMS message:weblogic.jms.common.JMSException: Error
              > deserializing object
              > weblogic.jms.common.JMSException: Error deserializing object
              > at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:141)
              > at com.test.producer.tck.CreateProducerByValue.onMessage(CreateProducerByValue.java:566)
              > at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1865)
              > at weblogic.jms.client.JMSSession.execute(JMSSession.java:1819)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.Kernel.execute(Kernel.java:257)
              > at weblogic.kernel.Kernel.execute(Kernel.java:269)
              > ----------- Linked Exception -----------
              > at weblogic.jms.client.JMSSession.pushMessage(JMSSession.java:1733)
              > at weblogic.jms.client.JMSSession.invoke(JMSSession.java:2075)
              > at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:510)
              > at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
              > at weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:429)
              > at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown
              > Source)
              > at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
              > at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
              > at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > java.lang.ClassNotFoundException:
              > com.test.activity.ri.ActivityCreationEventImpl
              > at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
              > at java.security.AccessController.doPrivileged(Native Method)
              > at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
              > at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
              > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
              > at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
              > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
              > at java.lang.Class.forName0(Native Method)
              > at java.lang.Class.forName(Class.java:190)
              > at weblogic.jms.common.ObjectMessageImpl$ObjectInputStream2.resolveClass(ObjectMessageImpl.java:277)
              > at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:913)
              > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:361)
              > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
              > at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1181)
              > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:381)
              > at java.io.ObjectInputStream.readObject(ObjectInputStream.java:231)
              > at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:127)
              > at com.test.producer.tck.CreateProducerByValue.onMessage(CreateProducerByValue.java:566)
              > at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1865)
              > at weblogic.jms.client.JMSSession.execute(JMSSession.java:1819)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.Kernel.execute(Kernel.java:257)
              > at weblogic.kernel.Kernel.execute(Kernel.java:269)
              > at weblogic.jms.client.JMSSession.pushMessage(JMSSession.java:1733)
              > at weblogic.jms.client.JMSSession.invoke(JMSSession.java:2075)
              > at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:510)
              > at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
              > at weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:429)
              > at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown
              > Source)
              > at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
              > at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
              > at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              > The client doesn't need to have access to the implementation class for
              > any other aspect of the code, and I would like to keep it that way.
              > Does anyone have information as to the cause of the problem and a
              > solution?
              >
              > Thanks in advance
              

  • Serialize String containing only whitespace such as a " " character

    I'm having dufficulty figuring out how to serialize a String property
    [XmlElement("DescriptionDelimiter1")]
    public String DescriptionDelimiter1
        get { return _DescriptionDelimiter1; }
        set { _DescriptionDelimiter1 = value; }
    Granted, I don't really need the XmlElement tag but just in case I want to change the name of the XML element...
    Anyway, what I get in XML is
    <ImportProfiles>
      <ImportProfile Name="HPH Import Profile">
        <ConcatenateDescriptions>true</ConcatenateDescriptions>
        <DescriptionDelimiter1 />
        <DescriptionDelimiter2>\r\n</DescriptionDelimiter2>
        <DescriptionDelimiter3>\t</DescriptionDelimiter3>
      <ImportProfile>
    </ImportProfiles>
    The problem is when serialized, if the value is " " or a single space, the result is <DescriptionDelimiter1 /> which when deserialized sets the string's value to "" with is not the value I need. I've looked into using CData but there doesn't seem to be a simple way to implement it... I expect
    <DescriptionDelimiter1> </DescriptionDelimiter1>
    or
    <DescriptionDelimiter1><[CDATA[ ]]></DescriptionDelimiter1>
    Is there some setting I can use when serializing the object to indication the process should not trim away whitespace?
    The following is the method used to serialize my object:
    public static String Serialize(DataImportBase dib)
        System.Type[] ArrType = new Type[1];
        ArrType[0] = typeof(System.DBNull);
        XmlSerializer xs = new XmlSerializer(typeof(DataImportBase), ArrType);
        System.IO.MemoryStream aMemoryStream = new System.IO.MemoryStream();
        xs.Serialize(aMemoryStream, dib);
        return System.Text.Encoding.UTF8.GetString(aMemoryStream.ToArray());
    Thanks for any assistance!!!
    Chris

    I have looked through the classes for XML serialization but I haven't found anything that seems to allow one to set that attribute xml:space declaratively on members.
    One way to change the serialization behaviour would be to write a specialized XmlWriter that takes a list of element names for which it writes out the xml:space attribute. This can be done with a few lines if you use the XmlWrappingWriter from the project http://www.codeplex.com/Wiki/View.aspx?ProjectName=MVPXML. The code for XmlWrappingWriter is also shown in Oleg's blog.
    If you use that then you can set up a specialized XmlWriter as follows:
    public class XmlSpaceWriter : XmlWrappingWriter
    private XmlQualifiedName[] ElementNames;
    public XmlSpaceWriter(TextWriter output, XmlQualifiedName[] elementNames)
    : base(XmlWriter.Create(output))
    ElementNames = elementNames;
    public override void WriteStartElement(string prefix, string localName, string ns)
    base.WriteStartElement(prefix, localName, ns);
    foreach (XmlQualifiedName name in ElementNames)
    if (name.Namespace == ns && name.Name == localName && base.XmlSpace != XmlSpace.Preserve)
    base.WriteAttributeString("xml", "space", "http://www.w3.org/XML/1998/namespace", "preserve");
    break;
    and use it like this
    Foo foo = new Foo();
    foo.Bar = " ";
    foo.Example = " ";
    XmlSerializer serializer = new XmlSerializer(typeof(Foo));
    StringWriter stringWriter = new StringWriter();
    XmlSpaceWriter spaceWriter = new XmlSpaceWriter(stringWriter, new XmlQualifiedName[] {new XmlQualifiedName("Bar")});
    serializer.Serialize(spaceWriter, foo);
    spaceWriter.Close();
    string markup = stringWriter.ToString();
    The result then looks like this:
    <?xml version="1.0" encoding="utf-16"?><Foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Bar xml:space="preserve"> </Bar><Example> </Example></Foo>
    The example code above has just one constructor for a TextWriter but the code could obviously easily extended to have further constructors taking e.g. a stream.

  • Deserializing cyclic reference with object resolution

    I am attempting to deserialize complex objects containing cyclic references with an ObjectInputStream that implements the method resolveObject.
    Of course, enableResolve(true) has been called in the constructor of the object input stream.
    The problem I am seeing is that object resolution, when applied, is not propagated back to those objects that have been already deserialized and point to a "handle" object.
    Is there a proper way to retroactively enforce object resolution?
    Cheers,
    Didier H. Besset

    Hi Didier
    I read your code, downloaded junit and ran your test. The test fails, so back to a few System.out.println statements!
    I put a few into your code, see attached. Your deserialization is OK but your getComposite method returns the underlying referent and you are testing against the SoftReference!
    Here's the output of the printlns - you can see the strings, objects and lists being resolved and the final "test" of printing out the objects you are comparing.
    Resolving Beta
    Returning Beta
    Resolving Component@18f51f
    Resolving name Beta
    Returning ComponentReference@84ce7a
    Resolving Gamma
    Returning Gamma
    Resolving Component@10fd7f6
    Resolving name Gamma
    Returning ComponentReference@12b6c89
    Resolving [ComponentReference@84ce7a, ComponentReference@12b6c89]
    Returning [ComponentReference@84ce7a, ComponentReference@12b6c89]
    Resolving Alpha
    Returning Alpha
    Resolving Composite@1e2befa
    Resolving name Alpha
    Returning CompositeReference@1682598
    CompositeReference@1682598 Composite@1e2befa
    CompositeReference@1682598 Composite@1e2befaRegards
    Tom

Maybe you are looking for

  • How to send request to web service using .pem certificate.

    Dear All, I have a .pem, WSDL file and (Request and Response format), this files are provided by the customer, now I have generated the ServiceClass using WSDL file using wsdl.exe. Now when I send the request I am getting error as "The underlying con

  • MAC OSX 10.9.4 - RD Version 8.0.7 (build 24875) and Excel 2010

    On a mac osx 10.9.4, running MS remote Desktop version 8.0.7 (24875) When in an excel spreadsheet, if I open the Format Cells window and click on the Fill tab, it crashes my RD Session every time. I originally tested under 8.0.6 (24875) and it worked

  • Photo Viewing Size?

    How do you view a photo at 100% size like you can do in Photoshop? The zoom slider is cool but it does not give you any info as to what magnification size the image is at. Can anyone help? Thanks, Martin.

  • I have loaner iphone 4, how do i get my itunes purchases on it

    i have loaner iphone 4 that i want to put my itunes purchases on it; did not back up thru cloud on current i phone 4 i have that's in for service; battery won't charge

  • 10.2.0.4 on Oracle XE

    Hi, sorry didnt find anything in the forum: Is it possible to patch Oralce Express Edition to latest Patch Set 10.2.0.4? If yes: how? I tried it with oui but didnt work. Thanks, Alex