问题
I created a small example that demonstrates the error.
A stateful bean holds a list as its state and injects a stateless bean:
@Stateful
@RequestScoped
public class StatefulBean {
@Inject
StatelessBean slsb;
@Getter // public list getter
private List<String> list = new ArrayList<>();
public List<String> sfAdd() {
slsb.slAdd();
System.out.println(list);
list.add("Z");
return list;
}
}
The stateless bean manipulates the state of the stateful bean by injection:
@Stateless
public class StatelessBean {
@Inject
StatefulBean sfsb;
public void slAdd() {
sfsb.getList().add("S");
}
}
The call System.out.println(sfsb.sfAdd());
is made in a JAXRS GET method. The steps of the invocation that I expected are are:
sfAdd
is calledslAdd
is called and adds"S"
, return.- print
[S]
. - add
"Z"
, return. - print
[S, Z]
.
Which in general is what happens, but the ouput gives an error message also:
INFO [stdout] (default task-2) [S]
ERROR [org.jboss.as.ejb3] (default task-2) WFLYEJB0487: Unexpected invocation state 0
INFO [stdout] (default task-2) [S, Z]
I don't understand what is WFLYEJB0487: Unexpected invocation state 0
, why it happens and what I'm supposed to do about it. The message is printed between steps 3 and 5. Google found only https://developer.jboss.org/thread/272767 but it's not helpful.
I also found out that removing @Stateful
from StatefulBean
causes the error to disappear. Wildfly 10.1, JavaEE 7.
来源:https://stackoverflow.com/questions/45601299/unexpected-invocation-state-0-error-in-wildfly