Problems with createRow() method

I have a basic problem when creating a new row in my database. what I do is the following:
1.ViewObject blobVO = (ViewObject) myAM.findViewObject ("BlobVO");
2.BlobVORowImpl newRow = (BlobVORowImpl) blobVO.createRow();
Line 1. is ok; it finds the view object. But when I get to line 2., I get the following error:
oracle.jbo.RowCreateException: JBO-25017: Error while creating a new entity row for BlobEO.
     oracle.jbo.server.EntityImpl oracle.jbo.server.EntityDefImpl.createBlankInstance(oracle.jbo.server.DBTransaction)
          EntityDefImpl.java:1033
     oracle.jbo.server.EntityImpl[] oracle.jbo.server.ViewRowImpl.createMissingEntities(int[], oracle.jbo.server.EntityImpl[], java.sql.ResultSet, oracle.jbo.AttributeList)
          ViewRowImpl.java:1417
     oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewRowImpl.init(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.server.QueryCollection, java.sql.ResultSet, oracle.jbo.AttributeList)
          ViewRowImpl.java:227
     oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewDefImpl.createBlankInstance(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.server.ViewObjectImpl, oracle.jbo.server.QueryCollection, java.sql.ResultSet, oracle.jbo.AttributeList)
          ViewDefImpl.java:1029
     oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewDefImpl.newInstance(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.server.ViewObjectImpl, oracle.jbo.server.ViewRowSetImpl, oracle.jbo.AttributeList)
          ViewDefImpl.java:930
     oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createInstance(oracle.jbo.server.ViewRowSetImpl, oracle.jbo.AttributeList)
          ViewObjectImpl.java:1916
     oracle.jbo.server.RowImpl oracle.jbo.server.QueryCollection.createRowWithEntities(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.server.ViewRowSetImpl, oracle.jbo.AttributeList)
          QueryCollection.java:728
     oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(int[], oracle.jbo.server.EntityImpl[], oracle.jbo.AttributeList)
          ViewRowSetImpl.java:1386
     oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(oracle.jbo.AttributeList)
          ViewRowSetImpl.java:1432
I searched for error JBO-25017, and I got this:
JBO-25017: RowCreateException
Cause: An unexpected exception occurred while creating a new entity instance.
Action: The entity may not have a public default constructor. Fix the cause for InstantiationException or IllegalAccessException that appears in the details of this exception.
I'm still clueless.. any idea

Andy:
I can think of three possibilities:
1. Your custom EntityImpl subclass does not have a default constructor (the constructor that takes no argument). If that's the case, add the default cons.
2. Your custom EntityImpl subclass is abstract.
3. If neither #1 nor #2 is the case, take a look at your EntityImpl subclass to see if there could be problems creating an instance of it. In particularly, try executing the following line of Java code
new <your-class>();
to see if that gives you any more detailed explanation.
Thanks.
Sung

