WELD-000227: Bean identifier index inconsistency detected - the distributed container probably doesn't work with identical applications
Asked Answered
C

4

8

I am using tomcat v7 with Weld v2.2.9.Final and myFaces v2.2.7 after restart server in eclipse IDE and reload page I getting this error. I have no clue why this error appear to me. It has to be connected with http request or so. If I open close browser it start work.

SEVERE: Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably doesn't work with identical applications
    at org.jboss.weld.context.http.HttpSessionContextImpl.checkBeanIdentifierIndexConsistency(HttpSessionContextImpl.java:88)
    at org.jboss.weld.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:42)
    at org.jboss.weld.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:19)
    at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:217)
    at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:160)
    at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.requestInitialized(ForwardingServletListener.java:42)
    at org.apache.catalina.core.StandardContext.fireRequestInitEvent(StandardContext.java:6189)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Censorious answered 25/2, 2015 at 7:47 Comment(1)
T
15

org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably doesn't work with identical applications

This exception will be thrown when a Weld/CDI proxy instance of a serializable class has incompatibly changed after deserialization (e.g. after Tomcat restart). Most likely you have during developing edited a serializable session or view scoped managed bean while not having touched the serialVersionUID. Or, you have added/updated/removed a CDI-associated library. In case you're using Tomcat in Eclipse, rightclick the Tomcat server entry in Eclipse's Servers view and choose Clean Tomcat Work Directory. This will wipe out serialized sessions and thus also solve this exception.

Everytime when you make incompatible changes in a serializable class, such as adding new instance fields, then you need to re-generate the serialVersionUID value (in case you're IDE-generating the value), or to increment its value with 1 (in case you're using a default 1L).

This is thus not necessarily a bug in Weld, but it should in my opinion just have discarded the incompatible proxy instance, created a new one and printed a warning message instead of blocking the request altogether with this exception.

If you're actually busy developing and facing this exception everytime, consider turning off session persistence in the server. How to do this depends on the server used. In your case of Tomcat 7, refer section "Disable Session Persistence" in the documentation of The Manager Component.

The specific message "the distributed container probably doesn't work with identical applications" is by the way referring to the possible case when you're running the web application in a clustered environment with session sharing (e.g. cloud) whereby apparently at least one server has a different version of the web application. Such situation will in production cause this exception.

See also:

Townspeople answered 30/4, 2015 at 10:5 Comment(1)
The problem is that I did not make any changes in classes. Just restart server and this error appear.Censorious
Z
2

That's a bug in Weld. https://issues.jboss.org/browse/WELD-1887

You should be able to work around by disabling session passivation on shutdown in Tomcat.

Ziegfeld answered 5/3, 2015 at 16:51 Comment(1)
and the comment "... so that users are not confused." is all too true.Siddons
G
2

It may be over two years since the last answer was posted, but this may also happen if you forget to implement Serializable in an Entity class.

(Java 8, Glassfish 4)

@Entity
@Table(name="questions")
public class Question { 
  ......
}

Error org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably doesn't work with identical applications

@Entity
@Table(name="questions")
public class Question implements Serializable { 
  ......
}
Gratin answered 8/8, 2017 at 5:53 Comment(0)
M
1

Delete your browser cookies and reload the page.

Madeleinemadelena answered 18/6, 2021 at 1:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.