Vikram P
Vikram P

Reputation: 85

Unable to load the class even if it exists at compile time

In our project I am getting the following exception while deploying the code. The masked class is a utility class file which is failed to load runtime. Why is the class is failing to load though the class exists at compile time?

javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.***.****.******
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:333)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
    ****
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)

Upvotes: 0

Views: 1084

Answers (2)

TimmyD
TimmyD

Reputation: 81

I agree with BalusC. Note however that depending on your circumstance the exception may not surface (in which case you're just forced to look reaalllly closely). Newer JRE's are much better (although you are running within weblogic which could be doing a bunch of funky stuff) and I haven't had this issue for a while but once upon a time it was one of my biggest bug bears.

Upvotes: 1

BalusC
BalusC

Reputation: 1109532

This NoClassDefFoundError can occur if any of the static variables or static {} blocks threw an RuntimeException (e.g. NullPointerException, etc) during class initialization.

This RuntimeException should be visible further down in the stacktrace. Interpret it and fix the code accordingly.

Upvotes: 1

Related Questions