License Type | SaaS & On-Premise |
Agent Mode | Assess & Protect |
Main Product Category | Java Agent |
Sub Category | Instrumentation |
Issue
The following error(s) are being seen in the Contrast Java agent logs when trying to instrument our 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
Define the Contrast agent as the first -javaagent
option.
The delayed boot time and strategy settings essentially negates the requirement for putting the Contrast agent first in configuration. As a result, the 3rd party agent manipulates classes in a way that is incompatible with our instrumentation.
The delayed boot strategy configuration should be removed to allow the Contrast agent to start normally.
See also: