“Unexpected invocation state 0” error in Wildfly

大憨熊 提交于 2019-12-11 06:15:42

问题


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:

  1. sfAdd is called
  2. slAdd is called and adds "S", return.
  3. print [S].
  4. add "Z", return.
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!