NullPointerException

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

NullPointerException

Post by isheedm »

Some of my log files have entries that look like the example below, and I'm getting a NullPointerException. My log4j pattern for the parser is

Code: Select all

%p %d{ISO8601} [%t] - %m (%F:%L)%n
and I'm using v2.0.1.

The extra newlines seem to cause the problem. I would prefer that this message could be parsed. If that is too difficult, it would be good if the remainder of the file could be parsed and not let one message cause the whole file to not be parsed.

Code: Select all

ERROR 2010-12-13 08:12:34,662 [RMI TCP Connection(1614)-000.11.222.333] - Error doing something! (class4.java:13634)
dir1.dir2.FooException: Error creating data object!

dir.dir2.FooException: Error getting Type data object!

dir.dir2.FooException: Error getting timestamp from column 'update_timestamp' in table 'this_list' on 'Type'!

java.sql.SQLException: Bad format for number '18446682143312751616' in column 1(this_list.update_timestamp).
        at org.gjt.mm.mysql.ResultSet.getLong(ResultSet.java:411)
        at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:189)
        at dir.dir3.class1.getTimestampVal(class1.java:200)
        at dir.server.class1.getTimestampVal(class1.java:144)
        at dir.dir3.class2.getTimestampUpdate(class2.java:7066)
        at dir.dir3.class2.getDO(class2.java:5878)
        at dir.dir3.class3.getDataObject(class3.java:1365)
        at dir.dir3.class4.getAnotherDataObject(class4.java:13527)
        at dir.dir3.class4.getAnotherDataObject(class4.java:13362)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: NullPointerException

Post by admin »

Hello,

I tried to reproduce the problem with LogMX v2.0.1, this Log4j Pattern, and log file, and LogMX doesn't produce a NullPointerException.
Do you mean LogMX produces this NullPointerException, or do you try to parse a log file that contains a Stack Trace for a NullPointerException?

Xavier.
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

Re: NullPointerException

Post by isheedm »

LogMX generates the exception. See the attached screenshot.
logmx.png
logmx.png (24.37 KiB) Viewed 11446 times
I have 2 Log4j parsers configured. This is the 2nd parser. LogMX switched to it after the first one didn't match. My first parser is a Log4j pattern:

Code: Select all

%p %d{ISO8601} [%t] (%F:%L) %c - %m%n
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: NullPointerException

Post by admin »

Hello,

I parsed the sample log file of your first post with your two Log4j parsers, using LogMX v2.0.1 with a default configuration (except for these two parsers), but I didn't get any Exception.

Please try the following:
  • close LogMX
  • rename your config file "config/logmx.properties" to a temporary file name
  • start LogMX
  • remove all existing parsers
  • add your two Log4j parsers
  • parse again your file
If it still produces an Exception, please send us:
  • your complete log file to support@logmx.com (please add in this mail: "viewtopic.php?t=123")
  • the stack trace that appears at parsing, when you start LogMX with "logmx.sh" (linux/mac) or "LogMX.bat" (windows)


Xavier.
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

Re: NullPointerException

Post by isheedm »

I followed your instructions to start with a new properties file and I did not get the error.

Before I did that, I started LogMX from a shell window and here is the exception I was getting:

Code: Select all

java.lang.NullPointerException
        at be.a(Unknown Source)
        at com.lightysoft.logmx.mgr.parsers.Log4jPatternLogFileParser.a(Unknown Source)
        at com.lightysoft.logmx.mgr.parsers.Log4jPatternLogFileParser.parseLine(Unknown Source)
        at com.lightysoft.logmx.mgr.e.a(Unknown Source)
        at com.lightysoft.logmx.mgr.e.a(Unknown Source)
        at ng.a(Unknown Source)
        at le.run(Unknown Source)
Any idea how I can fix my properties file? I'd like to keep all my bookmarks from the old one.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: NullPointerException

Post by admin »

Hello,

It seems to be an issue with user-defined fields (this parser uses "Line" and "File" fields), but I can't detect the root cause of the problem using this single stack trace, could you please send your config file to support@logmx.com (for security reason, you may want to remove from this file all your network accounts before).

Xavier.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: NullPointerException

Post by admin »

We have received your config file, thank you.
The error comes from the Log4j tags settings of Parser "IMAT2". I don't know why, but this config file doesn't contain any L4j tag setting for this parser (maybe you have manually modified this config file, or maybe a bug has removed all these tag settings for this parser).

Anyway, to use LogMX with your original config file again, you simply have to remove this parser and to recreate it.

Xavier.
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

Re: NullPointerException

Post by isheedm »

That worked. Thanks.
Post Reply