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.

Similar Messages

  • Dynamic Class Loading and Stubs

    How Dynamic Class Loading is used on Java RMI, since stubs are generated on clients using Reflection API?
    I was reading Dynamic code downloading using JavaTM RMI (http://java.sun.com/javase/6/docs/technotes/guides/rmi/codebase.html), it seems to be out of date.
    For example, "The client requests the class definition from the codebase. The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry. Back in step 1, the annotated stub for the exported object was then registered with the Java RMI registry bound to a name."

    "Enhancements in J2SETM 5.0
    Dynamic Generation of Stub Classes
    This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. *Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on _earlier versions_.*
    When an application exports a remote object (using the constructors or static exportObject methods(1) of the classes java.rmi.server.UnicastRemoteObject or java.rmi.activation.Activatable) and a pregenerated stub class for the remote object's class cannot be loaded, the remote object's stub will be a java.lang.reflect.Proxy instance (whose class is dynamically generated) with a java.rmi.server.RemoteObjectInvocationHandler as its invocation handler.
    An existing application can be deployed to use dynamically generated stub classes unconditionally (that is, whether or not pregenerated stub classes exist) by setting the system property java.rmi.server.ignoreStubClasses to "true". If this property is set to "true", pregenerated stub classes are never used.
    Notes:
    * If a remote object has pre-5.0 clients, that remote object should use a stub class pregenerated with rmic or the client will get an ClassNotFoundException deserializing the remote object's stub. Pre-5.0 clients will not be able to load an instance of a dynamically generated stub class, because such a class contains an instance of RemoteObjectInvocationHandler, which was not available prior to this release.
    * Prior to the J2SE 5.0 release, exporting a remote object would throw a java.rmi.StubNotFoundException if the pregenerated stub class for the remote object's class could not be loaded. With the added support for dynamically generated stub classes, exporting a remote object that has no pregenerated stub class will silently succeed instead. A user deploying a server application to support pre-5.0 clients must still make sure to pregenerate stub classes for the server's remote object classes, even though missing stub classes are no longer reported at export time. Such errors will instead be reported to a pre-5.0 client when it deserializes a dynamically generated stub class.
    (1) The static method UnicastRemoteObject.exportObject(Remote) is declared to return java.rmi.server.RemoteStub and therefore cannot be used to export a remote object to use a dynamically generated stub class for its stub. An instance of a dynamically generated stub class is a java.lang.reflect.Proxy instance which is not assignable to RemoteStub."
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

  • 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

  • EOFException when deserializing object in if statement

    Hi,
    I'm a java newbie and I've got a program in which I've got an method to open a serialized file.
    I am running into problems when determining the class of the object to be deserialized.
    When the code is as such everything works fine:
        ObjectInputStream ois;
        protected void open() {
            int returnVal = fc.showOpenDialog(this);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                try {
                 ois = new ObjectInputStream(new FileInputStream(file));     
              frameSeqA72 = (SeqA72) ois.readObject();
              getContentPane().add(frameSeqA72);
              frameSeqA72.setVisible(true);
              ois.close();                                                                                                           
             catch (IOException ioe) {ioe.printStackTrace();}
             catch (ClassNotFoundException cnfe) {}     
        }For some reason I don't understand everything changes when I use an if statement in the code as follows:
        ObjectInputStream ois;
        protected void open() {
            int returnVal = fc.showOpenDialog(this);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                try {
                 ois = new ObjectInputStream(new FileInputStream(file));     
              if (ois.readObject() instanceof SeqA72) {
                  frameSeqA72 = (SeqA72) ois.readObject();
                  getContentPane().add(frameSeqA72);
                  frameSeqA72.setVisible(true);
                  ois.close();                                                    
             catch (IOException ioe) {ioe.printStackTrace();}
             catch (ClassNotFoundException cnfe) {}     
        }An EOFException is thrown when this method is called -
    "EOFException at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267)..."
    My serialized objects are of different classes so I want to determine the class before casting...so Im using "if (ois.readObject() instanceof SeqA72)".
    Why would the first version work and the second throw an exception?
    Am I going about this in a bad way?
    Casey

    You're calling readObject twice, so it's trying to read two objects.
    Read it once and save a reference in a variable. Use that variable, instead of calling readObject again.

  • 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
              

  • Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.dr

    Hi
    I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment:
    Setting Up Your Environment
    On Win95/Win98/NT:
    - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
    [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
    used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
    - Make sure [ORACLE_HOME]\bin is in your PATH.
    Still I am getting the following error during runtime:
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jdbc.InsertQueryEx.main(InsertQueryEx.java:11)
    Below is the source code:
    import java.sql.*;
    import java.io.*;
    public class InsertQueryEx {
    public static void main(String[] args)throws Exception{
    Class.forName("oracle.jdbc.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Prashy:1521:orcl", "scott", "tiger");
    DataInputStream din = new DataInputStream(System.in);
    Statement stmt = con.createStatement();
    while(true){
    try{
    System.out.println("enter emp name");
    String name = din.readLine();
    System.out.println("enter emp no");
    int no = Integer.parseInt(din.readLine());
    System.out.println("enter emp salary");
    float sal = Float.parseFloat(din.readLine());
    System.out.println("enter emp address");
    String addr = din.readLine();
    int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')");
    if(count>0)
    System.out.println("Record added");
    else
    System.out.println("Failed");
    catch (Exception e){
    System.err.println("Exception: "+e.getMessage());
    Any help is appreciated
    Thanks
    Prashant

    I am sorry but I did add those in the classpath but still getting this error:
    This is what I have for user variable in classpath:
    .;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
    error is:
    java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
    Thanks

  • Next-generation plug-in 1.6 : ClassNotFoundException and not caching JARs

    Hi,
    Since the introduction of the next-generation plug-in in Java 1.6.0_10, the applet I have used and developed for many years don't load anymore.
    The situation is this : the Jars of this applet are embedded in a Lotus Notes database as Java resources, in order to be used in a particular form in my application. Note that this application is accessed via a Web browser through a Domino server and that this application requires a user authentication. If I try to open the form containing the applet while using a plug-in 1.6.0_10 or newer, with default parameters (cache and next-generation plug-in activated), here is the exceptions I get (here with plug-in 1.6.0_20) :
    load : class mycompany/tools/Planner not found.
    java.lang.ClassNotFoundException: mycompany.tools.Planner
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed:http://www.mycompany.com:80/test/database.nsf/46277DA0EF2790B0C12574040052D714/$FILE/mycompany/tools/Planner.class
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception : java.lang.ClassNotFoundException: mycompany.tools.PlannerBy reading a lot forums I found that a lot (really a lot) of people were experiencing the exact same issue, regardless of the type of server they used to host their applet. And unfortunately, only few answers were relevant to help me understand why I got this error...
    By looking deeper in the documentation, I have found this [Applet Developer's guide|http://download.oracle.com/javase/6/docs/technotes/guides/jweb/applet/applet_dev_guide.html]. Here, it is written that one of the enhancement of the next-generation plug-in is that : "+... The JVM running the applet is isolated from the web browser at the operating system level. If something should go wrong while running the applet, or if an uncooperative applet refuses to shut down, the new Java Plug-in detects and handles the error condition gracefully; the Web browser is unaffected+".
    I am not quite sure of what it really means, but I have started to think that my problem could be that, by running in a separate process than the one of the Web browser, loading the Jars will require an authentication on my server. To verify this hypothesis, I have changed the codebase of my applet, so the Jars are downloaded from another server where no user authentication is required. The good news is that my applet can now find the Jars and run as expected. The bad news is that none of the Jars are placed in the cache, which means that the Jars have to be downloaded each time I start a new session to work with my applet.
    I have also tried to disable the "Use the next-generation plug-in" option in the Java control panel. In this case, everything is fine, too, and even the Jars are stored in the cache. The interesting thing is that afterwards, by enabling the "Use the next-generation plug-in" option again, the applet will load and run like a charm... because the Jars are in the cache and the class loader can find them! (I suspect that this case has been experienced by several people, answering on forum posts that they cannot reproduce the issue.)
    Anyway, even if there is some workarounds to ensure it is possible to work with the latest versions of the plug-in, having to change the default options is not always easy or possible, depending of the environment. This applet that I am talking about is used by a lot of our customers and all have their internal policies and requirements regarding the Java configuration. If for some of them it will be possible to use a workaround, for others it will not. And this is a major problem to me.
    As I said, a lot of people have experienced this issue. I hope that someone having a better understanding on how this next-generation plug-in works, will have a solution, or at least, will be able to explain what is wrong in this approach and if my suggestion regarding an authentication issue for the class loader make sense.
    Any help will be greatly appreciated.
    Philippe

    Hi,
    I was wrong in my approach.
    My applet was implemented using the "<object>" tag and it seems that it was not the best way to address compatibility issues across all versions of the plug-in and all browsers.
    So, I have finally found what I was looking for in this "[Java Rich Internet Applications Development and Deployment|http://download.oracle.com/javase/6/docs/technotes/guides/jweb/index.html]" guide. In this guide, it is recommended to use the "[Deployment Toolkit|http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit]", based on a Javascript library containing everything needed to deploy your application as an applet or a Java Web Start application.
    My application, deployed as an applet, now works like a charm.
    I hope pointing on this Deployment Toolkit will also help others...
    Philippe

  • ClassNotFoundException for a single class in my project... HELP!

    Hey all,
    I hope someone has an answer to my problem because I wasted enough time trying to figure it myself and, admittedly, I have no idea what I'm doing.
    So I have two projects in Eclipse. One project contains a bunch of data access objects (DAO) -- my data access layer -- and the other project is a tool which uses the DAOs to perform some operations. So everything was going hunky-dory until I made an instance of this one DAO class in my tool. When I tried running it, I got a ClassNotFoundException being thrown from the constructor invocation (i.e., new DAO()). It didn't execute the constructor, it just went straight into the exception code. This makes no sense to me because every other DAO class I'm using in my tool works just fine.
    I've tried cleaning my projects out and rebuilding to no avail. I've also deleted them from my workspace and checked them out from my CVS server, again to no avail. Does anyone know why this one DAO is not visible to my tool?! Why it can't find it?!
    I'm willing to try anyone's suggestion at this point, so please help! I'd appreciate it. Thanks!

    This makes no sense to meWhat you are dealing with here is a classpath issue. At compile time, apparently whatever DAO class you need is available and the compiler has nothing to complain. When the application is executed however, the DAO class is no longer in the classpath.
    So how is your DAO project built? If it is a jar (if it is not, it should be), then that jar is not in the classpath of your tool while it is being executed. Most likely you need to add the jar as a library to the project of your tool for it to work.

  • Deserializing obj on network drive take a long time -- any ideas to improve

    Good morning!
    Deserializing objects from a network drive is taking way too long, much slower than deserializing the same object files stored on the local hard drive of the development PC. How I can reduce the time??
    The size of the serialized objects is small (72K and 17K).
    The PC access network drives quickly enough (word processing, text editing, etc). The PC JVM is 1.5.0_09 and the OS is Windows XP.
    Here is the background.
    I had the idea to create objects and serialized them on my server (an AS400) and let client applications deserialize them.
    Now that I have it running I find that deserializing the objects off the server take way too long! Does anyone have any ideas how to improve this.
    If I copy the serialized objects off the server onto the local hard drive of the development PC and access them from the local hard drive the speed is fine.
    To my mind that eliminates the potential for incompatibility between the JVM which serialized the objects and the JVM which descerialized the object. That is, the deserialize fast on the local drive, slow over the network.
    Used both UNC and mapped drive to access the server and I can't see any performance difference. That is
    filename = "//server/java/ftpaudit/SerializedObject.ser"
    and
    filename = "J:/ftpaudit/SerializedObject.ser"
    where J: is mapped to //server/java
    This is the code which deserialize the objects.
    try {
         File file = new File(filename);
         FileInputStream f = new FileInputStream(file);
         ObjectInputStream ois = new ObjectInputStream(f);
         Object returnObj = ois.readObject();
         ois.close();
         f.close();
         return returnObj;
    } catch (InvalidClassException ice) {
         ....Thank you for your time and help.
    BillB

    Could the file be locked on the server?I don't believe it is. It eventually (minutes loads). The delay is consistent. I haven't put the logging to see what part of the deserialize method is chewing up the time yet.
    Putting in code to copy the file from the server to the local hard drive then deserializing performs much, much faster (milliseconds, almost as fast as deserializing directly from the local drive).
    I modified this from another post to this forum
    try {
            FileChannel srcChannel = new FileInputStream(file).getChannel();
            FileChannel dstChannel = new FileOutputStream(dir+file).getChannel();
            dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
            srcChannel.close();
            dstChannel.close();
        } catch (IOException e) {
            e.printStackTrace();
        }I was wondering if there was a more efficient way to deserialize an object than the one in my original post. Or if there were hidden aspects to consider such as buffer size.
    Here's an alternative approach: since the server side
    is written in Java (I'm assuming, since you say that
    it writes a file containing serialized data), why not
    create an RMI interface for retrieving the
    information? The current approach, of opening a file
    over the network, is very fragile -- what happens in
    the network mount point or share name changes?Thank you. Good suggestion.

  • HELP! Jdbc connection to oracle ClassNotFoundException classpath issues..

    Okay I am a newbie to this but all the other posts concerning this just say add the classes12.jar to my classpath.
    I am using websphere 5.0
    connecting to a 9i db.
    after trying to find out what my classpath is ( websphere 5.0 makes it difficult to see it) i found this:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="var"
    path="SERVERJDK_50_PLUGINDIR/jre/lib/rt.jar"
    rootpath="SERVERJDK_SRCROOT" sourcepath="SERVERJDK_50_PLUGINDIR/src.jar"/>
    <classpathentry kind="src" path="Java Source"/>
    <classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/j2ee.jar"/>
    <classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/servletevent.jar"/>
    <classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/ivjejb35.jar"/>
    <classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/runtime.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/string.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/jaxen-full.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/utility.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/jspsql.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/xercesImpl.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/xalan.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/datetime.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/mailer.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/dom.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/jstl.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/standard.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/jdbc2_0-stdext.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/saxpath.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/sax.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/dbbeans.jar"/>
    <classpathentry kind="lib" path="Web Content/WEB-INF/lib/jaxp-api.jar"/>
    <classpathentry kind="lib" path="C:/oracle/ora92/jdbc/lib/classes12.jar"/>
    <classpathentry kind="output" path="Web Content\WEB-INF\classes"/>
    </classpath>
    to me it looks like it is in my classpath.. (if thats what this is).
    I have imported the classes12.jar file several times through out my project to no avail.
    the error i get it here:
    Error: It Screwed up agian java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    SystemOut O Connecting ... cisinv
    Error: java.sql.SQLException: No suitable driver
    SystemErr R Exception: null
    from this code:
    package Business;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    * @author jeffreak
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class beanDbConnect {
         * Constructor for beanDbConnect.
         public beanDbConnect() {
              super();
         private Connection con = null;
         private Statement cmd = null;
         private ResultSet rs = null;
         public Connection connect()
              //Declare variable
              boolean blnSuccessfulOpen = false;
              Driver driver;
              String driverName;
              String serverAddress;
              //Begin try block
              try
                   //Load JdbcOdbcDriver
                   driverName = "oracle.jdbc.driver.OracleDriver";
                                  //oracle.jdbc.driver.OracleDriver     
                   System.out.println("Loading ..." + driverName);
                   //try{
                   Class.forName(driverName).newInstance();
                   //catch (Exception err)
    //                    System.err.println("Error: new instance: " + err.toString());
              System.out.println("Database loaded successfully");
              //catch (ClassNotFoundException e)
              catch (Exception e)
                   System.err.println("Error: It Screwed up agian " + e.toString());
                   blnSuccessfulOpen = false;
              try
                   //Instantiate connection to bean-defined DSN
                   //serverAddress = ("jdbc:oracle:thin:scott/tiger@localhost:1243:" + dbInstance);
                   System.out.println("Connecting ... " );
                   String serverName = "**********";//changed for post
                   String portNumber = "1521";
                   String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + "cisinv";
                   con = DriverManager.getConnection(url, "scott", "tiger");
                   System.out.println("Ready.");
                   blnSuccessfulOpen = true;
              catch (SQLException e)
                   System.err.println("Error: " + e.toString());
              //End try block
              return con;
         }//end connect()
    Please help. ive been working on it for days =(.

    If you're running a Web app, put all JARs that your app needs in the WEB-INF/lib directory. That's always in the CLASSPATH.
    I don't know WebSphere. Do you really have to edit something to add all those CLASSPATH entries?
    In Tomcat, all I'd have to do is put a WAR file in the webapps directory.
    Your code needs some work. You're not following Sun's Java coding standards. Capitalize your class name, for starters.
    Is the username and password for your database still "scott" and "tiger"? Nice security there.
    Your connect method makes a database connection. Do you leave it to users to close it? (You do close your connections when you're done with them, don't you?)
    I'd make Connection a data member and create it in a constructor. I'd write a close method to close it up.
    Doesn't WebSphere do connection pooling? Do you really want to write your own class to handle this?
    MOD

  • ClassNotFoundException while invoking jax-ws client from OIM 10g

    Hi,
    As part of integrating FoxT with OIM, I've generated stub classes from FoxT wsdl using wsimport of jax-ws RI. While trying to invoke any webservice method from the process task I am getting below error -
    java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpFOXTCREATEUSER.FOXTCREATEUSER(adpFOXTCREATEUSER.java:161)
            at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpFOXTCREATEUSER.implementation(adpFOXTCREATEUSER.java:106)
            at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
            at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
            at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
            at com.thortech.xl.ejb.beansimpl.tcProvisioningOperationsBean.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.ejb.beans.tcProvisioningOperationsSession.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.ejb.beans.tcProvisioningOperations_b03yxm_EOImpl.addProcessTaskInstance(tcProvisioningOperations_b03yxm_EOImpl.java:1518)
            at Thor.API.Operations.tcProvisioningOperationsClient.addProcessTaskInstance(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.security.Security.runAs(Security.java:41)
            at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
            at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
            at $Proxy61.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.webclient.actions.ResourceProfileProvisioningTasksAction.addTask(Unknown Source)
            at com.thortech.xl.webclient.actions.ResourceProfileProvisioningTasksAction.dispatchConfirmation(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
            at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
            at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
            at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
            at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at com.thortech.xl.webclient.security.CSRFFilter.doFilter(Unknown Source)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(Unknown Source)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(Unknown Source)
            at weblogic.servlet.internal.WebAppServletContext.execute(Unknown Source)
            at weblogic.servlet.internal.ServletRequestImpl.run(Unknown Source)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.NoClassDefFoundError: Lcom/foxt/mds/ws/generated/AddUserxRolePars;
            at java.lang.Class.getDeclaredFields0(Native Method)
            at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
            at java.lang.Class.getDeclaredFields(Class.java:1743)
            at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:249)
            at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:58)
            at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:362)
            at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:296)
            at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:176)
            at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:243)
            at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:98)
            at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:79)
            at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
            at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:93)
            at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:79)
            at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
            at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:99)
            at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:357)
            at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:327)
            at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:432)
            at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
            at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
            at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
            at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:153)
            at com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:148)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148)
            at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
            at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:264)
            at com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:660)
            at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.buildRuntimeModel(WLSProvider.java:407)
            at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:648)
            at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
            at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:389)
            at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
            at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306)
            at javax.xml.ws.Service.getPort(Service.java:92)
            at com.foxt.mds.ws.generated.MDSImplService.getMDSImplPort(MDSImplService.java:68)
            at com.centurylink.identity.adapter.processtask.FoxTUserOperations.CreateUser(FoxTUserOperations.java:351)
            ... 60 more
    Caused by: java.lang.ClassNotFoundException: com.foxt.mds.ws.generated.AddUserxRolePars
            at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
            at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
            at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
            ... 98 more
    com.thortech.xl.dataobj.util.tcAdapterTaskException: Lcom/foxt/mds/ws/generated/AddUserxRolePars;
            at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpFOXTCREATEUSER.FOXTCREATEUSER(adpFOXTCREATEUSER.java:167)
            at com.thortech.xl.adapterGlue.ScheduleItemEvents.adpFOXTCREATEUSER.implementation(adpFOXTCREATEUSER.java:106)
            at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
            at com.thortech.xl.dataobj.tcScheduleItem.runMilestoneEvent(Unknown Source)
            at com.thortech.xl.dataobj.tcScheduleItem.eventPostInsert(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
            at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
            at com.thortech.xl.ejb.beansimpl.tcProvisioningOperationsBean.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.ejb.beans.tcProvisioningOperationsSession.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.ejb.beans.tcProvisioningOperations_b03yxm_EOImpl.addProcessTaskInstance(tcProvisioningOperations_b03yxm_EOImpl.java:1518)
            at Thor.API.Operations.tcProvisioningOperationsClient.addProcessTaskInstance(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.security.Security.runAs(Security.java:41)
            at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
            at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
            at $Proxy61.addProcessTaskInstance(Unknown Source)
            at com.thortech.xl.webclient.actions.ResourceProfileProvisioningTasksAction.addTask(Unknown Source)
            at com.thortech.xl.webclient.actions.ResourceProfileProvisioningTasksAction.dispatchConfirmation(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
            at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
            at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
            at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
            at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at com.thortech.xl.webclient.security.CSRFFilter.doFilter(Unknown Source)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(Unknown Source)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(Unknown Source)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(Unknown Source)
            at weblogic.servlet.internal.WebAppServletContext.execute(Unknown Source)
            at weblogic.servlet.internal.ServletRequestImpl.run(Unknown Source)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    The class file its complaining about AddUserxRolePars exists in FoxTWS.jar (generated from wsimport) in ThirdParty, ext and JavaTasks directory on the server and still it complains for the same.
    I tried running the same class from the command prompt on the same server and it's working fine. Thinking this could be classpath issue, I tried updating the classpath (System.setProperty("java.class.path","<jar file path>+<existing classpath>")) from with in the adapter class file and it still does not help.
    Any thoughts on how to resolve this ??
    Thanks in Advance.

    You can use below policy for 2-way SSL
    Wssp1.2-Https-ClientCertReq.xml
    Two way SSL. The recipient checks for the initiator's public certificate. Note that the client certificate can be used for authentication.
    http://docs.oracle.com/cd/E14571_01/web.1111/e13713/message.htm#i243732
    Please follow below link to invoke standalone client using SSLSocketFactory for 2-way SSL
    http://docs.oracle.com/cd/E14571_01/web.1111/e13713/transport.htm#CIHICEHH
    HTH
    Regards,
    Sunil

  • Problem using a jar file : java.lang.ClassNotFoundException: ApiConn

    Hi everyone.
    i am running a form that use a bean_area to call a jar.
    but i am getting this error, thanks in advnce for any tip.
    Java Plug-in 1.6.0_33
    Using JRE version 1.6.0_33-b05 Java HotSpot(TM) Client VM
    User home directory = C:\Users\user1
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    java.lang.ClassNotFoundException: ApiConn
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
         at java.awt.EventQueue.access$000(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue$2.run(Unknown Source)
         at java.awt.EventQueue$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Dumping class loader cache...
    Live entry: key=http://192.168.10.100:7778/forms/java/,frmall.jar,siberia_jpg.jar,ApiConn.jar,Hasher.jar,ReadCommand.jar,WriteCommand.jar,libAPI.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://192.168.10.100:7778/forms/java/-threadGroup,maxpri=4]
    Done.
    in my form i have created a bean_area and used as implementation class :ApiConn
    in my formsweb.cfg i used this configuration: archive=frmall.jar,siberia_jpg.jar,ApiConn.jar,Hasher.jar,ReadCommand.jar,WriteCommand.jar,libAPI.jar
    in my forms/java i have placed my jar files listed in the frmall.jar
    i guess i am missing something but i dont know what it is.
    here is my ApiConn.java from wich i generate my jar file:
    package libAPI;
    * This contains connection. Everything should be here,
    * should operate with this class only
    import java.io.*;
    import java.net.*;
    import java.util.concurrent.LinkedBlockingQueue;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    * @author janisk
    public class ApiConn extends Thread {
    private Socket sock = null;
    private DataOutputStream out = null;
    private DataInputStream in = null;
    private String ipAddress;
    private int ipPort;
    private boolean connected = false;
    private String message = "Not connected";
    private ReadCommand readCommand = null;
    private WriteCommand writeCommand = null;
    private Thread listener = null;
    LinkedBlockingQueue queue = new LinkedBlockingQueue(40);
    * Constructor of the connection class
    * @param ipAddress - IP address of the router you want to conenct to
    * @param ipPort - port used for connection, ROS default is 8728
    public ApiConn(String ipAddress, int ipPort) {
    this.ipAddress = ipAddress;
    this.ipPort = ipPort;
    this.setName("settings");
    * State of connection
    * @return - if connection is established to router it returns true.
    public boolean isConnected() {
    return connected;
    public void disconnect() throws IOException{
    listener.interrupt();
    sock.close();
    private void listen() {
    if (this.isConnected()) {
    if (readCommand == null) {
    readCommand = new ReadCommand(in, queue);
    listener = new Thread(readCommand);
    listener.setDaemon(true);
    listener.setName("listener");
    listener.start();
    * to get IP address of the connection. Reads data from socket created.
    * @return InetAddress
    public InetAddress getIpAddress() {
    return sock == null ? null : sock.getInetAddress();
    * returns ip address that socket is asociated with.
    * @return InetAddress
    public InetAddress getLocalIpAddress() {
    return sock == null ? null : sock.getLocalAddress();
    * Socket remote port number
    * @return
    public int getPort() {
    return sock == null ? null : sock.getPort();
    * return local prot used by socket
    * @return
    public int getLocalPort() {
    return sock == null ? null : sock.getLocalPort();
    * Returns status message set up bu class.
    * @return
    public String getMessage() {
    return message;
    * sets and exectues command (sends it to RouterOS host connected)
    * @param s - command will be sent to RouterOS for example "/ip/address/print\n=follow="
    * @return
    public String sendCommand(String s) {
    return writeCommand.setCommand(s).runCommand();
    * exeecutes already set command.
    * @return returns status of the command sent
    public String runCommand() {
    return writeCommand.runCommand();
    * Tries to fech data that is repllied to commands sent. It will wait till it can return something.
    * @return returns data sent by RouterOS
    * @throws java.lang.InterruptedException
    public String getData() throws InterruptedException {
    String s = (String) queue.take();
    return s;
    * returns command that is set at this moment. And will be exectued if runCommand is exectued.
    * @return
    public String getCommand() {
    return writeCommand.getCommand();
    * set up method that will log you in
    * @param name - username of the user on the router
    * @param password - password for the user
    * @return
    public String login(String name, char[] password) {
    this.sendCommand("/login");
    String s = "a";
    try {
    s = this.getData();
    } catch (InterruptedException ex) {
    Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
    return "failed read #1";
    if (!s.contains("!trap") && s.length() > 4) {
    String[] tmp = s.trim().split("\n");
    if (tmp.length > 1) {
    tmp = tmp[1].split("=ret=");
    s = "";
    String transition = tmp[tmp.length - 1];
    String chal = "";
    chal = Hasher.hexStrToStr("00") + new String(password) + Hasher.hexStrToStr(transition);
    chal = Hasher.hashMD5(chal);
    String m = "/login\n=name=" + name + "\n=response=00" + chal;
    s = this.sendCommand(m);
    try {
    s = this.getData();
    } catch (InterruptedException ex) {
    Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
    return "failed read #2";
    if (s.contains("!done")) {
    if (!s.contains("!trap")) {
    return "Login successful";
    return "Login failed";
    @Override
    public void run() {
    try {
    InetAddress ia = InetAddress.getByName(ipAddress);
    if (ia.isReachable(1000)) {
    sock = new Socket(ipAddress, ipPort);
    in = new DataInputStream(sock.getInputStream());
    out = new DataOutputStream(sock.getOutputStream());
    connected = true;
    readCommand = new ReadCommand(in, queue);
    writeCommand = new WriteCommand(out);
    this.listen();
    message = "Connected";
    } else {
    message = "Not reachable";
    } catch (UnknownHostException ex) {
    connected = false;
    message = ex.getMessage();
    ex.printStackTrace();
    } catch (IOException ex) {
    connected = false;
    message = ex.getMessage();
    ex.printStackTrace();
    }

    I need your help again, i think this is a minor thing.
    i have compiled the class file that i needed and i signed it too. but now it is giving me a new error and need your tip.
    here is the java console loyout and my java file ((i think here is the problem in java file, something must be missing)).
    thanks in advance for any help.
    Java Plug-in 10.17.2.02
    Using JRE version 1.7.0_17-b02 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Administrator
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    network: Connecting http://192.168.10.100:7778/forms/lservlet;jsessionid=c0a80a6430d6e191eded93774f2f8d1bed73056e66ef.e3mObhiMbxeKe34PahiKbx4Nbh90n6jAmljGr5XDqQLvpAe with proxy=DIRECT
    security: Validate the certificate chain using CertPath API
    security: The certificate hasnt been expired, no need to check timestamping info
    security: Cannot find jurisdiction list file
    security: The CRL support is disabled
    security: The OCSP support is disabled
    security: This OCSP End Entity validation is disabled
    security: Checking if certificate is in Deployment denied certificate store
    security: Checking if certificate is in Deployment permanent certificate store
    basic: updateValidationResultsForApplet update
    cache: Mark prevalidated: http://192.168.10.100:7778/forms/java/ApiConn.jar true tm=1363335797289 cert=1371107987000
    basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
    java.lang.InstantiationException: oracle.forms.siberia.ApiConn
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
         at java.awt.EventQueue.access$200(Unknown Source)
         at java.awt.EventQueue$3.run(Unknown Source)
         at java.awt.EventQueue$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
         at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue$4.run(Unknown Source)
         at java.awt.EventQueue$4.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    network: Connecting http://192.168.10.100:7778/forms/lservlet;jsessionid=c0a80a6430d6e191eded93774f2f8d1bed73056e66ef.e3mObhiMbxeKe34PahiKbx4Nbh90n6jAmljGr5XDqQLvpAe with proxy=DIRECT
    Exception in thread "Forms-DialogThread2" java.lang.NullPointerException
         at oracle.forms.handler.JavaContainer.onDestroy(Unknown Source)
         at oracle.forms.engine.Runform.destroyHandlers(Unknown Source)
         at oracle.forms.handler.DialogThread.doAlert(Unknown Source)
         at oracle.forms.handler.DialogThread.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Dumping class loader cache...
    Live entry: key=http://192.168.10.100:7778/forms/java/,frmall.jar,siberia_jpg.jar,ApiConn.jar,ConcealTextField.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://192.168.10.100:7778/forms/java/-threadGroup,maxpri=4]
    Done.
    here is my java file
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package oracle.forms.siberia;
    * This contains connection. Everything should be here,
    * should operate with this class only
    import java.io.*;
    import java.net.*;
    import java.util.concurrent.LinkedBlockingQueue;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import oracle.forms.*;
    * @author janisk
    public class ApiConn extends Thread {
    private Socket sock = null;
    private DataOutputStream out = null;
    private DataInputStream in = null;
    private String ipAddress;
    private int ipPort;
    private boolean connected = false;
    private String message = "Not connected";
    private ReadCommand readCommand = null;
    private WriteCommand writeCommand = null;
    private Thread listener = null;
    LinkedBlockingQueue queue = new LinkedBlockingQueue(40);
    * Constructor of the connection class
    * @param ipAddress - IP address of the router you want to conenct to
    * @param ipPort - port used for connection, ROS default is 8728
    public ApiConn(String ipAddress, int ipPort) {
    this.ipAddress = ipAddress;
    this.ipPort = ipPort;
    this.setName("settings");
    * State of connection
    * @return - if connection is established to router it returns true.
    public boolean isConnected() {
    return connected;
    public void disconnect() throws IOException{
    listener.interrupt();
    sock.close();
    private void listen() {
    if (this.isConnected()) {
    if (readCommand == null) {
    readCommand = new ReadCommand(in, queue);
    listener = new Thread(readCommand);
    listener.setDaemon(true);
    listener.setName("listener");
    listener.start();
    * to get IP address of the connection. Reads data from socket created.
    * @return InetAddress
    public InetAddress getIpAddress() {
    return sock == null ? null : sock.getInetAddress();
    * returns ip address that socket is asociated with.
    * @return InetAddress
    public InetAddress getLocalIpAddress() {
    return sock == null ? null : sock.getLocalAddress();
    * Socket remote port number
    * @return
    public int getPort() {
    return sock == null ? null : sock.getPort();
    * return local prot used by socket
    * @return
    public int getLocalPort() {
    return sock == null ? null : sock.getLocalPort();
    * Returns status message set up bu class.
    * @return
    public String getMessage() {
    return message;
    * sets and exectues command (sends it to RouterOS host connected)
    * @param s - command will be sent to RouterOS for example "/ip/address/print\n=follow="
    * @return
    public String sendCommand(String s) {
    return writeCommand.setCommand(s).runCommand();
    * exeecutes already set command.
    * @return returns status of the command sent
    public String runCommand() {
    return writeCommand.runCommand();
    * Tries to fech data that is repllied to commands sent. It will wait till it can return something.
    * @return returns data sent by RouterOS
    * @throws java.lang.InterruptedException
    public String getData() throws InterruptedException {
    String s = (String) queue.take();
    return s;
    * returns command that is set at this moment. And will be exectued if runCommand is exectued.
    * @return
    public String getCommand() {
    return writeCommand.getCommand();
    * set up method that will log you in
    * @param name - username of the user on the router
    * @param password - password for the user
    * @return
    public String login(String name, char[] password) {
    this.sendCommand("/login");
    String s = "a";
    try {
    s = this.getData();
    } catch (InterruptedException ex) {
    Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
    return "failed read #1";
    if (!s.contains("!trap") && s.length() > 4) {
    String[] tmp = s.trim().split("\n");
    if (tmp.length > 1) {
    tmp = tmp[1].split("=ret=");
    s = "";
    String transition = tmp[tmp.length - 1];
    String chal = "";
    chal = Hasher.hexStrToStr("00") + new String(password) + Hasher.hexStrToStr(transition);
    chal = Hasher.hashMD5(chal);
    String m = "/login\n=name=" + name + "\n=response=00" + chal;
    s = this.sendCommand(m);
    try {
    s = this.getData();
    } catch (InterruptedException ex) {
    Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
    return "failed read #2";
    if (s.contains("!done")) {
    if (!s.contains("!trap")) {
    return "Login successful";
    return "Login failed";
    @Override
    public void run() {
    try {
    InetAddress ia = InetAddress.getByName(ipAddress);
    if (ia.isReachable(1000)) {
    sock = new Socket(ipAddress, ipPort);
    in = new DataInputStream(sock.getInputStream());
    out = new DataOutputStream(sock.getOutputStream());
    connected = true;
    readCommand = new ReadCommand(in, queue);
    writeCommand = new WriteCommand(out);
    this.listen();
    message = "Connected";
    } else {
    message = "Not reachable";
    } catch (UnknownHostException ex) {
    connected = false;
    message = ex.getMessage();
    ex.printStackTrace();
    } catch (IOException ex) {
    connected = false;
    message = ex.getMessage();
    ex.printStackTrace();
    }

  • Java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException

    Hi there Masters
    I am new in Java and I would need your help please..
    I am calling a function in Java passing 1 parameter and returning an XML back but at the point of execution I get an error below... At the end I have attached my java code...PLEASE HELP
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    =====================JAVA CODE====================================
    package hospitaltool;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    public class RunAsnIn {
    public void runAsnIn(Connection con, Boolean fam) throws SQLException {
    System.out.println("RunASNIn Section");
    String messStatus;
    int numRecs = 0; //to hold the number of Records processed
    int totRecs = 0; //to hold the number of total records processed
    ResultSet rs = null;
    Statement stmt = null;
    stmt = con.createStatement();
    //Delete all already caused messages
    try {
    rs = stmt.executeQuery("DELETE FROM asnin WHERE message_num IN(SELECT message_num FROM asnin MINUS SELECT message_num FROM hospital WHERE family = 'ASNIn')");
    //Select all the uncaused messages
    rs = stmt.executeQuery("SELECT message_num FROM hospital WHERE family = 'ASNIn' and rownum <= 1 MINUS SELECT message_num FROM asnin");
    //Go thru the uncaused messages
    } catch (Exception e) {
    while (rs.next()) {
    String messageNum = rs.getString(1);
    // System.out.println("tableName=" + messageNum);
    System.out.println(messageNum);
    //Get the XMLDoc
    XMLType xml = null;
    //Get the XML Doc
    CallableStatement cs1 = null;
    //CallableStatement proc = con.prepareCall("? {call rmsauto.hospitaltool.getmessagedoc(?)}");
    try {
    cs1 = con.prepareCall("{? = call rmsauto.hospitaltool.getmessagedoc(?)}");
    cs1.registerOutParameter(1, OracleTypes.OPAQUE, "SYS.XMLTYPE");
    cs1.setString(2, messageNum);
    cs1.execute();
    } catch (Exception e) {
    xml = (XMLType) cs1.getObject(1);
    System.out.println(xml.getStringVal());
    }

    I did google this and found that I needed a specific jar file called xmlparserv2.jar and I did download it and loaded it on as part of my Libraries the I got a new error... I am using NetBeans
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/binxml/BinXMLMetadataProvider
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.binxml.BinXMLMetadataProvider
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    Java Result: 1

  • Java.lang.ClassNotFoundException when deploy application on Weblogic 10.3

    Hi all, when I deploy an application on Weblogic 10.3 the following error occurs
    the following detail is shown on the summary screen when I deploy the application via control
    An error occurred during activation of changes, please see the log for details.
    weblogic.application.ModuleException:
    com.excellence.exoa.sso.SsoSessionListener
    The deployment has been successfully installed
    the following detail is shown on the log
    Could not load user defined listener: com.excellence.exoa.sso.SsoSessionListener
    java.lang.ClassNotFoundException: com.excellence.exoa.sso.SsoSessionListener
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)
    at weblogic.servlet.internal.EventsManager.registerEventListeners(EventsManager.java:117)
    at weblogic.servlet.internal.EventsManager.registerPreparePhaseListeners(EventsManager.java:65)
    at weblogic.servlet.internal.WebAppServletContext.initContextListeners(WebAppServletContext.java:1765)
    at weblogic.servlet.internal.WebAppServletContext.prepare(WebAppServletContext.java:1126)
    at weblogic.servlet.internal.HttpServer.doPostContextInit(HttpServer.java:449)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:424)
    at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:910)
    at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:364)
    at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
    at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    the following listener is configured in the web.xml
    &lt;listener&gt;
    &lt;listener-class&gt;com.excellence.exoa.sso.SsoSessionListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    and the SsoSessionListener class is packaged in the mainframe.jar. there are two mainframe.jar in this ear, the first which include SsoSessionListener in the souce directory and the other mainfrain.jar which extend the SsoSessionListener is in the ./extend/mainframe.jar
    How can I fix this error ? any suggestion?
    Thanks
    Jayson
    Edited by: Jayson on Feb 12, 2009 3:37 AM
    Edited by: Jayson on Feb 12, 2009 3:54 AM

    I have in log:
    2009.26.3 20:12:52 oracle.adfinternal.controller.faces.lifecycle.JSFLifecycleImp
    l setLifecycleContextBuilder
    WARNING: ADFc: Replacing the ADF Page Lifecycle implementation with 'oracle.adfi
    nternal.controller.application.model.JSFDataBindingLifecycleContextBuilder'.
    2009.26.3 20:12:52 oracle.adfinternal.controller.util.model.AdfmInterface initia
    lize
    INFO: ADFc: BindingContext is present, using ADFm APIs for DataControlFrames.
    2009.26.3 20:12:52 oracle.adfinternal.controller.metadata.provider.MdsMetadataRe
    sourceProvider <init>
    INFO: ADFc: Controller caching of MDS metadata resources ENABLED.
    2009.26.3 20:12:52 oracle.adf.controller.internal.metadata.MetadataService$Boots
    trap add
    INFO: ADFc: Loading bootstrap metadata from '/WEB-INF/adfc-config.xml'.
    2009.26.3 20:12:54 oracle.adf.share.security.providers.jps.CSFCredentialStore fe
    tchCredential
    WARNING: Unable to locate the credential for key AUGI in D:\bea\user_projects\do
    mains\base_domain\config\oracle.
    2009.26.3 20:12:54 oracle.adf.share.jndi.ReferenceStoreHelper throwPartialResult
    Exception
    WARNING: Incomplete connection information
    Edited by: Debuger on Mar 26, 2009 11:18 AM

  • Every time I try to run a java program: Java.lang.ClassNotFoundException?

    I downloaded the JDK version 6 successfully for my laptop which runs windows 7 (64bit). I'm trying to run programs that I have successfully run at school on my computer put it doesn't work. I pull up the command prompt and enter javac "program name".java and it compiles fine. Then, when I type java "program name" it gives me the Java.lang.ClassNotFoundException. Can anyone please help me??

    Try:
    java -cp . ClassNameNote the dot.

Maybe you are looking for

  • Error when trying to steam live

    We are currently running Windows media streaming servers and would like to start streaming live flash from these servers. I have downloaded and installed the Flash Media Development Server 3, Flash Media Live Encoder 2.5, and Flash CS3 Professional.

  • Service Product (Download from R3 or Create in CRM)

    Hi, we are implementing service with R3 billing and were trying to determined if to download the service products from R3 or to create them in CRM and then upload them. Currently we have service products in R3 however it's not clear if it's a good id

  • Help BB not working after update (software proprietary and confidential to research in motion limited)

    I have recently updated my curve 9300 and before it was working verywell. So oke now that i have updated the phone i tried to boot up, it boots up like these pictures  security test pass 100% and then i get this message and then i cant do anything, n

  • What's the usage of the associated columns?

    In business model, logical columns are associated to a level of dimension. But the columns are nether primary key nor used for display. What's the purpose of these associated columns?

  • How to auto sync new ipod apps to ipad?

    Hi, I have automatic sync turned on for my ipad, and it syncs some of my newly downloaded apps. However, it doesn't auto sync others, which I have to manually click install for. I have a feeling these are ipod apps which it therefore doesn't associat