[jboss-jira] [JBoss JIRA] (JBAS-9451) EJBs get shared environment context instead of isolated context
Leonid Kosmylev (Created) (JIRA)
jira-events at lists.jboss.org
Wed Nov 9 09:14:45 EST 2011
EJBs get shared environment context instead of isolated context
----------------------------------------------------------------
Key: JBAS-9451
URL: https://issues.jboss.org/browse/JBAS-9451
Project: Legacy JBoss Application Server 6
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Naming
Affects Versions: 6.1.0
Reporter: Leonid Kosmylev
Assignee: John Bailey
JBoss wrongly uses a shared environment for all EJBs in a WAR module or in an EJB module if there are JAX-WS annotations on some classes.
The problem can be reproduced with the help of the attached application. Steps to reproduce:
1. Build the application and deploy the jar into JBoss.
2. Deploy file ectx-jboss-beans.xml. Observe the following (expected!) output in the console:
13:10:27,743 INFO [STDOUT] Sc1: [value1]
13:10:29,960 INFO [STDOUT] Sc2: [value2]
3. Undeploy ectx-jboss-beans.xml and the application jar.
4. Modify Sc2Bean.java, uncomment @WebService annotation.
5. Build the application and deploy the modified jar into JBoss.
6. Deploy file ectx-jboss-beans.xml. Observe the following (wrong!) output in the console:
13:15:13,001 INFO [STDOUT] Sc1: [value2]
13:15:14,753 INFO [STDOUT] Sc2: [value2]
There is an additional problem that manifests itself at undeploy of the application with the shared environment context: there are multiple exceptions like the following
14:13:18,965 WARN [org.jboss.kernel.plugins.dependency.StartStopLifecycleAction] Error during stop for jboss-switchboard:appName=ectx,module=ectx,name=Sc2Bean: javax.naming.NameNotFoundException: ORB not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
at org.jnp.server.NamingServer.unbind(NamingServer.java:349) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.unbind(NamingContext.java:873) [:5.0.5.Final]
at org.jboss.util.naming.Util.unbind(Util.java:151) [jboss-common-core.jar:2.2.17.GA]
at org.jboss.util.naming.Util.unbind(Util.java:141) [jboss-common-core.jar:2.2.17.GA]
at org.jboss.switchboard.mc.SwitchBoardImpl.unbindFromRelevantContext(SwitchBoardImpl.java:303) [:1.0.0-alpha-15]
at org.jboss.switchboard.mc.SwitchBoardImpl.stop(SwitchBoardImpl.java:102) [:1.0.0-alpha-15]
...
The root cause of the problems is in class org.jboss.reloaded.naming.deployers.ComponentNamingDeployer, line 63:
// If the deployment is a web module, then java:comp == java:module
// (See JavaEE6 Spec, section EE.5.2.2). So we create a MCJavaEEComponent,
// which uses the same context as its parent JavaEEModule
boolean useJavaModuleContext = this.informer.belongsToWebModule(unit);
Why this is wrong? For the following reasons:
1. I do not think that the mere presence of @WS annotations turns an EJB module into a web module. Yes, some web infrastructure is needed to provide HTTP transport, but this is an implementation detail.
2. Next, "JavaEE6 Spec, section EE.5.2.2" says: "For historical reasons, the java:comp namespace is shared by all components in a web module. To preserve compatibility, this specification doesn't change that.". The thing is: historically it was not possible to define EJBs in a web module, at least, not according to the previous JavaEE specifications. So historical reasons are applied only for components that historically could be deployed in a web module.
3. Even more, "historically" JavaEE developers expect that EJBs do NOT share their java:comp namespace.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list