Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does stripped JARs (no bytecode for methods) mean?

I am trying hard to find the cause of a weird JSF error. To do this, I try to debug the source code inside javaee-web-api module where a NullPointerException is thrown during JSF rendering. But I am stuck because the debugger does not show me the source code of that location.

There is a discussion thread that says that javaee-web-api is stripped (no bytecode for methods) and meant to be used only for compilation.

What does this mean? Can someone explain it in more detail? I want to understand why I cannot debug the location where that NullPointerException is thrown. I think this is related to the fact that these JARs are stripped.

like image 342
Mert Nuhoglu Avatar asked Jul 10 '13 15:07

Mert Nuhoglu


People also ask

What do you mean by bytecode?

Byte code is the intermediate code compiled and executed by a virtual machine (VM). Byte code can be used unchanged on any platform on which the VM operates.

Is jar a bytecode?

byte codes are intermediate representation of your code which is generated by Java compiler. this can be understood only by Java compiler and can't be execute anywhere. where as jar is generated in order to deploy the written code. jar contains class files and its used for deploying the application.

What does bytecode mean in Java?

Byte Code can be defined as an intermediate code generated by the compiler after the compilation of source code(JAVA Program). This intermediate code makes Java a platform-independent language.

What is JIT and bytecode explain?

The JIT compiler is enabled by default, and is activated when a Java method is called. The JIT compiler compiles the bytecodes of that method into native machine code, compiling it "just in time" to run. When a method has been compiled, the JVM calls the compiled code of that method directly instead of interpreting it.


1 Answers

Normally, the class files in a jar file will contain information on the line numbers relating to the code in the class - this is called the debug information. A stripped jar simply does not have this information.

You are correct in assuming this is the problem. The stack trace you see won't contain any line numbers relating to the code in the stripped jar. Since the jar is provided by a third-party, there's nothing you can do to get that information.

like image 112
Ian Fairman Avatar answered Oct 25 '22 16:10

Ian Fairman