[jboss-jira] [JBoss JIRA] (WFLY-9443) Random deploy error with @Startup @Singleton EJB
Martin Kouba (JIRA)
issues at jboss.org
Mon Oct 16 03:16:00 EDT 2017
[ https://issues.jboss.org/browse/WFLY-9443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477302#comment-13477302 ]
Martin Kouba commented on WFLY-9443:
------------------------------------
Hi Juan, I think this is a packaging/class loading problem. {{wftest-ejb.jar}} is a top-level EJB jar but can be also found in {{wftest-vaadin.war/WEB-INF/lib}}. By default, the classes in war can access the classes belonging to ejb jars (see also [EAR Class Loading|https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly#ClassLoadinginWildFly-EARClassLoading]) and so when performing injection on {{ar.com.zir.wftest.ejb.config.InitialConfig}} the container does not know which {{ar.com.zir.wftest.ejb.services.MovimientoService}} should be used.
I'm not sure about EJB but in CDI this is non-portable and often problematic: _"If a bean class is deployed in two different bean archives, non-portable behavior results. Portable applications must deploy each bean class in no more than one bean archive."_ (see also [12.1. Bean archives|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_archive])
So I think you should either try to change the scope of {{wftest-ejb}} dependency in war pom.xml to {{provided}} or change the {{<ear-subdeployments-isolated>}} value to {{true}}.
> Random deploy error with @Startup @Singleton EJB
> ------------------------------------------------
>
> Key: WFLY-9443
> URL: https://issues.jboss.org/browse/WFLY-9443
> Project: WildFly
> Issue Type: Bug
> Components: CDI / Weld, Class Loading, EJB
> Affects Versions: 11.0.0.CR1
> Environment: Wildfly 11.0CR1 + Vaadin 8.1.4
> Tested on Debian 9.1 and Windows 10
> Reporter: Juan Martin Runge
> Assignee: Martin Kouba
> Labels: regression
> Attachments: error.log, success.log, wftest-ear-0.1.0.ear.tar.gz, wftest.tar.gz
>
>
> Simple EAR project with an EJB Module and a WAR Module. War uses Vaadin (think is not relevant but mention it anyway). On the EJB Module I have a @Singleton @Startup bean which has injected a at LocalBean @Stateless bean via @Inject annotation (tested with @EJB annotation with same results). The UI on the WAR side also calls this @LocalBean @Stateless bean. Randomly, when I deploy, redeploy or restart the server, the EAR refuses to deploy do java.lang.IllegalStateException because it cannot inject the @Stateless bean inside the @Startup bean.
> Attached sample app, project, log with error and log with success.
> If you check the success log, you will see the @Startup @Singleton bean gets instanciated twice.. Quite strange.
> Also, this didnt happened with Wildfly 9 (same app deployed perfectly)
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list