Problem transforming/redefining class. java.lang.InternalError: class redefinition failed: invalid class

  • Updated

Issue

The following error(s) are being seen in the Contrast Java agent logs when trying to instrument your application:

2022-06-23 16:37:16,173 [Thread-0 w] ERROR - Problem transforming/redefining class org.springframework.boot.autoconfigure.web.embedded.JettyWebServerFactoryCustomizer
java.lang.InternalError: class redefinition failed: invalid class
  at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
  at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
    at com.contrastsecurity.agent.instr.b.a(ClassInstrumentor.java:23)
....

 

Cause

This error is typically seen when using the Contrast agent in conjunction with a 3rd party agent where Contrast has not been defined as the first -javaagent option.  See - Behavior with other Java Agents.

You may also see this error when using a delayed boot strategy in the Contrast configuration in conjunction with a 3rd party agent, even if Contrast has been defined as the first -javaagent option.

 

Resolution

  • Ensure that the Contrast agent is set as the first -javaagent option.
  • The delayed boot strategy configuration should be removed to allow the Contrast agent to start normally.

(Delaying agent boot essentially negates the effect of placing the Contrast agent first in the configuration which results in the 3rd party agent loading first and manipulating classes in a way that is incompatible with the Contrast agent's instrumentation.)

 

See also:

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request