I think context-root refers to the directory web pages are served from.
JBoss does have a way to relocate: http://docs.jboss.org/ejb3/app-server/tutorial/jndibinding/jndi.html
Also look at: http://community.jboss.org/thread/120550
The pb with LocalBinding it's that it's not portable. We're using GF Embedded in our unit tests.
I'm not sure the org.jboss.naming.NamingAlias can alias the jndi name in the global scope.
There must be an easier way. Could ejb-jar.xml be the solution?
When I deploy this war, AS binds the bean to java:module/MyBean and java:global/myapp-1.0.0-SNAPSHOT/MyBean.
So far so good, but I'd like to map the bean in the global scope as java:global/myapp/MyBean
That syntax is mandated by the EJB3.1 spec. The myapp-1.0.0-SNAPSHOT is the "module" name and it can be overriden from within the module deployment descriptor. In this case it is the ejb-jar.xml. So something like this in the ejb-jar.xml should do it:
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1"> <module-name>myapp</module-name> </ejb-jar>
I tried this solution, but then I hit this bug:
https://issues.jboss.org/browse/JBAS-8846 ("JEE 6 application gives errors when deploying having ejb-jar.xml contain module name tag")
and all my EJB's fail to deploy:
Deployment "jboss.ejb3:application=webapp-1.0-SNAPSHOT,module=webapp-1.0-SNAPSHOT,component=DummyEJB,service=EjbEncFactory" is missing the following dependencies:
Dependency "jboss.naming:application=webapp-1.0-SNAPSHOT,component=DummyEJB,module=webapp-1.0-SNAPSHOT" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'jboss.naming:application=webapp-1.0-SNAPSHOT,component=DummyEJB,module=webapp-1.0-SNAPSHOT' **")
A lot of the AS 6 issues aren't going to be fixed by Redhat. Some have been closed due to lack of interest.
You *can* create patches for things like this. Check out the source and get hacking.