zania22
asked on
Writing to Tomcat Log and Serialize Bean
1. Runtime Tomcat errors are placed into an appropriate
log file for the day under TOMCAT_HOME/logs. How do I
write exceptions that I catch from my code. Write now
they are written to System.out.println(); And the
System.out.println is my Tomcat Terminal, which is not very
big and will not hold a day's worth.
2. I have implemented Serializable and Runnable for a class
that I use as a bean in a jsp page. I call a function of
the class in the jsp page where i pass in the request
object. The class's function takes it as an argument
of HttpServletRequestWrapper. Though everything works
smoothly, Tomcat fails to ever make the class serializable.
The log below is yelling that it has something to do with
HttpServletRequestWrapper, I realize that it cannot be serializable.
The j2se documentation for serializable says that in this case
I should override
private void writeObject(java.io.Object OutputStre am out)
throws IOException
private void readObject(java.io.ObjectI nputStream in)
throws IOException, ClassNotFoundException;
can someone elaborate?
Code for the jsp that uses class: http://www.uvm.edu/~nspence/exportsStatus.jsp
Code for the class: http://www.uvm.edu/~nspence/exportsServlet.java
Here is a log of the Serializable problem
2004-10-14 11:25:38 StandardManager[] Cannot serialize session attribute exports for session 8C519941DA39436D42D5CD0F89 B5685C
java.io.NotSerializableExc eption: javax.servlet.http.HttpSer vletReques tWrapper
at java.io.ObjectOutputStream .writeObje ct0(Object OutputStre am.java:10 54)
at java.io.ObjectOutputStream .defaultWr iteFields( ObjectOutp utStream.j ava:1332)
at java.io.ObjectOutputStream .writeSeri alData(Obj ectOutputS tream.java :1304)
at java.io.ObjectOutputStream .writeOrdi naryObject (ObjectOut putStream. java:1247)
at java.io.ObjectOutputStream .writeObje ct0(Object OutputStre am.java:10 52)
at java.io.ObjectOutputStream .writeObje ct(ObjectO utputStrea m.java:278 )
at org.apache.catalina.sessio n.Standard Session.wr iteObject( StandardSe ssion.java :1441)
at org.apache.catalina.sessio n.Standard Session.wr iteObjectD ata(Standa rdSession. java:880)
at org.apache.catalina.sessio n.Standard Manager.un load(Stand ardManager .java:536)
at org.apache.catalina.sessio n.Standard Manager.st op(Standar dManager.j ava:691)
at org.apache.catalina.core.S tandardCon text.reloa d(Standard Context.ja va:2462)
at org.apache.catalina.loader .WebappLoa der$Webapp ContextNot ifier.run( WebappLoad er.java:13 69)
at java.lang.Thread.run(Threa d.java:534 )
2004-10-14 11:25:43 StandardManager[] IOException while loading persisted sessions: java.io.WriteAbortedExcept ion: writing aborted; java.io.NotSerializableExc eption: javax.servlet.http.HttpSer vletReques tWrapper
java.io.WriteAbortedExcept ion: writing aborted; java.io.NotSerializableExc eption: javax.servlet.http.HttpSer vletReques tWrapper
at java.io.ObjectInputStream. readObject 0(ObjectIn putStream. java:1278)
at java.io.ObjectInputStream. defaultRea dFields(Ob jectInputS tream.java :1845)
at java.io.ObjectInputStream. readSerial Data(Objec tInputStre am.java:17 69)
at java.io.ObjectInputStream. readOrdina ryObject(O bjectInput Stream.jav a:1646)
at java.io.ObjectInputStream. readObject 0(ObjectIn putStream. java:1274)
at java.io.ObjectInputStream. readObject (ObjectInp utStream.j ava:324)
at org.apache.catalina.sessio n.Standard Session.re adObject(S tandardSes sion.java: 1371)
at org.apache.catalina.sessio n.Standard Session.re adObjectDa ta(Standar dSession.j ava:863)
at org.apache.catalina.sessio n.Standard Manager.lo ad(Standar dManager.j ava:440)
at org.apache.catalina.sessio n.Standard Manager.st art(Standa rdManager. java:655)
at org.apache.catalina.core.S tandardCon text.reloa d(Standard Context.ja va:2579)
at org.apache.catalina.loader .WebappLoa der$Webapp ContextNot ifier.run( WebappLoad er.java:13 69)
at java.lang.Thread.run(Threa d.java:534 )
Caused by: java.io.NotSerializableExc eption: javax.servlet.http.HttpSer vletReques tWrapper
at java.io.ObjectOutputStream .writeObje ct0(Object OutputStre am.java:10 54)
at java.io.ObjectOutputStream .defaultWr iteFields( ObjectOutp utStream.j ava:1332)
at java.io.ObjectOutputStream .writeSeri alData(Obj ectOutputS tream.java :1304)
at java.io.ObjectOutputStream .writeOrdi naryObject (ObjectOut putStream. java:1247)
at java.io.ObjectOutputStream .writeObje ct0(Object OutputStre am.java:10 52)
at java.io.ObjectOutputStream .writeObje ct(ObjectO utputStrea m.java:278 )
at org.apache.catalina.sessio n.Standard Session.wr iteObject( StandardSe ssion.java :1441)
at org.apache.catalina.sessio n.Standard Session.wr iteObjectD ata(Standa rdSession. java:880)
at org.apache.catalina.sessio n.Standard Manager.un load(Stand ardManager .java:536)
at org.apache.catalina.sessio n.Standard Manager.st op(Standar dManager.j ava:691)
at org.apache.catalina.core.S tandardCon text.reloa d(Standard Context.ja va:2462)
... 2 more
log file for the day under TOMCAT_HOME/logs. How do I
write exceptions that I catch from my code. Write now
they are written to System.out.println(); And the
System.out.println is my Tomcat Terminal, which is not very
big and will not hold a day's worth.
2. I have implemented Serializable and Runnable for a class
that I use as a bean in a jsp page. I call a function of
the class in the jsp page where i pass in the request
object. The class's function takes it as an argument
of HttpServletRequestWrapper.
smoothly, Tomcat fails to ever make the class serializable.
The log below is yelling that it has something to do with
HttpServletRequestWrapper,
The j2se documentation for serializable says that in this case
I should override
private void writeObject(java.io.Object
throws IOException
private void readObject(java.io.ObjectI
throws IOException, ClassNotFoundException;
can someone elaborate?
Code for the jsp that uses class: http://www.uvm.edu/~nspence/exportsStatus.jsp
Code for the class: http://www.uvm.edu/~nspence/exportsServlet.java
Here is a log of the Serializable problem
2004-10-14 11:25:38 StandardManager[] Cannot serialize session attribute exports for session 8C519941DA39436D42D5CD0F89
java.io.NotSerializableExc
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.core.S
at org.apache.catalina.loader
at java.lang.Thread.run(Threa
2004-10-14 11:25:43 StandardManager[] IOException while loading persisted sessions: java.io.WriteAbortedExcept
java.io.WriteAbortedExcept
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at java.io.ObjectInputStream.
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.core.S
at org.apache.catalina.loader
at java.lang.Thread.run(Threa
Caused by: java.io.NotSerializableExc
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at java.io.ObjectOutputStream
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.sessio
at org.apache.catalina.core.S
... 2 more
ASKER
Any thoughts about how to write to Tomcat's currernt(for the day) log file
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Wee! my 2nd correct question, thank you very much =D
Hope it helped, good luck with the Appenders!
Hope it helped, good luck with the Appenders!
ASKER