How to get line numbers in Java stack
 Technote (FAQ)
 
Problem
How to get line numbers in Java stack
 
Cause
IBM Java SDK's use JIT to compile the java code at runtime for improved performance. When an Exception occurs in the javacode running in JIT mode, then the runtime will fail to write the line number in the printed Exception Stack.

Example Java Stack for an Exception condition:

Exception thrown : java.lang.NullPointerException
at com.ibm.ws.cache.servlet.ServletWrapper.prepareMetadataServletWrapper.java(Compiled Code))
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java(Compiled Code))
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java(Compiled Code))
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
...........................................................................................

 
Solution
There are multiple ways to debug problems of the above nature. 1. More debug statements can be added to the application code. Application developers need to modify the code and application must be redeployed into the application server.

2. Disable JIT, this should enable JVM to print the line numbers for the failing stack. With this option, there could be huge performance impact. This will be a quick way to get line number, if performance is not a major concern.

3. Selectively disable JIT for the failing methods. For this technique, you will have to find the class/methods of interest and configure JVM to disable JIT for those specific classes. For the above failing stack, you will have to follow instructions to selectively disable JIT for the classes of interest.

 
Related information
Instructions to disable JIT selectively
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server
Operating system(s): Linux
Software version: 4.0
Software edition:
Reference #: 1223952
IBM Group: Software Group
Modified date: Nov 30, 2005