[
https://issues.jboss.org/browse/WFLY-5097?page=com.atlassian.jira.plugin....
]
Yeray Santana Borges edited comment on WFLY-5097 at 2/13/16 3:49 PM:
---------------------------------------------------------------------
After checking this issue, the error is generated because @Singleton and @Stateful were
used in the same EJB class.
In the attached test file (singleton.zip), the class ApplicationStoreBean.java was
annotated with @Singleton and @Stateful. This is a violation of EJB specification as
described in section 4.1:
A session bean may be either:
* stateless—the session bean instances contain no conversational state between methods;
any instance can be used for any client.
* stateful—the session bean instances contain conversational state which must be retained
across methods and transactions.
* singleton—a single session bean instance is shared between clients and supports
concurrent access.
If @Stateless annotation is removed, the issue is not reproduced.
After discuss this issue in hipChap, it makes sense adapt the server to avoid these kind
of deployments if the point 4.1 is violated.
was (Author: yersan):
After checking this issue, the error is generated because @Singleton and @Stateful was
used tin the same EJB class.
In the attached test file (singleton.zip) the class ApplicationStoreBean.java was
annotated with @Singleton and @Stateful. This is a violation of EJB specification as
described in section 4.1:
A session bean may be either:
* stateless—the session bean instances contain no conversational state between methods;
any instance can be used for any client.
* stateful—the session bean instances contain conversational state which must be retained
across methods and transactions.
* singleton—a single session bean instance is shared between clients and supports
concurrent access.
If @Stateless annotation is removed, the issue is not reproducced.
After discuss this issue in hipChap, it makes sense adapt the server to avoid these kind
of deployments if the point 4.1 is violated.
@Startup @Singleton Beans Constructed Multiple Times
----------------------------------------------------
Key: WFLY-5097
URL:
https://issues.jboss.org/browse/WFLY-5097
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 9.0.1.Final
Environment: All
Reporter: Davide Crudo
Attachments: singleton.zip
When using @Startup and/or @Singleton to start a Bean on server startup, everytime a
method is accessed or the bean is injected with @EJB, both Constructor and @Postconstruct
are executed.
This happens multiple times, each time any component uses the Singleton bean.
This seems similar to an issue reported for JBOSS AS 7.x (see forum link reference below)
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)