RE: log4j + j2ee error
Thank you all for helping me solve log4j (and lot other) serializable issue. - Sandeep -- From: Ebersole, Steven Sent: Thursday, February 06, 2003 12:53 PM To: 'Log4J Users List'; '[EMAIL PROTECTED]' Subject:RE: log4j + j2ee error So do one of the following: 1) public class EmployeeVO implements java.io.Serializable { private static Category log = Category.getInstance( getClass() ); ... public getName() { try { ... } catch(Exception e) { log.error(...); } } } 2) public class EmployeeVO implements java.io.Serializable { private transient Category log; ... public EmployeeVO() { log = Category.getInstance( getClass() ); } public getName() { try { ... } catch(Exception e) { log.error(...); } } } Of course, option #2 is only really of value if retreival of a Category for variable log is based on some type of per-instance data. |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Thursday, February 06, 2003 12:03 PM |To: '[EMAIL PROTECTED]'; |'[EMAIL PROTECTED]' |Subject: RE: log4j + j2ee error | | |My EmployeeVO valueobject class looks like: | |public class EmployeeVO implements java.io.Serializable |{ |private transient Category log = Category.getInstance( |getClass() ); |... | | public getName() { | try { | ... | } catch(Exception e) { | log.error(...); | } |} | |- Sandeep | |-- |From: Martin Gainty |Sent: Thursday, February 06, 2003 12:34 PM |To:[EMAIL PROTECTED] |Cc:[EMAIL PROTECTED] |Subject: RE: log4j + j2ee error | |File: ATT00032.html | |--- |Incoming mail is certified Virus Free. |Checked by AVG anti-virus system (http://www.grisoft.com). |Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 | | | |--- |Outgoing mail is certified Virus Free. |Checked by AVG anti-virus system (http://www.grisoft.com). |Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 | | | |--- |-- |To unsubscribe, e-mail: [EMAIL PROTECTED] |For additional commands, e-mail: [EMAIL PROTECTED] | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j + j2ee error
Although the error message has disappeared, problem with log4j still persists. In EmployeeVO, I am calling log.debug(..) in the exception and it is throwing null pointer exception, i.e., log variable is null! I have defined private transient Category log = Category.getInstance(getClass()); in the EmployeeVO. Thanks, Sandeep -- From: Ebersole, Steven Sent: Wednesday, February 05, 2003 4:48 PM To: 'Log4J Users List' Subject:RE: log4j + j2ee error Logger is the name of the newer class which replaced Category. The issue is the same for both of them, however. At some point in your application, the server needs to return data back to the client (typically in J2EE apps this is accomplished with ValueObjects or DataTransferObjects depending on your preferred patterns catalog). That server return will be serialized for transport back to the client (actually for transport back to the client stub, which then deserializes it for the calling client). So in your set up, I am guessing that ValueObjectFactory is returning a collection of a class named like EmployeeVO. If this collection is then sent back to the client and the EmployeeVO instances making up the elements of that collection define a Logger (or Category) instance, the serialization will fail because Logger/Category is not serializable. You would need to mark the Logger/Category variable on the EmployeeVO class as transient. So if you have: public class EmployeeVO { private Category log = Category.getInstance( getClass() ); ... } change to: public class EmployeeVO { private transient Category log = Category.getInstance( getClass() ); ... } |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, February 05, 2003 3:12 PM |To: 'Log4J Users List' |Subject: RE: log4j + j2ee error | | |Well. I am not sure about Looger variable. I am using | |private Category log = Category.getInstance(getClass()); | |statement in the OrganizationManager session bean. Log4j |initialization is done successfully in the view controller |servlet. This error occurs when the |findColOfEmployeeVOByLoginInfo method of the |OrganizationManager session bean is called. | | method *** | public Collection findColOfEmployeeVOByLoginInfo(String |username, String password) throws SessionException, |RemoteException { | try { | EmployeeHome home = (EmployeeHome) | |ServiceLocatorBean.getInstance().getLocalHome( | ejb/Employee, |EmployeeHome.class); | | return |ValueObjectFactory.getInstance().getCollectionOfVO( | |home.findByLoginInfo(username, password)); | } catch (Exception re) { | throw new |SessionException(this.getClass().getName()+.findByLoginInf |o():+re.getMessage()); | } | } |*** |The method getCollectionOfVO gets the EJB interface |objects and then copies values into JavaBean objects and |returns a collection of JavaBean objects. Both EJB and |JavaBean have | |- private Category log = Category.getInstance(getClass()); | |defined in them. But the variable log is not copied. | |Thanks, |Sandeep | | | |-- |From: Ebersole, Steven |Sent: Wednesday, February 05, 2003 3:28 PM |To:'Log4J Users List' |Subject: RE: log4j + j2ee error | |It looks like maybe you are trying to define a Logger as a |variable on |something which is getting serialized. Logger does not |implement the |Serializable interface. You must mark that Logger |variable as transient, or |explicitly read and write it yourself during serialization. | | | ||-Original Message- ||From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] ||Sent: Wednesday, February 05, 2003 2:40 PM ||To: '[EMAIL PROTECTED]' ||Subject: log4j + j2ee error || || ||I am getting following error message while attempting to ||use log4j with J2ee 1.3.1. Any help would be appreciated. || ||Thanks, ||Sandeep || || ||J2EE server startup complete. ||Before call to PropertyConfigurator ||After call to PropertyConfigurator ||Exception in thread HttpProcessor[8000][3] ||org.omg.CORBA.BAD_PARAM: org.apache ||.log4j.Category vmcid: OMG minor code: 6 completed: Maybe ||at ||com.sun.corba.se.internal.util.Utility.throwNotSerializable ||ForCorba(U ||tility.java:1018
RE: log4j + j2ee error
My EmployeeVO valueobject class looks like: public class EmployeeVO implements java.io.Serializable { private transient Category log = Category.getInstance( getClass() ); ... public getName() { try { ... } catch(Exception e) { log.error(...); } } - Sandeep -- From: Martin Gainty Sent: Thursday, February 06, 2003 12:34 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject:RE: log4j + j2ee error File: ATT00032.html --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j + j2ee error
Of course; because it is defined as transient it does not get serialized during object serialization and thus cannot be deserialized during object deserialization. There are two ways of handling this: 1) Does this really need to be an instance variable? In other words can this not be a static variable? Based on the fact that you are obtaining the Category using the class name, my guess is that log does not need to be an instance variable. If this is the case, then simply define the variable as static. 2) If it does need to be an instance variable, then you will need to either: a) move the Category.getInstance() call inside the constructor (because the constructor is called during deserialization); or b) wrap access to the Category instance inside a method call |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Thursday, February 06, 2003 11:22 AM |To: 'Log4J Users List' |Subject: RE: log4j + j2ee error | | |Although the error message has disappeared, problem with |log4j still persists. In EmployeeVO, I am calling |log.debug(..) in the exception and it is throwing null |pointer exception, i.e., log variable is null! I have defined | |private transient Category log = Category.getInstance(getClass()); | |in the EmployeeVO. | |Thanks, |Sandeep | | |-- |From: Ebersole, Steven |Sent: Wednesday, February 05, 2003 4:48 PM |To:'Log4J Users List' |Subject: RE: log4j + j2ee error | |Logger is the name of the newer class which replaced |Category. The issue is |the same for both of them, however. | |At some point in your application, the server needs to |return data back to |the client (typically in J2EE apps this is accomplished |with ValueObjects or |DataTransferObjects depending on your preferred patterns |catalog). That |server return will be serialized for transport back to the |client (actually |for transport back to the client stub, which then |deserializes it for the |calling client). | |So in your set up, I am guessing that ValueObjectFactory |is returning a |collection of a class named like EmployeeVO. If this |collection is then |sent back to the client and the EmployeeVO instances |making up the elements |of that collection define a Logger (or Category) instance, |the serialization |will fail because Logger/Category is not serializable. |You would need to |mark the Logger/Category variable on the EmployeeVO class |as transient. | | |So if you have: |public class EmployeeVO |{ |private Category log = Category.getInstance( getClass() ); |... |} | |change to: |public class EmployeeVO |{ |private transient Category log = Category.getInstance( |getClass() ); |... |} | | | | | ||-Original Message- ||From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] ||Sent: Wednesday, February 05, 2003 3:12 PM ||To: 'Log4J Users List' ||Subject: RE: log4j + j2ee error || || ||Well. I am not sure about Looger variable. I am using || ||private Category log = Category.getInstance(getClass()); || ||statement in the OrganizationManager session bean. Log4j ||initialization is done successfully in the view controller ||servlet. This error occurs when the ||findColOfEmployeeVOByLoginInfo method of the ||OrganizationManager session bean is called. || || method *** || public Collection findColOfEmployeeVOByLoginInfo(String ||username, String password) throws SessionException, ||RemoteException { || try { || EmployeeHome home = (EmployeeHome) || ||ServiceLocatorBean.getInstance().getLocalHome( || ejb/Employee, ||EmployeeHome.class); || || return ||ValueObjectFactory.getInstance().getCollectionOfVO( || ||home.findByLoginInfo(username, password)); || } catch (Exception re) { || throw new ||SessionException(this.getClass().getName()+.findByLoginInf ||o():+re.getMessage()); || } || } ||*** ||The method getCollectionOfVO gets the EJB interface ||objects and then copies values into JavaBean objects and ||returns a collection of JavaBean objects. Both EJB and ||JavaBean have || ||- private Category log = Category.getInstance(getClass
RE: log4j + j2ee error
So do one of the following: 1) public class EmployeeVO implements java.io.Serializable { private static Category log = Category.getInstance( getClass() ); ... public getName() { try { ... } catch(Exception e) { log.error(...); } } } 2) public class EmployeeVO implements java.io.Serializable { private transient Category log; ... public EmployeeVO() { log = Category.getInstance( getClass() ); } public getName() { try { ... } catch(Exception e) { log.error(...); } } } Of course, option #2 is only really of value if retreival of a Category for variable log is based on some type of per-instance data. |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Thursday, February 06, 2003 12:03 PM |To: '[EMAIL PROTECTED]'; |'[EMAIL PROTECTED]' |Subject: RE: log4j + j2ee error | | |My EmployeeVO valueobject class looks like: | |public class EmployeeVO implements java.io.Serializable |{ |private transient Category log = Category.getInstance( |getClass() ); |... | | public getName() { | try { | ... | } catch(Exception e) { | log.error(...); | } |} | |- Sandeep | |-- |From: Martin Gainty |Sent: Thursday, February 06, 2003 12:34 PM |To:[EMAIL PROTECTED] |Cc:[EMAIL PROTECTED] |Subject: RE: log4j + j2ee error | |File: ATT00032.html | |--- |Incoming mail is certified Virus Free. |Checked by AVG anti-virus system (http://www.grisoft.com). |Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 | | | |--- |Outgoing mail is certified Virus Free. |Checked by AVG anti-virus system (http://www.grisoft.com). |Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 | | | |--- |-- |To unsubscribe, e-mail: [EMAIL PROTECTED] |For additional commands, e-mail: [EMAIL PROTECTED] | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j + j2ee error
Sorry, actuall option #1 would need to be: private static Category log = Category.getInstance( EmployeeVO.class ); instead... |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED]] |Sent: Thursday, February 06, 2003 11:54 AM |To: 'Log4J Users List'; '[EMAIL PROTECTED]' |Subject: RE: log4j + j2ee error | | |So do one of the following: | |1) |public class EmployeeVO implements java.io.Serializable |{ |private static Category log = Category.getInstance( |getClass() ); |... |public getName() |{ |try |{ |... |} |catch(Exception e) |{ |log.error(...); |} |} |} | | |2) |public class EmployeeVO implements java.io.Serializable |{ |private transient Category log; | |... | |public EmployeeVO() |{ |log = Category.getInstance( getClass() ); |} | |public getName() |{ |try |{ |... |} |catch(Exception e) |{ |log.error(...); |} |} |} | | |Of course, option #2 is only really of value if retreival |of a Category for |variable log is based on some type of per-instance data. | | | ||-Original Message- ||From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] ||Sent: Thursday, February 06, 2003 12:03 PM ||To: '[EMAIL PROTECTED]'; ||'[EMAIL PROTECTED]' ||Subject: RE: log4j + j2ee error || || ||My EmployeeVO valueobject class looks like: || ||public class EmployeeVO implements java.io.Serializable ||{ ||private transient Category log = Category.getInstance( ||getClass() ); ||... || || public getName() { || try { || ... || } catch(Exception e) { || log.error(...); || } ||} || ||- Sandeep || ||-- ||From: Martin Gainty ||Sent: Thursday, February 06, 2003 12:34 PM ||To: [EMAIL PROTECTED] ||Cc: [EMAIL PROTECTED] ||Subject: RE: log4j + j2ee error || ||File: ATT00032.html || ||--- ||Incoming mail is certified Virus Free. ||Checked by AVG anti-virus system (http://www.grisoft.com). ||Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 || || || ||--- ||Outgoing mail is certified Virus Free. ||Checked by AVG anti-virus system (http://www.grisoft.com). ||Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 || || || ||--- ||-- ||To unsubscribe, e-mail: |[EMAIL PROTECTED] ||For additional commands, e-mail: |[EMAIL PROTECTED] || | |--- |-- |To unsubscribe, e-mail: [EMAIL PROTECTED] |For additional commands, e-mail: [EMAIL PROTECTED] | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j + j2ee error
Sandeep The javadoc states Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures: private void writeObject(java.io.ObjectOutputStream out) throws IOException private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; as well as providing a no-arg constructor to initialize the class's state. In addition (following the Sun doc) Serializable classes that need to designate an alternative object to be used when writing an object to the stream should implement this special method with the exact signature: ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; Classes that need to designate a replacement when an instance of it is read from the stream should implement this special method with the exact signature. ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; So in order to ascertain what is going on the logical first step is to get the Serializable class operational without log4j Then add in the Log4j afterwards taking into account which streams you are introducing Makes sense? -Martin - Original Message - From: Sandeep Dixit [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 06, 2003 2:02 PM Subject: RE: log4j + j2ee error My EmployeeVO valueobject class looks like: public class EmployeeVO implements java.io.Serializable { private transient Category log = Category.getInstance( getClass() ); ... public getName() { try { ... } catch(Exception e) { log.error(...); } } - Sandeep -- From: Martin Gainty Sent: Thursday, February 06, 2003 12:34 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: log4j + j2ee error File: ATT00032.html --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j + j2ee error
It looks like maybe you are trying to define a Logger as a variable on something which is getting serialized. Logger does not implement the Serializable interface. You must mark that Logger variable as transient, or explicitly read and write it yourself during serialization. |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, February 05, 2003 2:40 PM |To: '[EMAIL PROTECTED]' |Subject: log4j + j2ee error | | |I am getting following error message while attempting to |use log4j with J2ee 1.3.1. Any help would be appreciated. | |Thanks, |Sandeep | | |J2EE server startup complete. |Before call to PropertyConfigurator |After call to PropertyConfigurator |Exception in thread HttpProcessor[8000][3] |org.omg.CORBA.BAD_PARAM: org.apache |.log4j.Category vmcid: OMG minor code: 6 completed: Maybe |at |com.sun.corba.se.internal.util.Utility.throwNotSerializable |ForCorba(U |tility.java:1018) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectFi |eld(IIOPOu |tputStream.java:652) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFi |elds(IIOPO |utputStream.java:706) |at |com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteO |bjectDeleg |ate(IIOPOutputStream.java:165) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputObject( |IIOPOutput |Stream.java:496) |at |com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteOb |ject(IIOPO |utputStream.java:122) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInt |ernal(Valu |eHandlerImpl.java:136) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(Va |lueHandler |Impl.java:116) |at |com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_va |lue(CDROut |putStream_1_0.java:1049) |at |com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_ab |stract_int |erface(CDROutputStream_1_0.java:626) |at |com.sun.corba.ee.internal.iiop.CDROutputStream.write_abstra |ct_interfa |ce(CDROutputStream.java:281) |at |com.sun.corba.ee.internal.javax.rmi.CORBA.Util.writeAbstrac |tObject(Ut |il.java:145) |at javax.rmi.CORBA.Util.writeAbstractObject(Util.java:129) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectDe |legate(IIO |POutputStream.java:96) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectOv |erride(IIO |POutputStream.java:103) |at |java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274) |at java.util.HashSet.writeObject(HashSet.java:248) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObject(N |ative Meth |od) |at |com.sun.corba.se.internal.io.IIOPOutputStream.invokeObjectW |riter(IIOP |OutputStream.java:526) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputObject( |IIOPOutput |Stream.java:493) |at |com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteOb |ject(IIOPO |utputStream.java:122) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInt |ernal(Valu |eHandlerImpl.java:136) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(Va |lueHandler |Impl.java:116) |at |com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_va |lue(CDROut |putStream_1_0.java:1049) |at |com.sun.corba.ee.internal.iiop.CDROutputStream.write_value( |CDROutputS |tream.java:264) |at |com.sun.corba.ee.internal.javax.rmi.CORBA.Util.copyObject(U |til.java:5 |67) |at javax.rmi.CORBA.Util.copyObject(Util.java:314) |at |com.ohioedge.j2ee.api.org.ejb._OrganizationManager_Stub.fin |dColOfEmpl |oyeeVOByLoginInfo(Unknown Source) |at |com.ohioedge.j2ee.fnd.SessionBean.findByLoginInfo(Unknown Source) |at |org.j2eebuilder.view.SessionImpl.processRequest(Unknown Source) |at org.apache.jsp.Home$jsp._jspService(Home$jsp.java:166) |at |org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) |at |javax.servlet.http.HttpServlet.service(HttpServlet.java:853) |at |org.apache.jasper.servlet.JspServlet$JspServletWrapper.serv |ice(JspSer |vlet.java:202) |at |org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServ |let.java:3 |82) |at |org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) |at
RE: log4j + j2ee error
Well. I am not sure about Looger variable. I am using private Category log = Category.getInstance(getClass()); statement in the OrganizationManager session bean. Log4j initialization is done successfully in the view controller servlet. This error occurs when the findColOfEmployeeVOByLoginInfo method of the OrganizationManager session bean is called. method *** public Collection findColOfEmployeeVOByLoginInfo(String username, String password) throws SessionException, RemoteException { try { EmployeeHome home = (EmployeeHome) ServiceLocatorBean.getInstance().getLocalHome( ejb/Employee, EmployeeHome.class); return ValueObjectFactory.getInstance().getCollectionOfVO( home.findByLoginInfo(username, password)); } catch (Exception re) { throw new SessionException(this.getClass().getName()+.findByLoginInfo():+re.getMessage()); } } *** The method getCollectionOfVO gets the EJB interface objects and then copies values into JavaBean objects and returns a collection of JavaBean objects. Both EJB and JavaBean have - private Category log = Category.getInstance(getClass()); defined in them. But the variable log is not copied. Thanks, Sandeep -- From: Ebersole, Steven Sent: Wednesday, February 05, 2003 3:28 PM To: 'Log4J Users List' Subject:RE: log4j + j2ee error It looks like maybe you are trying to define a Logger as a variable on something which is getting serialized. Logger does not implement the Serializable interface. You must mark that Logger variable as transient, or explicitly read and write it yourself during serialization. |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, February 05, 2003 2:40 PM |To: '[EMAIL PROTECTED]' |Subject: log4j + j2ee error | | |I am getting following error message while attempting to |use log4j with J2ee 1.3.1. Any help would be appreciated. | |Thanks, |Sandeep | | |J2EE server startup complete. |Before call to PropertyConfigurator |After call to PropertyConfigurator |Exception in thread HttpProcessor[8000][3] |org.omg.CORBA.BAD_PARAM: org.apache |.log4j.Category vmcid: OMG minor code: 6 completed: Maybe |at |com.sun.corba.se.internal.util.Utility.throwNotSerializable |ForCorba(U |tility.java:1018) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectFi |eld(IIOPOu |tputStream.java:652) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFi |elds(IIOPO |utputStream.java:706) |at |com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteO |bjectDeleg |ate(IIOPOutputStream.java:165) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputObject( |IIOPOutput |Stream.java:496) |at |com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteOb |ject(IIOPO |utputStream.java:122) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInt |ernal(Valu |eHandlerImpl.java:136) |at |com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(Va |lueHandler |Impl.java:116) |at |com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_va |lue(CDROut |putStream_1_0.java:1049) |at |com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_ab |stract_int |erface(CDROutputStream_1_0.java:626) |at |com.sun.corba.ee.internal.iiop.CDROutputStream.write_abstra |ct_interfa |ce(CDROutputStream.java:281) |at |com.sun.corba.ee.internal.javax.rmi.CORBA.Util.writeAbstrac |tObject(Ut |il.java:145) |at javax.rmi.CORBA.Util.writeAbstractObject(Util.java:129) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectDe |legate(IIO |POutputStream.java:96) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectOv |erride(IIO |POutputStream.java:103) |at |java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274) |at java.util.HashSet.writeObject(HashSet.java:248) |at |com.sun.corba.se.internal.io.IIOPOutputStream.writeObject(N |ative Meth |od) |at |com.sun.corba.se.internal.io.IIOPOutputStream.invokeObjectW |riter(IIOP |OutputStream.java:526) |at |com.sun.corba.se.internal.io.IIOPOutputStream.outputObject( |IIOPOutput |Stream.java:493) |at |com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteOb |ject(IIOPO
RE: log4j + j2ee error
Logger is the name of the newer class which replaced Category. The issue is the same for both of them, however. At some point in your application, the server needs to return data back to the client (typically in J2EE apps this is accomplished with ValueObjects or DataTransferObjects depending on your preferred patterns catalog). That server return will be serialized for transport back to the client (actually for transport back to the client stub, which then deserializes it for the calling client). So in your set up, I am guessing that ValueObjectFactory is returning a collection of a class named like EmployeeVO. If this collection is then sent back to the client and the EmployeeVO instances making up the elements of that collection define a Logger (or Category) instance, the serialization will fail because Logger/Category is not serializable. You would need to mark the Logger/Category variable on the EmployeeVO class as transient. So if you have: public class EmployeeVO { private Category log = Category.getInstance( getClass() ); ... } change to: public class EmployeeVO { private transient Category log = Category.getInstance( getClass() ); ... } |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, February 05, 2003 3:12 PM |To: 'Log4J Users List' |Subject: RE: log4j + j2ee error | | |Well. I am not sure about Looger variable. I am using | |private Category log = Category.getInstance(getClass()); | |statement in the OrganizationManager session bean. Log4j |initialization is done successfully in the view controller |servlet. This error occurs when the |findColOfEmployeeVOByLoginInfo method of the |OrganizationManager session bean is called. | | method *** | public Collection findColOfEmployeeVOByLoginInfo(String |username, String password) throws SessionException, |RemoteException { | try { | EmployeeHome home = (EmployeeHome) | |ServiceLocatorBean.getInstance().getLocalHome( | ejb/Employee, |EmployeeHome.class); | | return |ValueObjectFactory.getInstance().getCollectionOfVO( | |home.findByLoginInfo(username, password)); | } catch (Exception re) { | throw new |SessionException(this.getClass().getName()+.findByLoginInf |o():+re.getMessage()); | } | } |*** |The method getCollectionOfVO gets the EJB interface |objects and then copies values into JavaBean objects and |returns a collection of JavaBean objects. Both EJB and |JavaBean have | |- private Category log = Category.getInstance(getClass()); | |defined in them. But the variable log is not copied. | |Thanks, |Sandeep | | | |-- |From: Ebersole, Steven |Sent: Wednesday, February 05, 2003 3:28 PM |To:'Log4J Users List' |Subject: RE: log4j + j2ee error | |It looks like maybe you are trying to define a Logger as a |variable on |something which is getting serialized. Logger does not |implement the |Serializable interface. You must mark that Logger |variable as transient, or |explicitly read and write it yourself during serialization. | | | ||-Original Message- ||From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] ||Sent: Wednesday, February 05, 2003 2:40 PM ||To: '[EMAIL PROTECTED]' ||Subject: log4j + j2ee error || || ||I am getting following error message while attempting to ||use log4j with J2ee 1.3.1. Any help would be appreciated. || ||Thanks, ||Sandeep || || ||J2EE server startup complete. ||Before call to PropertyConfigurator ||After call to PropertyConfigurator ||Exception in thread HttpProcessor[8000][3] ||org.omg.CORBA.BAD_PARAM: org.apache ||.log4j.Category vmcid: OMG minor code: 6 completed: Maybe ||at ||com.sun.corba.se.internal.util.Utility.throwNotSerializable ||ForCorba(U ||tility.java:1018) ||at ||com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectFi ||eld(IIOPOu ||tputStream.java:652) ||at ||com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFi ||elds(IIOPO ||utputStream.java:706) ||at ||com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteO ||bjectDeleg ||ate(IIOPOutputStream.java:165) ||at ||com.sun.corba.se.internal.io.IIOPOutputStream.outputObject
Re: log4j + j2ee error
Sandeep- At first glance it appears that readObject is returning null to findByLoginInfo somewhere Can you put in a try catch to catch the NullPointerException? Regards, -Martin - Original Message - From: Sandeep Dixit [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 4:39 PM Subject: log4j + j2ee error I am getting following error message while attempting to use log4j with J2ee 1.3.1. Any help would be appreciated. Thanks, Sandeep J2EE server startup complete. Before call to PropertyConfigurator After call to PropertyConfigurator Exception in thread HttpProcessor[8000][3] org.omg.CORBA.BAD_PARAM: org.apache .log4j.Category vmcid: OMG minor code: 6 completed: Maybe at com.sun.corba.se.internal.util.Utility.throwNotSerializableForCorba(U tility.java:1018) at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectField(IIOPOu tputStream.java:652) at com.sun.corba.se.internal.io.IIOPOutputStream.outputClassFields(IIOPO utputStream.java:706) at com.sun.corba.se.internal.io.IIOPOutputStream.defaultWriteObjectDeleg ate(IIOPOutputStream.java:165) at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutput Stream.java:496) at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPO utputStream.java:122) at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(Valu eHandlerImpl.java:136) at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandler Impl.java:116) at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROut putStream_1_0.java:1049) at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_abstract_int erface(CDROutputStream_1_0.java:626) at com.sun.corba.ee.internal.iiop.CDROutputStream.write_abstract_interfa ce(CDROutputStream.java:281) at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.writeAbstractObject(Ut il.java:145) at javax.rmi.CORBA.Util.writeAbstractObject(Util.java:129) at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectDelegate(IIO POutputStream.java:96) at com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectOverride(IIO POutputStream.java:103) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274) at java.util.HashSet.writeObject(HashSet.java:248) at com.sun.corba.se.internal.io.IIOPOutputStream.writeObject(Native Meth od) at com.sun.corba.se.internal.io.IIOPOutputStream.invokeObjectWriter(IIOP OutputStream.java:526) at com.sun.corba.se.internal.io.IIOPOutputStream.outputObject(IIOPOutput Stream.java:493) at com.sun.corba.se.internal.io.IIOPOutputStream.simpleWriteObject(IIOPO utputStream.java:122) at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValueInternal(Valu eHandlerImpl.java:136) at com.sun.corba.se.internal.io.ValueHandlerImpl.writeValue(ValueHandler Impl.java:116) at com.sun.corba.ee.internal.iiop.CDROutputStream_1_0.write_value(CDROut putStream_1_0.java:1049) at com.sun.corba.ee.internal.iiop.CDROutputStream.write_value(CDROutputS tream.java:264) at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.copyObject(Util.java:5 67) at javax.rmi.CORBA.Util.copyObject(Util.java:314) at com.ohioedge.j2ee.api.org.ejb._OrganizationManager_Stub.findColOfEmpl oyeeVOByLoginInfo(Unknown Source) at com.ohioedge.j2ee.fnd.SessionBean.findByLoginInfo(Unknown Source) at org.j2eebuilder.view.SessionImpl.processRequest(Unknown Source) at org.apache.jsp.Home$jsp._jspService(Home$jsp.java:166) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer vlet.java:202) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3 82) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:683) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD ispatcher.java:574) at org.apache.catalina.core.ApplicationDispatcher.access$1(ApplicationDi spatcher.java:501) at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run( ApplicationDispatcher.java:146) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis patcher.java:488) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary .java:819) at
RE: log4j + j2ee error
So in your set up, I am guessing that ValueObjectFactory is returning a collection of a class named like EmployeeVO. If this collection is then sent back to the client and the EmployeeVO instances making up the elements of that collection define a Logger (or Category) instance, the serialization will fail because Logger/Category is not serializable. You would need to mark the Logger/Category variable on the EmployeeVO class as transient. You should also look at whether you had actually intended your Logger/Category variable to be static. Besides solving this problem, it will give you a very minor performance assist. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j + j2ee error
Thank you so much. transient eliminates the error. I still have a question, doesn't private declaration excludes data members from getting serialized/deserialized? - Sandeep -- From: Ebersole, Steven Sent: Wednesday, February 05, 2003 4:48 PM To: 'Log4J Users List' Subject:RE: log4j + j2ee error Logger is the name of the newer class which replaced Category. The issue is the same for both of them, however. At some point in your application, the server needs to return data back to the client (typically in J2EE apps this is accomplished with ValueObjects or DataTransferObjects depending on your preferred patterns catalog). That server return will be serialized for transport back to the client (actually for transport back to the client stub, which then deserializes it for the calling client). So in your set up, I am guessing that ValueObjectFactory is returning a collection of a class named like EmployeeVO. If this collection is then sent back to the client and the EmployeeVO instances making up the elements of that collection define a Logger (or Category) instance, the serialization will fail because Logger/Category is not serializable. You would need to mark the Logger/Category variable on the EmployeeVO class as transient. So if you have: public class EmployeeVO { private Category log = Category.getInstance( getClass() ); ... } change to: public class EmployeeVO { private transient Category log = Category.getInstance( getClass() ); ... } |-Original Message- |From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] |Sent: Wednesday, February 05, 2003 3:12 PM |To: 'Log4J Users List' |Subject: RE: log4j + j2ee error | | |Well. I am not sure about Looger variable. I am using | |private Category log = Category.getInstance(getClass()); | |statement in the OrganizationManager session bean. Log4j |initialization is done successfully in the view controller |servlet. This error occurs when the |findColOfEmployeeVOByLoginInfo method of the |OrganizationManager session bean is called. | | method *** | public Collection findColOfEmployeeVOByLoginInfo(String |username, String password) throws SessionException, |RemoteException { | try { | EmployeeHome home = (EmployeeHome) | |ServiceLocatorBean.getInstance().getLocalHome( | ejb/Employee, |EmployeeHome.class); | | return |ValueObjectFactory.getInstance().getCollectionOfVO( | |home.findByLoginInfo(username, password)); | } catch (Exception re) { | throw new |SessionException(this.getClass().getName()+.findByLoginInf |o():+re.getMessage()); | } | } |*** |The method getCollectionOfVO gets the EJB interface |objects and then copies values into JavaBean objects and |returns a collection of JavaBean objects. Both EJB and |JavaBean have | |- private Category log = Category.getInstance(getClass()); | |defined in them. But the variable log is not copied. | |Thanks, |Sandeep | | | |-- |From: Ebersole, Steven |Sent: Wednesday, February 05, 2003 3:28 PM |To:'Log4J Users List' |Subject: RE: log4j + j2ee error | |It looks like maybe you are trying to define a Logger as a |variable on |something which is getting serialized. Logger does not |implement the |Serializable interface. You must mark that Logger |variable as transient, or |explicitly read and write it yourself during serialization. | | | ||-Original Message- ||From: Sandeep Dixit [mailto:[EMAIL PROTECTED]] ||Sent: Wednesday, February 05, 2003 2:40 PM ||To: '[EMAIL PROTECTED]' ||Subject: log4j + j2ee error || || ||I am getting following error message while attempting to ||use log4j with J2ee 1.3.1. Any help would be appreciated. || ||Thanks, ||Sandeep || || ||J2EE server startup complete. ||Before call to PropertyConfigurator ||After call to PropertyConfigurator ||Exception in thread HttpProcessor[8000][3] ||org.omg.CORBA.BAD_PARAM: org.apache ||.log4j.Category vmcid: OMG minor code: 6 completed: Maybe ||at ||com.sun.corba.se.internal.util.Utility.throwNotSerializable ||ForCorba(U ||tility.java:1018) ||at ||com.sun.corba.se.internal.io.IIOPOutputStream.writeObjectFi ||eld(IIOPOu ||tputStream.java:652
RE: log4j + j2ee error
Thank you so much. transient eliminates the error. I still have a question, doesn't private declaration excludes data members from getting serialized/deserialized? - Sandeep No. There are various ways you can control what gets serialized, but if you just take the defaults, everything is taken. http://java.sun.com/j2se/1.4/docs/guide/serialization/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]