Simple Serialization Problem

I'm creating a server/client text based game where a user is sent text and serialized information from their personal character class. However, I don't know what type of Reader/Writer I should use to accept both serialized byte code and strings. Is there a way I can use BufferedReader for strings and temporarily pause the input stream to send it a serialized class using ObjectInputStream?
--dorky
Edited by: dorkydude666 on Mar 25, 2009 8:39 AM

As far as I know, there is no write String method for ObjectOutputStream. There's writeChars and writeObject. writeChars changes "Hello" to "H e l l o" and writeObject would be annoying to use when sending plain integers. However, I have got a small prototype working where I just cast the object to String and parseInt for the value. Now I'm getting problems sending my serializable objects over the socket. It sends and receives without error, but it's only sending the first instance of the class. It's confusing, so here's my debugging output:
Server:
user:1 name:dorkydude hp:100
user:1 name:dorkydude hp:80
Client:
user:1 name:dorkydude hp:100
user:1 name:dorkydude hp:100
The server is updating the class, but not sending the updated version. The updated class is sent as the last line of code in my program so it's not a matter of sending it too early. :\
--dorky                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Vector serialization problem

    Hi,
    I am writing a web service on Axis and my service return a Vector object, which is the result of a MySQL query. How can I transfer my result Vector to the client? As far as I searhed, ther is not any simple serialization for this.
    Can anyone help me?
    Thanks

    Java-Collections are not common SOAP-Types.
    You can try using a java.util.List instead of a Vector - but if somebody wants to use your WebService e.g. with .NET there will be lots of problems.
    Better use an Array if you want to pass a Set of Objects via WebService.

  • Real simple xslt problem/question

    Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. i'm sure that theres a simple solution to it but i just cant figure it out. any helps greatly appreciated, thanks

    Start with the XSLT identity transform (I don't have it handy and it's fairly long, but you should be able to google it up). Add this:<xsl:template match="result">
      <result id="">
        <xsl:apply-templates>
      </result>
    </xsl:template>

  • JDeveloper IDE simple setting problem

    Hi,
    Recently we switched to JDeveloper from Visual Cafe .I have a simple setting problem.How can I set the options so that IDE gives, the core java classes and packages,and our application classes and packeges, prompts in imports as well as in code.Where to set the options.
    eg: when I write
    import java. it should prompt all the pakages.
    Thanks in advance.
    -Gopal
    null

    I am not sure I understand what you are requesting, but ...
    You can configure JDeveloper projects to include various libraries by default.
    This is done by selecting menu Tools | Default Project Properties.../ Libraries tab.
    You should define a library for your classes.
    You can import any of the packages / classes from all the libraries which your project includes.
    It would be incorrect for a tool to automatically add a bunch of import lines at the top of every file because each file should import what it needs and just as importantly, not import what it does not need depending on the component type (e.g. a servlet should not include javax.swing.* ).
    An easy way to import elements into JDeveloper is to type in something like:
    import java.
    // and then type in Ctrl Space
    and this launches the package browser, you can select packages or classes to import.
    You can also do this at the variable declaratiton point such as typing in:
    foo() {
    Frame x
    // Press Control Alt Space
    and this will correctly change the type (Frame) to the type you select in the package browser and add the import statement.
    -John
    null

  • Simple OOP Problem. Help!

    This is just a simple OOP problem that i cant decide on a best
    implementation for.
    im passing an object to an instance of, 'TabbedFrame', which is just
    a frame with a Tabbed Pane in it that is holding custom panels.
    however, these custom panels need access to the object being
    passed to 'TabbedFrame' and to some methods in it.
    i cant make them static however so how do i gain access to them?
    is my only option to pass the 'TabbedFrame' to each panel?
    like - jtabbedpane.add( "Panel 1", new mypanel1(this));
    here is code:
    new TabbedFrame( DataObject );
    public class TabbedFrame{
    public TabbedFrame(DataObject do){
    this.do = do;
    jtabbedpane.add( "Panel 1", new mypanel1() );
    DataObject do;
    public class mypanel1{
    public mypanel1(){
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    }i would just pass the DataObject to evey panel (there are 12) but
    i also need to be able to call methods in the 'TabbedFrame'.
    Any help would be appreciated!

    Modify mypanel1's constructor:
    public class mypanel1{
    TabbedFrame tf;
    public mypanel1(TabbedFrame tf){
    this.tf = tf;
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    DataObject theDo = tf.getDataObject();
    tf.someMethod(); // Call method on the TabbedFrame
    }In TabbedFrame:
    public TabbedFrame(DataObject do){
    this.do = do;
    // Modify call to constructor to pass "this" TabbedFrame.
    jtabbedpane.add( "Panel 1", new mypanel1(this) );
    }

  • Serialization problem with FlashPlayer 10.1

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

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

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

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

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

  • Simple Serializable demo with problems

    Hello!
    I am having a very simple demo where I tried to see how the Serializable interface works. However, I am receiving message NotSerializableException. What's wrong?
    Thanks in advance!
    Kind regards,
    Igor
    Here's the demo:
    import java.io.*;
    public class SerializationDemo {
      private class Data implements Serializable {
        String someString = "This is a string";
        double someDouble = 1;
      public SerializationDemo() {
        try {
          FileOutputStream fos = new FileOutputStream("dataObjectSerialized");
          ObjectOutputStream oos = new ObjectOutputStream(fos);
          oos.writeObject(new Data());
          fos.close();
        catch (Exception e) {
          System.out.println(e.toString());
      static public void main(String args[]) {
        SerializationDemo demo = new SerializationDemo(); 
    };

    Consider the following code. What do you expect Child.foo() to print? Why? Supposing you made it serializable, how would you expect it to behave when deserialized?
    public class Illustration {
       public Illustration(int x) {
          this.x = x;
          this.c = new Child();
       public void foo() {
          c.foo();
       private Child c;
       private int x;
       private class Child {
          public Child() {
          public void foo() {
             System.out.println(x);
       public static void main(String[] argv) {
          Illustration i = new Illustration(42);
          i.foo();
    }In case that's not clear, here's a quick illustration:
    public class Illustration {
       public class Child { ... }
    +--------------+
    | Illustration |
    |              |
    |  +-----+     |
    |  |Child|     |
    |  +-----+     |
    |              |
    +--------------+
    public class Illustration {
       public static class Child { ... }
    +--------------+
    | Illustration |    +-----+
    |              |--->|Child|
    |              |    +-----+
    |              |
    |              |
    |              |
    +--------------+Because Child is not declared static, it has full access to all of the fields of Illustration. Therefore if you serialize it in order to work after deserialization as it did before, it must have copies of all of the owning class's fields.
    When you declare it static you break this relationship and it becomes independent.
    So taking your following question:
    Why is this so? Does this mean that the following two statements would produce completely identical results, providing that SerializationDemo class was made Serializable:
    oos.writeObject(new Data());
    oos.writeObject(this);No, not quite - the first form creates a new Data object, serializes that, then (of necessity) serializes the owning class as well.
    The second form just serializes the current class - since it doesn't have an associated Data object, nothing else gets serialized.
    To achieve the effect you want, either make your Data class static, or declare it in its own file (which is roughly the same thing).
    Dave.

  • Bussiness object serialization problem

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

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

  • Serialization problems with JOptionPane

    Hi,
    I am having a problem attempting to serialize and deserialize a JOptionPane contained within a JPanel running in an applet.
    The code is straightforward enough:
    JOptionPane m_pane = new JOptionPane("Hello world !!");
    contentPane.add( m_pane, "Center" );
    While displaying the above contentPane, the applet is serialized.
    On deserializing the application, no deserilization errors are reported. However, the font, the borders, and the position of the (default) OK button are all altered. If I then attempt to serialize/deserialize for a second time, serialization fails, and a lengthy error message is written to the console. Here's a snippet of the console message:
    readObject - javax.swing.JOptionPane[,0,0,296x90,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=-15896,maximumSize=,minimumSize=,preferredSize=,icon=,initialValue=,message=Hello world!!,messageType=PLAIN_MESSAGE,optionType=DEFAULT_OPTION,wantsInput=false]
    Serialization Failed: Reason java.lang.Objectjava.io.NotSerializableException: java.lang.Object
    java.io.NotSerializableException: java.lang.Object
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
    If I add a simple JPanel (instead of a JOptionPane) to contentPane, then no problems are exhibited.
    Has anyone came across this issue before?
    Thanks.

    Maintaining serialized objects across versions is a problem. There are no easy solutions.
    Have you searched the site for other threads on the subject?

  • Simple button problem

    I am having a real problem creating a simple button - I have
    created a Flash file using Action script 2, and when I create a
    simple button - text with a rectangle as a background, (see
    http://www.elkhavenestate.com),
    and the over state is behaving in a bizarre fashion. This is my
    first time using CS3, so is there a new control that I'm
    missing?

    I take it that it's the Home button. It appears to have a
    selectable text field or something in it, which is causing the
    problem. Either change that to a static text field or set its
    selectable property to false. The other two buttons appear to be
    fine, so maybe you can just duplicate one of them and turn it into
    the Home button.
    If I picked the wrong button, let me know.

  • Web Service From Java class, serialization problem

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

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

  • Logo/picture to menubar? simple css problem?

    Hi, I'm having a problem getting a logo to appear correctly in a horizontal menu bar. It appears to be fine in IE 8, Safari 5, Chrome, and Firefox. However in IE 7 and lower it does not seem to display correctly. The only conditional notes I have for IE 7 and lower deals with the slideshow on the page which shouldn't be affecting the menubar as it is in a different div.
    Here is the url: www.elementcentral.com
    Any advice? I could really use some help- I've tried quite a few things but to no avail...
    Thanks for any help you can offer and I'm more than happy to clarify or anything else!
    Sincerely,
    Matt

    Anyone? I'm thinking its just something simple but I can't figure it out for the life of me heh.

  • Isolation level SERIALIZABLE problem

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

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

  • Simple DLL problem

    I'm dabbling with DLL writing and can't figure out how to pass a string to a
    DLL. As far as I can see, it should be simple.
    My DLL function, in the DLL "test.dll", is simply
    TEST_API int test(LPCTSTR WinName)
    return 0;
    Instead of LPCTSTR I've also tried the more conventional "char *WinName",
    and a few others. All give the same error; "The exception Priviledged
    Instruction occurred in the application at location (blah)." The error
    message doesn't seem too specific; exactly the same thing happens if I
    deliberately copy some text to an uninitialised pointer.
    I'm calling the function using a "Call Library Node", passing a
    pre-generated string in the form of a C string pointer. The calling
    convention is set to "winapi" but doesn't seem too relevant.
    If I remove the string argument and change the function definition to take
    (void) then it works, in that I can put integers in the return code and pass
    them back to Labview, so it's the passing of the string that's the problem.
    However, if I have more code in there and I use the Visual C++ debugger, the
    error message is only generated on hitting the "return" line, and I can see
    the string that has been passed in when I look at "WinName" in the debugger.
    Can anyone shed some light on this?
    Craig Graham
    Physicist/Labview Programmer
    Lancaster University, UK

    Craig;
    I am going to throw some random thoughts that may help you in your situation:
    - I avoid to use VC's wizard. It gives (and gave me) a lot of headaches. All it does it to add a lot of garbage to your project that nobody understand.
    - If your source file is a .cpp, wrap your function prototypes inside the extern "C" declaration.
    - Always initialize every variable in LabVIEW side. For example, for your function you should wire an empty string in the input side of the "Call Library Node" for the "WinName" variable.
    - I claim ignorance in this one, but seems to simplify my projects. Exclude rarely-used Windows header files by adding the following statement before your headers "include":
    #define VC_EXTRALEAN
    I hope this can be of help. If I co
    me up with some more suggestion, I'll let you know.
    Best regards;
    Enrique
    www.vartortech.com

Maybe you are looking for

  • Kernel panic in 10.8.2 solved (for me)

    Thanks to the Apple Support crew who spent hours on the phone with me figuring this out. S, you are great! Background: I have seven machines from Apple.  These range from Macbook Air to iMac to numerous others, all Intel-based.  Over a period of a mo

  • IPod Shuffle (1st Generation) NEW ERROR: recognize and charging problems

    I'm tired. I'm quite tired. I struggled for a month to resolve the 1418 error (My previous posts had thousand of views, until Apple removed them...).Finally Apple gave us the iPod Shuffle reset utility, which worked fine... My iPod Shuffle resurrecte

  • Error in installing Apple Application Support preventing installation of iTunes, please help

    I am trying to install iTunes for Windows (64 bit) but have been unsuccessful because I receive the following error message: "Microsoft.VC80.CRT,type+"win32",version="8.0.50727.6195"publicKeyToken="1fc8b3 b9a1e18e3b",processorArchitecture="x86". Plea

  • ISight Question

    My iSight, upon starting photobooth, flickers bright green for about 1 second, and then produces the normal picture. I assume that this is just the camera calibrating itself based on the light conditions in the room, but I wanted to be sure. Is it no

  • Create a tab and display customized subscreen

    Hi, In the SRM portal I want a customized tab on the Display Purchase Order screen. On the click of the this tab, a customized sub screen should be displayed. To achieve this I have implemented the BADI BBP_CUF_BADI and created a subscreen. Now my qu