Question & Answer
Question
Cause
Java's exception stack traces are an extremely useful debugging aid. They can often expedite problem determination in your own code, and certainly help when reporting problems to others. Part of the stack trace which is most useful are the line numbers. The following stack trace shows a complete call stack along with line numbers:
com.ibm.as400.access.AS400SecurityException: Signon was canceled.
at com.ibm.as400.access.AS400.getSecurity400(AS400.java:1406)
at com.ibm.as400.access.AS400.signOn(AS400.java:2423)
at com.ibm.as400.access.AS400.connect(AS400.java:626)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(
AS400JDBCConnection.java:1465)
at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(
AS400JDBCDriver.java:423)
at com.ibm.as400.access.AS400JDBCDriver.connect(
AS400JDBCDriver.java:231)
at java.sql.DriverManager.getConnection(DriverManager.java:457)
at java.sql.DriverManager.getConnection(DriverManager.java:159)
at QueryCustomer.main(QueryCustomer.java:20)
Sometimes, the line numbers are replaced with the phrase "Compiled Code". If this is true, the stack trace is not as useful for debugging:
com.ibm.as400.access.AS400SecurityException: Signon was canceled.
at com.ibm.as400.access.AS400.getSecurity400(Compiled Code)
at com.ibm.as400.access.AS400.signOn(Compiled Code)
at com.ibm.as400.access.AS400.connect(Compiled Code)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(Compiled Code)
at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(Compiled Code)
at com.ibm.as400.access.AS400JDBCDriver.connect(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at QueryCustomer.main(Compiled Code)
Answer
The primary reason that line numbers are missing from the stack trace is that the JIT (Just In Time) compiler is enabled. In most environments, the JIT compiler is enabled by default in order to maximize performance. However, it is desirable to turn the JIT off during debugging, so that stack traces include line numbers.
Different environments provide different mechanisms for turning off the JIT. Here are some of the most common scenarios.
-
Applications using JDK 1.1.5 and previous (Windows)
Use the -nojit option when running the java command. Example:
java -nojit QueryCustomer Lee Jeff -
Applications using JDK 1.1.6 and later (Windows) or any non-Windows JDK
Set the JAVA_COMPILER environment variable to point to a non-existent JIT compiler, e.g. "nojit". To turn off the JIT in the existing DOS prompt only (Windows): set JAVA_COMPILER=nojit.
To permanently turn off the JIT in Windows 95, add the above line to your AUTOEXEC.BAT file. In Windows NT, use the System Environment GUI to set the environment variable. For other platforms, set the JAVA_COMPILER environment variable accordingly. -
Applets in Netscape Communicator 4.x (Windows)
Rename or delete the file JIT3240.DLL found in C:Program FilesNetscapeCommunicatorJavaBin. Applets in Microsoft Internet Explorer 4.x (Windows), Un-check the "Java JIT compiler enabled" setting located in the "Java VM" section of the Internet Explorer preferences. The preferences can be found by following the pull-down menus: View -> Internet Options -> Advanced.
Product Synonym
IBM i;OS400
Was this topic helpful?
Document Information
Modified date:
04 March 2020
UID
ibm11117257