Hi

I would suggest that you make the dbconnection variable transient. Would it
be better to close the database connection prior to deserializing and then
have the bean establish the connection again later.

    private transient Connection dbConnection = null;
    private transient ResultSet rs = null;


Regards,

Michael Mok

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Li You
Sent: Thursday, 1 February 2001 11:50
To: Orion-Interest
Cc: [EMAIL PROTECTED]
Subject: Re:Re: Error deserializing EJB-session, anyone tell me why?





---------- Original Message ----------------------------------
From: "Li You" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
Date: Wed, 31 Jan 2001 20:20:38 -0700

Hi All,

Dear Alexey Ryndin,
    Thanks for you help, I do it  that you say, the errors was gone.
but some new errors showing out. I don't know where i miss ?
                                                                    where
Orion miss ?
                                                                    where
Postgresql  miss?
                                                             and why!?
please help me.
thank you again,
 yours Urey

***********  my errors *********
00-2-1 10:27 Error serializing EJB-bean
java.io.NotSerializableException: org.postgresql.jdbc2.Connection
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
 at com.evermind.server.ejb.EJBContainer.ai4(JAX)
 at com.evermind.server.ejb.EJBPackageDeployment.ait(JAX)
 at com.evermind.server.ejb.EJBContainer.ait(JAX)
 at com.evermind.server.ejb.EJBContainer.b9(JAX)
 at com.evermind.server.Application.b9(JAX)
 at com.evermind.server.ApplicationServer.b9(JAX)
 at com.evermind.server.he.run(JAX)
 at java.lang.Thread.run(Thread.java:484)



***********  my code use connection only this one *********

public class DBAction implements java.io.Serializable{

    private String stmtstring = null;
    private String msg = "";
    private ResultSet rs = null;
    private int columncount;
    private int status = 0;
    private Vector v = new Vector();

    private Connection dbConnection = null;


    private DataSource datasource   = null;

    public DBAction() throws ApplicationDAOException {
      try {
            InitialContext ic = new InitialContext();
            datasource = (DataSource)
ic.lookup(JNDINames.GALACY_DATASOURCE);
        } catch (NamingException ne) {
            throw new ApplicationDAOException("Naming Exception while
looking " +
                                               " up DataSource Connection "
+
                                                JNDINames.GALACY_DATASOURCE
+
                                                    ": \n" +
ne.getMessage());
        }
    }

/**
* Method for get connection with database
*/


   private void getDBConnection() throws ApplicationDAOException {

        try {
            dbConnection = datasource.getConnection();
        } catch (SQLException se) {
            throw new ApplicationDAOException("SQL Exception while getting "
+
                                "DB connection : \n" + se);
        }
        return;

    }


/**
* Close database conection.
*/
    private void closeConnection() throws ApplicationDAOException {
        try {
            if (dbConnection != null && !dbConnection.isClosed()) {
                dbConnection.close();
            }
        } catch (SQLException se) {
            throw new ApplicationDAOException("SQL Exception while closing "
+
                                        "DB connection : \n" + se);
        }
    }


}

***********  postgres code of connection 1*********
/**
 * $Id: Connection.java,v 1.2 1999/05/18 23:17:26 peter Exp $
 *
 * A Connection represents a session with a specific database.  Within the
 * context of a Connection, SQL statements are executed and results are
 * returned.
 *
 * <P>A Connection's database is able to provide information describing
 * its tables, its supported SQL grammar, its stored procedures, the
 * capabilities of this connection, etc.  This information is obtained
 * with the getMetaData method.
 *
 * <p><B>Note:</B> By default, the Connection automatically commits changes
 * after executing each statement.  If auto-commit has been disabled, an
 * explicit commit must be done or database changes will not be saved.
 *
 * @see java.sql.Connection
 */
 package postgresql.jdbc2;
public class Connection extends postgresql.Connection implements
java.sql.Connection
{
  // This is a cache of the DatabaseMetaData instance for this connection
  protected DatabaseMetaData metadata;

  /**
   * SQL statements without parameters are normally executed using
   * Statement objects.  If the same SQL statement is executed many
   * times, it is more efficient to use a PreparedStatement
   *
   * @return a new Statement object
   * @exception SQLException passed through from the constructor
   */
  public java.sql.Statement createStatement() throws SQLException
  {
    return new Statement(this);
  }
.....
.....
}
***********  postgres code of connection 2*********
/**
 * $Id: Connection.java,v 1.17 1999/05/18 23:17:15 peter Exp $
 *
 * This abstract class is used by postgresql.Driver to open either the JDBC1
or
 * JDBC2 versions of the Connection class.
 *
 */
package postgresql;
public abstract class Connection
{
  // This is the network stream associated with this connection
  public PG_Stream pg_stream;

  // This is set by postgresql.Statement.setMaxRows()
  public int maxrows = 0;  // maximum no. of rows; 0 = unlimited

  private String PG_HOST;
  private int PG_PORT;
  private String PG_USER;
  private String PG_PASSWORD;
  private String PG_DATABASE;
  private boolean PG_STATUS;
.....
.....
.....
}

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Wednesday, January 31, 2001 6:03 PM
Subject: Re: Error deserializing EJB-session, anyone tell me why?


>
> As far as I can judge it means that you need to implements
> java.io,Serializable interface in your
> com.mas.ebiz.asp.application.ejb.dao.ApplicationControlDAO class.
> Alexey Ryndin
>
>




Reply via email to