Similar Messages

  • I have problem with pay method

    I have problem with pay method. My card declined. I change card and I have the same problem. What can i do? Why declined my card again?

    Contact iTunes store support: https://ssl.apple.com/emea/support/itunes/contact.html.

  • Problem with traverse method

    Hi, I am having this problem:
    I made a CustomItem, a TextField, now I overloaded the traverse method, so if the keycode is Canvas.UP or Canvas.DOWN then return false else return true.
    The problem is that when I press the left or rigth button it also returns false and not true.
    and there is another problem with traverse, before returning false or true I set a boolean and call to repaint to draw it on some way if its selected or not, the paint method is being called but it just dont draw as desired.
    protected void paint(Graphics g, int ancho, int alto) {
              System.out.println ("Dentro del paint, seleccionado="+seleccionado);
              try {
                   g.drawString(label, 0, 0, Graphics.TOP|Graphics.LEFT);
                   if (!seleccionado) {
                        g.setColor(120, 120, 120);
                   g.drawRect(0, 4, tama�oTexto+8, 25);
                   if (seleccionado) {
                        g.setColor(255, 255, 255);
                        g.fillRect(1, 5, (tama�oTexto+8-1), 23);
                   g.setColor(0, 0, 0);
                   if (!seleccionado) {
                        g.setColor(80, 80, 80);
                   g.drawString(texto, 4, 7, Graphics.TOP|Graphics.LEFT);
                   if (seleccionado) {
                        int cursorX=Font.getDefaultFont().charsWidth((texto.substring(0, idLetraActual)).toCharArray(), 0, texto.substring(0, idLetraActual).length())+4;
                        g.drawChar('|', cursorX, 7, Graphics.TOP|Graphics.LEFT);
              } catch (Exception E){
                   E.printStackTrace();
         }the traverse method set the seleccionado variable and calls to repaint but instead of being false the paint method is drawing it as true (most of times).

    I have a problem with findByxxx() method.. in
    Container managed bean.
    i have
    Collection collection =
    home.findByOwnerName("fieldValue");
    specified in my Client Program, where ownerName is the
    cmp fieldname..
    and
    public Collection findByOwnerName(String ownerName)
    throws RemoteException, FinderException
    defined in my home interface.
    i have not mentioned the findBy() method anywhere else
    (Bean class). You have to describe the query in the deployment descriptor.
    >
    Even if i have a same "fieldValue" in the database
    (Oracle), which i specified in findBy() method, iam a
    result of owner Not found, which is not the case as i
    have that owner name.
    for the same application if i use findByPrimaryKey(),
    it is working..
    Can any one please post me the solution.

  • Problem with prerender method

    Hi,
    I have a problem with the method prerender. A month ago, I started to develop a web project using Sun Studio Creator and a few page beans that i used extended the Abstract Page Bean, so I overrided the prerender and customized it.
    The problem is that, now i'm using eclipse and the configuration files of the project has changed and the prerender method never execute.
    I want to know why it is happening. Maybe the project is "bad-configurated"?
    Thanks

    The code of java bean doesn't change, the only thing that has changed is the configuration files (faces-config.xml, web.xml, etc).
    I put a breakpoint in the prerender method but the lifecycle doesn�t execute this method.
    After serveral changes, I wrote this code in the method prerender :
    int i=0;
    i = 1;
    And the prerender method doesn't execute.
    I'm a bit lost,
    thanks

  • Problem with affinetransformOp method...

    I have a serious problem with filter method
    I Want to make a image flipping or some other filtering by using
    AffineTransformOp
    but it printouts an erro like this
    cannot resolve symbol
    op.filter (img, flipped)
    (the error pointer shows ".after the op")
    a code from my one of the filters
    BufferedImage flipped = new BufferedImage(img.getHeight(), img.getWidth(),BufferedImage.TYPE_INT_RGB);
    AffineTransform trans = new AffineTransform(0, 1, 1, 0, 0, 0);
    AffineTransformOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    op.filter(img, flipped); //img is my buffered image source
    I used some other ways like (img, null) but always give out error.
    thanks..

    Did you declare "img" as BufferedImage or something else?
    What is the full error message?

  • Problem with WindowClosing() method

    Hello everyone,
    I have some problem with WindowClosing() method, in which I gave options
    to quit or not. Quit is working fine but in case of Cancel, its not returning to
    the frame. Can anyone help me ....Here is my code
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    public class TestFrame extends JPanel
         public static void main(String[] args)
              JFrame frame = new JFrame("Frame3");
              WindowListener l = new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        int button = JOptionPane.showConfirmDialog(null,"OK to Quit","",JOptionPane.YES_NO_OPTION, -1);
                        if(button == 0)     {
                             System.exit(0);
                                   else
                                              return;
              frame.addWindowListener(l);
              frame.setSize(1200,950);     
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    }

    Maybe try
    int button = JOptionPane.showConfirmDialog(yourframe,"OK to
    Quit","",JOptionPane.YES_NO_OPTION, -1);

  • Problem with getPrimaryKeys method in DatabaseMetaData

    I'm using the above mentioned method to get primary keys from a DB2 database. I estimate that 95% of the time it performs as expected, but there are 7 tables in my database, that as far as I can see, are no different to any others and it fails to work with these. Looking at the tables in the DB2 control centre shows them all having keys, no different to any of the other tables. Also of note is that the tables it fails on are next to each other, it fails on tables 68 and 69, 135 and 136 and 200,201 and 202. Just wondering if anyone else has seen this problem before and if they found any solutions for it?
    Just ran through the program again and it's failed on a completely different set of tables, they're all sequential as well, could this be a problem with my connection to the db?
    Edited by: jnaish on Aug 14, 2008 7:38 AM

    post the ddl and code i guess
    i doubt this is related to your connection
    Also of note is that the tables it fails on are next to each other, i can't imagine that would be a problem, but sounds like it'd be easy for you to prove your theory with a simple test

  • Problem with Vector method addElement

    I am new to Java. I am using JDK 1.3. I am writing a program that will convert a text file to a binary file that stores a Vector object. I have narrowed my problem to the method that reads the text file and creates my vector. Each element in my vector stores an integer and a string variable. The reading of the text file works find and the creation of my record works find. It seems that the storing of the record in the vector is not working. When I print the first 10 elements of the vector, it have the same record(the last record of my text file). What is wrong with the method below? I am also appending the result of running my program.
    private static void readTextFile(File f) {
    try {
    FileReader fileIn = new FileReader(f);
    BufferedReader in = new BufferedReader(fileIn);
    String line;
    int i;
    SsnLocationRecord recordIn = new SsnLocationRecord();
    int ctr = 0;
    while (true) {
    line = in.readLine();
    if (line == null)
    break;
    ctr += 1;
    i = line.indexOf(" ");
    recordIn.putAreaNumber(Integer.parseInt(line.substring(0,i).trim()));
    recordIn.putLocation(line.substring(i+1).trim());
    records.addElement(recordIn);
    if (ctr < 11)
    System.out.println(recordIn);
    in.close();
    } catch (IOException e) {
    System.out.println ("Error reading file");
    System.exit(0);
    for (int i = 0; i < 11; i++)
    System.out.println((SsnLocationRecord) records.elementAt(i));
    RESULTS:
    C:\Training\Java>java ConvertTextFileToObjectFile data\ssn.dat
    0 null
    3 New Hampshire
    7 Maine
    9 Vermont
    34 Massachusetts
    39 Rhode Island
    49 Connecticut
    134 New York
    158 New Jersey
    211 Pennsylvania
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    C:\Training\Java>

    First of all it would be better if you did a priming read and then checked line == null in the while statement instead of the way you have it.
    ctr++ will also accomplish what ctr +=1 is doing.
    you need to create a new instance of SsnLocationRecord for each line read. What you are doing is overlaying the objects data each time you execute the .putxxxx methods. The reference to the object is placed in the vector. The actual object is still being updated by the .putxxx methods (NOTE : THIS IS THE ANSWER TO YOUR MAIN QUESTION).
    you close should be in a finally statement.
    To process through all the elements of a Vector create an Enumeration and then use the nextElement() method instead of the elementAt is probably better. (Some will argue with me on this I am sure).
    Also, on a catch do not call System.exit(0). This will end your JVM normally. Instead throw an Exception (Runtime or Error level if you want an abnormal end).

  • Problem with GetLineData Method

    Hi
    I have a program to save each row of a A/R Invoice as one A/R Invoice document.
    In the program, I read each line of data from matrix with GetLineData Method, and set the data to business object, and add the document at a global transaction.
    Adding the first line of document works fine, but the second line has a problem. There is no response in the  the GetLineData Method.
    Does anybody have any idea?
    The code looks like the following:
    Private Sub MakeSalesInvoice(ByRef BubbleEvent As Boolean)
         Dim i As Integer                                             
           Try
                If Not (SBO_COMPANY.InTransaction) Then
                    Call SBO_COMPANY.StartTransaction()
                End If
                oMatrix = oForm.Items.Item("38").Specific                 
                For i = 1 To oMatrix.RowCount - 1
                    oMatrix.GetLineData(i)                //here, there is no response when i >=2
                    subSetInvoiceH()
                    subSetInvoiceL()
                    If InvoiceH.Add() <> 0 Then
                       Exit Sub
                    End If
                    InvoiceH = Nothing
                    InvoiceL = Nothing
                    InvoiceLA = Nothing
                Next
                If SBO_COMPANY.InTransaction Then
                    SBO_COMPANY.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
                End If
                BubbleEvent = False
                oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE
                oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
            Catch ex As Exception
                If SBO_COMPANY.InTransaction Then
                    SBO_COMPANY.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
                End If
            End Try
       End Sub
       Private Sub subSetInvoiceH()
       //code to set A/R Invoice header data to SAPbobsCOM.Documents
       End Sub
       Private Sub subSetInvoiceL()
      //code to set A/R Invoice line data to SAPbobsCOM.Documents_Lines
       End Sub
    Can someone help me?
    Thanks in advance.

    Thanks for the response.
    I tried GetLineData(i-1), but got error "Row - Invalid index" message.
    I think the index of the datasource has no problem in my program since i set -1 when i get the data from datasource.
    The following is the code when setting data to the business objects.
    Private Sub subSetInvoiceH()
            Dim nCount As Integer
            Dim oDBDataSource As SAPbouiCOM.DBDataSource
            oDBDataSource = oDBDataSources.Item("OINV")
            nCount = oDBDataSource.Size - 1
            InvoiceH = SBO_COMPANY.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            With InvoiceH
                If oDBDataSource.GetValue("CardCode", nCount) <> "" Then
                    .CardCode = oDBDataSource.GetValue("CardCode", nCount)
                Else
                    .CardCode = ""
                End If
                If oDBDataSource.GetValue("DocDate", nCount) <> "" Then
                    .DocDate = oDBDataSource.GetValue("DocDate", nCount).Insert(4, "/").Insert(7, "/")
                Else
                    .DocDate = "0"
                End If
            End With
        End Sub
    Mika

  • Problem with binarySearch method

    In the code below I've got a problem with my binarySearach method in the IntegerList.java file. When I look at my IntegerTest file, Eclipse give me this message next to my method call for the binarySerch (case 6): (the method binarySearch int[] , int) in the type integerList is not applicable for the arguments (int). So what the heck have I done wrong? I know it's a lot of code to look at but felt you'll need to see both classes to make heads or tales out of this.
    Thanks in advance.
    import java.util.Scanner;
    public class IntegerList //implements Comparable
         int [] list; // values in the list
         //Constructor -- takes an integer and creates a list of that
         //size.  All elements default to value 0.
         public IntegerList(int size)
              list = new int[size];
         //randomize -- fills the array with randomly generated integers
         //between 1 and 100, inclusive
         public void randomize()
              int max = list.length;
              for (int i=0; i < list.length; i++)
                   list[i] = (int) (Math.random() * max) +1;
         //fillSorted -- fills the array with sorted values
         public void fillSorted()
              for (int i =0; i <list.length; i++)
                   list = i + 2;
         //print -- prints array elements with indices, one per line
         public String toString()
              String s = "";
              for (int i = 0; i <list.length; i++)
                   s += i + ":\t" + list[i] + "\n";
              return s;
         //linearSearch -- takes a target value and returns the index
         //of the first occurrence of target in the list. Returns -1
         //if target does not appear in the list
         public int linearSearch (int target)
              int location = -1;
              for (int i = 0; i < list.length && location == -1; i++)
                   if (list [i] == target)
                        location = i;
                   return location;
         //sortIncresing -- uses selection sort
         public void sortIncreasing()
              for (int i =0; i < list.length -1; i++)
                        int minIndex = minIndex(list, i);
                        swap (list, i, minIndex);
    private void swap(int[] list, int index, int min)
    int temp =list [index];
    list [index] = list [min];
    list [min] = temp;
    // private int minIndex(int[] list, int index)
    public int minIndex(int[] list, int lastIndex) {
    int min=list[lastIndex];
    for (int i=lastIndex+1; i<list.length; i++)
    if (list[i]<min)
    lastIndex=i;
    return lastIndex;
    public void sortDecreasing()
              for (int i =0; i > list.length -1; i++)
                        int minIndex = minIndex(list, i);
                        swap (list, i, minIndex);
    public static int binarySearch (int [] list, int val)
    int min = 0, max = list.length, mid =0;
    boolean found = false;
    while (!found && min <= max)
    mid = (min + max) / 2;
    if (list [mid]== val)
    found = true;
         //if the mid point contains the value being searched for
         //then we are done
    else
    if (list[mid]< val)
    max = mid -1;
    else
    min = mid+1;
    if (found)
    return list[mid];
    else
    return -1;
    return val;
    }//end class
    //now for the IntegerListTest class
         //File: integerListTest.java
         //Purpose: Provide a menu-driven tester for the IntegerList class.
         import java.util.*;
         public class IntegerListTest
              static IntegerList list = new IntegerList(10);
              static Scanner scan = new Scanner(System.in);
         // main -- creates an initial list, then repeatedly prints
         // the menu and does what the user asks until they quit
         public static void main(String [] args)
              printMenu();
              int choice = scan.nextInt();
              while (choice != 0)
                        dispatch(choice);
                        printMenu();
                        choice = scan.nextInt();
         // dispatch -- takes a choice and does what needs doing
         public static void dispatch(int choice)
              int loc;
              int val;
              long time1, time2;
              long totalTime;
              switch (choice)
                        case 0:
                             System.out.println("Bye!");
                             break;
                        case 1:
                             System.out.println(list);
                             break;
                        case 2:
                             System.out.println("How big should the list be?");
                             list = new IntegerList (scan.nextInt());
                             System.out.println("List is created.");
                             break;
                        case 3:
                             list.randomize();
                             System.out.println("List is filled with random elements.");
                             break;
                        case 4:
                             list.fillSorted();
                             System.out.println("List is filled with sorted elements.");
                             break;
                        case 5:
                             System.out.print("Enter the value to look for: ");
                             val = scan.nextInt();
                             time1 = System.currentTimeMillis();
                             loc = list.linearSearch(val);
                             time2 = System.currentTimeMillis();
                             totalTime = time1 - time2;
                             System.out.print(totalTime);
                             if (loc != -1)
                                  System.out.println("Found at location " + loc);
                             else
                                  System.out.println("Not in list");
                             break;
                        case 6:
                             System.out.print("Enter the value to look for: ");
                             val = scan.nextInt();
                             loc = list.binarySearch(val);
                             if (loc != -1)
                                  System.out.println("Found at location " + loc);
                             else
                                  System.out.println("Not in list");
                             break;
                        case 7:
                             list.sortIncreasing();
                             System.out.println("List has been sorted.");
                             break;
                        case 8:
                             list.sortDecreasing();
                             System.out.println("List has been sorted.");
                             break;
                        default:
                             System.out.println("Sorry, invalid choice");
         // printMenu -- prints the user's choices
         public static void printMenu()
              System.out.println("\n Menu ");
              System.out.println(" ====");
              System.out.println("0: Quit");
              System.out.println("1: Print the list");
              System.out.println("2: Create a new list of a given size");
              System.out.println("3: Fill the list with random ints in range 1-length");
              System.out.println("4: Fill the list with already sorted elements");
              System.out.println("5: Use linear search to find an element");
              System.out.println("6: Use binary search to find an element " +
                                  "(list must be sorted in increasing order)");
              System.out.println("7: Use selection sort to sort the list into " +
                                  " increasing order");
              System.out.println("8: Use insertion sort to sort the list into " +
                                  " decreasing order");
              System.out.println("\nEnter your choice: ");

    Ah... But now that I have looked at it some more, I have noticed that the array of int is created in your IntegerList class...
    so you want to change your binarySearch() method...
    from...
    public static int binarySearch (int[] list,int val)to
    public int binarySearch (int val)now it will search the list declared in your constructor...
    and also note that static is remove to eliminate the non-static reference from static context error...
    so in IntegerList.java, that method signature should look like this...
    public int binarySearch (int val)// take only one arguement and...
    // check against internal int [] listand you call it like this...
    loc = list.binarySearch(val);// not changednow all you have to do it get your list populated with random integers for the rest to work... I leave that to you...
    - MaxxDmg...
    - ' He who never sleeps... '

  • Problem with getState() method in Thread class

    Can anyone find out the problem with the given getState() method:
    System.out.println("The state of Thread 1: "+aThread.getState());
    The Error message is as follows:
    threadDemo.java:42: cannot resolve symbol
    symbol : method getState ()
    location: class incrementThread
    System.out.println("The state of Thread 1: "+aThread.getState())
    ^
    1 error

    the api doc shows Since: 1.5
    You do use Java 5...if not... it's not available.

  • Problem with a method

    I have a problem with the getRGB(int x, int y) method of the BufferedImage class :
    I've load an image in it :
    1:// b is my bufferedimage clas and myimage is an image
    2:b.getGraphics().drawImage(myimage, 0, 0, this);
    3:// g is the graphics object of my paint method
    4:g.drawImage(b, 634, 225, null);
    5:// This write -16777216 and 10, 10 is a black point
    6:System.out.println(b.getRGB(10, 10));
    I think the problem is at the second line. But i'm not sure. Can somebody help ?

    That's probably not what you meant. You can do a binary and:int r = (hex & 0x00FF0000) >> 16;
    int g = (hex & 0x0000FF00) >> 8;
    int b = (hex & 0x000000FF);

  • Problem with flush method

    Hello, I'm new in java development, and I'm french with a student English, sorry if that I say is strange is the expressions.
    I have a problem with network streams and serialization.
    I want to establish a connection between 2 apps, on 2 different computers. For the development, the tests are local (IP : 127.0.0.1)
    The problem : I send 4 bytes and I flush after, and I receive 6 bytes. To know what is transmitting on the connection, I override the OutputStream class.
    I think that the flush() method produces 2 bytes but i don't think how.
    I put you the codes follow :
    Thanks for any help.
    The sender function :
    // This function is called when the user want to send data to another user.
    // This piece of function establishing the connection between 2 users.
    public int startListeningForNFT(String senderUserName, int indexOfSender) {
          System.out.println(senderUserName + " demande à " + this.userName + " de démarrer la procédure de réception.");
          /* Cette fonction est l'interface ente le serveur et le client2,
           * elle retourne le port  et l'IP que le client2 le lui a renvoyé. */
          /* This function send an Integer which will trig a reception function in the receiver
             This function is called in a Thread. */
          try {
             this.oos.writeObject(44);
             this.oos.flush();
             System.out.println("On a bien envoyé OBJ2AskerInfos sur le port " + portToListen);
             byte b = this.ois.readByte();
             System.out.println("Byte = " + b);
             b = this.ois.readByte();
             System.out.println("Byte = " + b);
             b = this.ois.readByte();
             System.out.println("Byte = " + b);
             b = this.ois.readByte();
             System.out.println("Byte = " + b);
             b = this.ois.readByte();
             System.out.println("Byte = " + b);
          catch (IOException e) { e.printStackTrace(); }
          return Constantes.PORT_DATA;
       }The receiver function :
    public class ClientClient implements WindowClient {
       // This 3 attributes are initalized correctly.
       private Socket comSocket;
       private String comPort;
       private String userName;
       public ClientClient() {
          try {
          comSocket = new Socket(ipToJoin, Integer.parseInt(comPort));
          oos = new ObjectOutputStream(new DebugOutputStream(comSocket.getOutputStream()));
          ois = new ObjectInputStream(comSocket.getInputStream());
          oos.writeObject(userName);
          oos.flush();
          ThreadInputListener til = new ThreadInputListener();
          til.start();
          catch (UnknownHostException e) { e.printStackTrace(); }
          catch (ClassNotFoundException e) { e.printStackTrace(); }
          catch (IOException e) {
             e.printStackTrace();
             JOptionPane.showMessageDialog(null, ("Auncun serveur n'a été trouvé sur l'adresse indiquée :\n" + ipToJoin), "Erreur", JOptionPane.ERROR_MESSAGE);
       public class ThreadInputListener extends Thread {
          @SuppressWarnings("unchecked")
          public void run() {
             try {
                while(true) {
                   Object receivedObject = ois.readObject();
                   // Si l'objet reçu est un OBJ2InfosOnAsker => Renvoyer le port.
                   // If received Object is an integer
                   if(receivedObject instanceof Integer) {
                      System.out.println(userName +" a bien reçu l'objet OBJ2InfosOnAsker...");
                      System.out.println(userName +" a bien reçu int." + receivedObject);
                      System.out.println("On lance les 4 int :");
                      // Send 4 bytes to the sender (control bytes, just for solve the problem)
                      oos.writeByte(7);
                      oos.writeByte(8);
                      oos.writeByte(9);
                      oos.writeByte(10);
                      oos.flush();
                      System.out.println("...et a bien envoyé le port");
             catch (IOException e) {
                // ArrayList<HostClient> temp = new ArrayList<HostClient>();
                // temp.add(new HostFictiveClient(userName));
                // fenetreprincipale.updateClientList(temp);
                fenetreprincipale.addDiscution("Vous avez été déconnecté du serveur.");
             catch (ClassNotFoundException e) { e.printStackTrace(); }
       }The override function of OutputStream :
       public class DebugOutputStream extends OutputStream {
          private OutputStream os;
          public DebugOutputStream(OutputStream os) {
             super();
             this.os = os;
          @Override
          public void write(int b) throws IOException {
             System.out.println("ClientClient envoie " + b + " soit " + ((char)b));
             os.write(b);
    }The sender function says :
    Host demande à User1 de démarrer la procédure de réception.
    On a bien envoyé OBJ2AskerInfos sur le port 3001
    Byte = 4
    Byte = 0
    Byte = 7
    Byte = 8
    Byte = 9And the receiver function says :
    User1 a bien reçu l'objet OBJ2InfosOnAsker...
    User1 a bien reçu int.44
    On lance les 7 int :
    ClientCLient envoie 119 soit w       //
    ClientCLient envoie 4 soit          // Both of this lines are stranges
    ClientCLient envoie 7 soit
    ClientCLient envoie 8 soit
    ClientCLient envoie 9 soit      
    ClientCLient envoie 10 soit
    ...et a bien envoyé le port

    Minimus wrote:
    Ok, but this layer has maid just to print in the eclipse console the bytes written on the stream, With or without this function, the flush() operation generate 2 bytes, I don't know why.
    When I want to send manually the byte '7', the result of both lines :
       oos.writeByte(7);
    oos.flush();is that my writeByte and my flush send 3 bytes :
    Byte val = 119 charcode = w
    Byte val = 1 charcode =
    Byte val = 7 charcode =
    Only the 'Byte val = 7 charcode = ' line is good.
    Why the flush generate 2 unknown bytes at this code position ?Actually, it's (might be) writing more than two bytes. Run this:
    public class OOSTest {
       public static void main(String[] args) throws Throwable {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          ObjectOutputStream oos = new ObjectOutputStream(baos);
          oos.writeByte(7);
          oos.close();
          byte[] bytes = baos.toByteArray();
          System.out.println(Arrays.toString(bytes));
          //prints "[-84, -19, 0, 5, 119, 1, 7]"
    }The explanation is in the Javadoc for ObjectOutputStream:
    Primitive data, excluding serializable fields and externalizable data, is written to the ObjectOutputStream in block-data records. A block data record is composed of a header and data. The block data header consists of a marker and the number of bytes to follow the header. OOSs should only be used when the OIS is being used properly on the other end. If you don't want this header, use a DataOutputStream. Is there an actual problem or are you just confused about the extra bytes? If there is a problem in reading, my guess is that you're somehow not reading from your OIS symmetrically with your OOS. Can you post a complete, compilable example that demonstrates the behaviour? There's obviously an issue somewhere, I just haven't spotted it yet.
    If there wasn't an actual problem in reading, well: there's your explanation.
    Edited by: endasil on 26-Oct-2009 10:55 AM

  • Problem with forward method of jsp

    am having problem with the requestDispatcher.forward method in my jsp + wml , the forward method gets executed but the new page is not displayed in the wap browser,
    code snippet
    small.jsp
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <%@ page language="java" %>
    <%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
    <%@ page import="java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util.Properties "%>
    <%
    System.out.println("in small");
    RequestDispatcher rd = request.getRequestDispatcher("small1.jsp");
    rd.forward(request,response);
    %>
    small1.jsp
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
    <%@ page language="java" autoFlush="false"%>
    <%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
    <%@ page import="java.net.*,java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util .Properties"%>
    <%
    String sm = "small1";
    System.out.println("in small1");
    %>
    <wml>
    <card id="two">
    <p>
    <small><%=sm%></small>
    </p>
    </card>
    </wml>
    i get the following output in the log
    in small
    in small1
    but i dont get to see the small1.jsp' content , also the response.sendRedirect method works fine ,,
    pls give me the soln
    Thnk u in advance

    thank u very for the repl this is the message which i get in the nokia wap browser...
    cannot load small1.jsp(HTTP Error 500 Server Error)
    and i use IBM WebSphere as the web server....
    and i have found that using response.reset in the small2.jsp overcomes this problem but the card title and the anchor tag is not displayed !!!!
    what could be this problem?

  • Problems with post-method in weblogic-server 6.0

    Hello,
              I tried to implement a servlet in Visual Cafe working with weblogic 6.0.
              As I used the get-method it worked fine, but as I used the post-method
              I got the following java.lang.IllegalArgumentException:
              bad URLMatchMap path:''
              Does anybody know about this error and where I would have to set the
              path-variable. I have already registered the servlet in web.xml
              Thanx for your help
              Thorsten
              

              Try installing SP1. In SP1 a bug regarding POST using HTTPS has been fixed. Check
              the bug id 041234 in this link
              http://edocs.bea.com/wls/docs60/notes/bugfixes2.html#1073617
              Shiva.
              "Raju" <[email protected]> wrote:
              > Hi,
              >>
              >> We are using Weblogic server 6.0 with out service pack 1.0.
              >>
              >> I am having problem with Https POST, i am using port 7002. and when
              >i use
              >> https post servlet hangs for lot of time. But when i use Https using
              >GET,it
              >> works fine.
              >>
              >> Did any one face the problems.
              >>
              >> Thanks in Advance.
              >>
              >> Raju
              >>
              >
              >
              >
              

Maybe you are looking for

  • XP Sound driver doesn't work on a Satellite A100-02B

    Hello, I've installed Windows XP on my Satellite A100-02B. But the Sound Driver from Toshiba Download Site doesn't work. The installation works without any errors, but Windows doesn't find a sound card and I can't hear anything. Can you help me? Than

  • Special character in my product name

    The name of my product is supposed to have a TM and em dash in the product name in all instances. Of course, I have had huge problems with that. Now I finally have a .chm working on a very limited basis, but it has changes all instances of the dash t

  • Having problems using FaceTime on my iPad?

    Every time I go to use FaceTime on my iPad it says I'm unavailable, can anyone help?

  • Cannot connect to the internet it has been connected to for a year.

    Monday my Apple TV worked fine. Yesterday, it wouldn't connect to the WiFi it had been connected to for a year. I tried to hardwire it to the apple extreme and it slowed my network down to a snails pace.  I bought a new Apple TV last night and it wor

  • Content of old emails will not load after Yosemite upgrade

    I recently installed Yosemite. All my old emails are still there, listed under the 'Sort by date' column, with sender, subject and the first few words showing.  but the content will not load. New emails are downloading and content showing fine. I hav