RE: OrionRemoteException: Error (de-)serializing object:
Yeah you have to return an arraylist or a vector, i.e something that is serializable. It is never a good idea to pass ResultSet objects around. Although it is attractive in terms of changeability (eg adding more fields etc) to use a ResultSet, it can become a nightmare when there are network problems and you can leak connections if you don't handle the exceptions properly. If you are using ejb's then the whole idea is that the EJB is an object version of the data so that you can work directly with the object. If you want to use a ResultSet directly in the jsp (useful for reporting etc), just open the connection to the database directly in the JSP and do your query and close it again. If you are doing something more invovled you might want to user a few beans/taglibs (there are some nice jdbc ones around) just to stop your jsp pages from becomming a spiderweb. Your DBManagerBean looks dangerous - there is a pretty good chance you are going to leak connections. Rather use just a normal bean that you can instatiate locally at the jsp side or the ejb side. Thus there is no need to use an ejb to control connections. Regards, Manuel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Andres Garcia Hourcade Sent: Wednesday, November 21, 2001 3:32 AM 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; } }
Re: OrionRemoteException: Error (de-)serializing object
Use a disconnected RowSet; that's what they were designed for. You won't have to modify your application because RowSet extends ResultSet!! - Original Message - From: Andres Garcia Hourcade To: Orion-Interest Sent: Monday, November 26, 2001 10:41 AM 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; } }
RE: OrionRemoteException: Error (de-)serializing object
Please please PLEASE do not send messages with Read Receipt Requests to the mailing list. Thats just annoying. -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; } }
Re: OrionRemoteException: Error (de-)serializing object
Exception says it all... This is a logn-time discussed problem/issue. Your Ejb methods should return the valid J2EE types: simple types, Serializable, EJBObject, Remote and Externalizable (I think). The ResultSet is none of the above. You should do something else. A Vector would be my solution. Just wrap the data, that is returned in the ResultSet with a Serializable bean and populate the vector with them. Of course it is not as easy as it sounds, if you want to change the data. But if it is the data itself... It will help. That's it. Lachezar - Original Message - From: Andres Garcia Hourcade To: Orion-Interest Sent: Monday, November 26, 2001 8:41 PM 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; } }
RE: OrionRemoteException: Error (de-)serializing object
Many thanks, i will modifiy my sources to return Vectors Thks again -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lachezar DobrevSent: lunes, 26 de noviembre de 2001 8:33To: Orion-InterestSubject: Re: OrionRemoteException: Error (de-)serializing object Exception says it all... This is a logn-time discussed problem/issue. Your Ejb methods should return the valid J2EE types: simple types, Serializable, EJBObject, Remote and Externalizable (I think). The ResultSet is none of the above. You should do something else. A Vector would be my solution. Just wrap the data, that is returned in the ResultSet with a Serializable bean and populate the vector with them. Of course it is not as easy as it sounds, if you want to change the data. But if it is the data itself... It will help. That's it. Lachezar - Original Message - From: Andres Garcia Hourcade To: Orion-Interest Sent: Monday, November 26, 2001 8:41 PM 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; } }
RE: OrionRemoteException: Error (de-)serializing object
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 VERYand a capital BAD you should have serializable wrapper objects. -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Andres Garcia HourcadeSent: Monday, November 26, 2001 1:42 PMTo: Orion-InterestSubject: 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; } }
Re: OrionRemoteException: Error (de-)serializing object:
Make sure you are closing your all of your ResultSets after you've finished with them (same for Statement and Connection objects). Chris Andres Garcia Hourcade wrote: I have an application (jsp ejb) running with version 1.4.0, i am trying to upgrade the same EAR in 1.5.2 version, but i get this error. What i am doing wrong ? 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 Many thanks
RE: OrionRemoteException: Error (de-)serializing object:
Orion 1.5.2 is much stricter about what you can put into app / session scopes. Any objects you want to store MUST be serializable (they didn't have to be in 1.4.0, the 1.5.2 behaviour is more spec compliant). I think the ResultSet you're using isn't serializable. Try pulling the data out first into your own data structure, and then storing that. -mike Mike Cannon-Brookes :: [EMAIL PROTECTED] Atlassian :: http://www.atlassian.com Supporting YOUR J2EE World -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Andres Garcia Hourcade Sent: Friday, September 28, 2001 11:56 AM To: Orion-Interest Subject: OrionRemoteException: Error (de-)serializing object: I have an application (jsp ejb) running with version 1.4.0, i am trying to upgrade the same EAR in 1.5.2 version, but i get this error. What i am doing wrong ? 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 Many thanks