eclipse-ee4j / eclipse-ee4j/jersey
java.lang.IllegalStateException: The resource configuration is not modifiable in this context.
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
This is probably one of the most annoying issues I've encountered upgrading Jersey 1.x to 2.x:
```
java.lang.IllegalStateException: The resource configuration is not modifiable in this context.
org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:248)
org.glassfish.jersey.server.ResourceConfig$ImmutableState.register(ResourceConfig.java:195)
org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:428)
org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:306)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:347)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
```
In my case it comes from the factory `register()` related code:
```java
register(new AbstractBinder()
{
@Override
protected void configure()
{
bindFactory(XsltExecutableFactory.class).to(XsltExecutable.class).
proxy(true).proxyForSameScope(false).
in(RequestScoped.class);
}
});
```
This causes the error with absolutely no explanation or seemingly even relation to the cause.
It's been plaguing users for years, and every report seems to have a different cause: https://stackoverflow.com/questions/20670310/why-would-java-lang-illegalstateexception-the-resource-configuration-is-not-mo
Contributor guide
Assessment
This issue has not been assessed yet.