Title: Message
you should NOT be returning results sets back from ANY remote methods.
it is very very very very bad design, with a capital VERY and a capital BAD
you should have serializable wrapper objects.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Andres Garcia Hourcade
Sent: Monday, November 26, 2001 1:42 PM
To: Orion-Interest
Subject: OrionRemoteException: Error (de-)serializing object

Hi, i am new in J2EE technology and i'm big troubles.

I have an intranet application (jsp & ejb) running fine with version 1.4.0,

i am trying to deploy the same EAR in 1.5.2 version, but i get this error.

com.evermind.server.rmi.OrionRemoteException: Error (de-)serializing object:

org.gjt.mm.mysql.jdbc2.ResultSet; nested exception is:

java.io.NotSerializableException: org.gjt.mm.mysql.jdbc2.ResultSet

This error occurs when i return a ResultSet from a method "executeQuery" of

an EJB that manages de mysql db.

I have written many jsp, that are in production, and i woud not want to

modify them.

Is there any solution for this error ?

Can i solve this problem if i return a Vector, instead of a ResultSet ?

Many thanks in advance and best regards

Andres Garcia Hourcade

====================================

EJB

====================================

import java.rmi.*;

import java.util.*;

import javax.ejb.*;

import javax.naming.*;

import java.sql.*;

import javax.sql.*;

import javax.sql.DataSource;

// ejb que maneja archivos de log

import Log.*;

public class DbManagerBean implements SessionBean

{

transient SessionContext context;

transient Connection conn = null;

transient DataSource ds = null;

transient Statement st = null;

transient ResultSet rs = null;

public void getConnection(String datasource) throws RemoteException,

DbManagerException

{

try

{

InitialContext ictx = new InitialContext();

this.ds = (DataSource) ictx.lookup(datasource);

this.conn = this.ds.getConnection();

}

catch (Exception e)

{

throw new DbManagerException(e);

}

}

 

public void closeConnection() throws RemoteException, DbManagerException

{

try

{

this.conn.close();

}

catch (Exception e)

{

throw new DbManagerException(e);

}

}

public ResultSet executeQuery(String strsql, String logonuser) throws

RemoteException, DbManagerException

{

st = null;

rs = null;

try

{

//ResultSet.TYPE_SCROLL_INSENSITIVE,

//ResultSet.CONCUR_READ_ONLY

this.st = this.conn.createStatement();

try{

// logeo la consulta

InitialContext context = new InitialContext();

LogHome logHome = (LogHome)

javax.rmi.PortableRemoteObject.narrow(context.lookup("Log"), LogHome.class);

Log log = logHome.create();

log.writeDebug(strsql, logonuser);

log.remove();

}

catch (Exception e)

{

throw new DbManagerException(e);

}

rs = this.st.executeQuery(strsql);

// the closing of a statement also closes all

// the resultsets asociated with the statement

st.close();

}

catch (SQLException e)

{

throw new DbManagerException(e, this.conn);

}

return (rs);

}

public void ejbPassivate(){

context = null;

conn = null;

ds = null;

st = null;

rs = null;

}

public void ejbActivate()

{

}

public void ejbRemove()

{

}

public void ejbCreate()

{

}

public void setSessionContext(SessionContext context)

{

this.context = context;

}

}

Reply via email to