You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2010/05/07 21:19:32 UTC

DO NOT REPLY [Bug 49265] New: log4j - java.io.OptionalDataException

https://issues.apache.org/bugzilla/show_bug.cgi?id=49265

           Summary: log4j - java.io.OptionalDataException
           Product: Log4j
           Version: 1.2
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: tumultuousCT@yahoo.com


I'm running 10.6.3 w/ the latest Java install. I'm trying to get a genomics
program to work - I didn't use to have problems with it, but now I keep getting
this message. I've spent hours messing with the CLASSPATH and other random
things, but none of it helps. If I do a simple hello world program - it works.
I downloaded the latest log4j - when I use the installation manual's suggested
test program, the compiler lists 6 errors just trying to compile it. Does
anyone know what is going on? Of course, when I look at sun.com, they state the
following for java.io.OptionalDataException:
"public class OptionalDataException. extends ObjectStreamException
Exception indicating the failure of an object read operation due to unread
primitive data, or the end of data belonging to a serialized object in the
stream. This exception may be thrown in two cases:
An attempt was made to read an object when the next element in the stream is
primitive data. In this case, the OptionalDataException's length field is set
to the number of bytes of primitive data immediately readable from the stream,
and the eof field is set to false.
An attempt was made to read past the end of data consumable by a class-defined
readObject or readExternal method. In this case, the OptionalDataException's
eof field is set to true, and the length field is set to 0. "

Well that's not very helpful to a total java newbie like myself. It seems like
there are many things screwed up on my system since even though I downloaded
log4j, and then also installed the jakarta-log4j port through macports, neither
of these things resolved the issue. 

Please help!
java.io.OptionalDataException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at util.gen.IO.fetchObject(IO.java:953)
at trans.main.LoadIntervalOligoInfo.run(LoadIntervalOligoInfo.java:44)
at trans.main.LoadIntervalOligoInfo.main(LoadIntervalOligoInfo.java:192)
log4j:WARN No appenders could be found for logger (util.gen.IO).
log4j:WARN Please initialize the log4j system properly.
Indexing intervals by chromosome and start position
Exception in thread "main" java.lang.NullPointerException
at trans.main.LoadIntervalOligoInfo.run(LoadIntervalOligoInfo.java:49)
at trans.main.LoadIntervalOligoInfo.main(LoadIntervalOligoInfo.java:192) 


When I try to install log4j w/ maven, I get the following:
Test org.apache.log4j.CoreTestSuite failed
and a bunch of other crap.

Please help!
T

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


DO NOT REPLY [Bug 49265] log4j - java.io.OptionalDataException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49265

Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from Curt Arnold <ca...@apache.org> 2010-05-10 01:08:43 EDT ---
There are a lot of different things going on in this entry.  The user mailing
list is the right place for usage questions.  It does not (yet) describe a
log4j bug in sufficient detail for somebody to reproduce and fix an issue.  I
expect you may have more questions, but put those in a post to the user list.

The following things appear to be happening in your stack trace:

1) util.gen.IO.fetchObject() attempts to deserialize some object and fails. 
This is something in the application that you are trying to run and does not
appear to involve log4j.

java.io.OptionalDataException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at util.gen.IO.fetchObject(IO.java:953)
at trans.main.LoadIntervalOligoInfo.run(LoadIntervalOligoInfo.java:44)
at trans.main.LoadIntervalOligoInfo.main(LoadIntervalOligoInfo.java:192)

I'm guessing there is some incompatibility or error with some data file that
you are trying to read.  Perhaps the file was written by a different version of
your program or using a later version of the JDK.

2) Your app makes a log request (likely due to the first failure), but no
logging configuration file can be found so log4j emits its standard response in
the situation:

log4j:WARN No appenders could be found for logger (util.gen.IO).
log4j:WARN Please initialize the log4j system properly.

3) Your app outputs:

Indexing intervals by chromosome and start position

4) Your app throws a NullPointerException (possibly due to trying to use the
object that failed to deserialize)

Exception in thread "main" java.lang.NullPointerException
at trans.main.LoadIntervalOligoInfo.run(LoadIntervalOligoInfo.java:49)
at trans.main.LoadIntervalOligoInfo.main(LoadIntervalOligoInfo.java:192) 


While it won't fix the underlying problem with the app, you may get better
diagnostics if you provide log4j a configuration file.  log4j will look for
log4j.properties or log4j.xml in the classpath which could be something as
simple as:

log4j.rootLogger=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.SimpleLayout

Otherwise, if you have the source just peek into your code at util/gen/IO.java
at line 953 and after

--

I just did a "mvn test" with log4j 1.2.16 on Mac OS/X 10.6.3 using Java
1.6.0_17 which completed successfully.   CoreTestSuite contains a lot of
different tests, so trying to figure that what is failing really requires
knowing what test failed and seeing all the other stuff that was reported.  It
is unlikely related to the problem you are experiencing with your program, but
if you could provide more info, we can see if we can reproduce it.  Some tests
are a little timing sensitive and fail one time out of ten or so.   Could you
check if the test always fails.


--

Please give the URL or file path to the "installation manual".  Not sure what
you are referencing and perhaps it is obsolete.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org