I guess this is a bug since if I use jbossws-1.2.0.SP1 I do not get this error. The jira bug on this is still open so I guess I'll just use 1.2.0 until it is resolved.
If this isn't a bug, though, someone please let me know:)
If I remember correctly, the context root comes from the jar file name. Are both of your jar files named the same?
It would appear that the standards define how the default context root is defined, but always leave it up to the implementation to specify alternate context root (hence the context-root entry in the jboss-web.xml file used in war files).
Of course, I could always be wrong.
The two webservices are in the same package and packaged in the same jar. It seems odd that things work fine in 1.2.0.SP1 but not 1.2.1.GA.
Our jar is named "beans.jar" and adding
to all of the classes seems to work.
I also can't understand what caused them to change the behavior in 1.2.1GA.
Does anybody know how to specify the context root in an XML file?
Also, my webservices jar is locate din an ear file if that matters at all.
Secondly, I'm not sure why I would need to use @WebContext in order to get this to work in 1.2.1.GA. All the standard examples I see do not mentioning using @WebContext - which if I understand correctly is not even part of the EJB3 Spec but is a JBoss specific annotation.
If you check out the webservice example for jboss provided after downloading the examples here
(unzip and then in the docs/tutorials there is a webservice example),
You'll see there example does not use the @WebContext notation.
Thanks for the valuable discussion. I will try to explain what changes between 1.2.0 and 1.2.1 are causing the problems you encounter.
1.) For EJB3 deployments we need to create a web app for HTTP invocations (obviously)
2.) EJB's don't contain web context information, so we derive it automagically.
3.) Until 1.2.0 the context name was derived from the ear/jar name.
4.) This changed with 1.2.1 to an algorithm that derives it from the bean class name
So what's happening when you deploy a EJB3 jar that contains multiple beans?
The default algorithm derives different context names for each bean in this deployment, which in turn we cannot use to setup the HTTP endpoint and thus throw an exception.
This also explains why the following did work:
Unfortunately this is left out in the specs and thus has been changed many times.
Until we a have a definite solution i suggest you refer to the @WebContext annotation, even though it's not the most elegant solution.
Thanks Heiko for the information. My only question now (and pardon if this is a very 'newbie' question) but what would I set the web context to? In other words, do I need to make sure the various webapp wars that might be in the ear all have web.xml definitions that point to the ejbs so that I can create a context for the ejbs through the web.xml? If so, this seems like a lot of extra work.
I guess I'm just confused how I know what @WebContext to use for the ejbs? I could have several wars that all have their own web context. I would think the ejb context would be independent of those contexts, but just giving it an arbitrary context doesn't help in regard to having the wsdl being located.
If someone could provide a simple example of what to set this @WebContext to I'd appreciate. I'm sure I'm missing something simple.
Regular war's are not touched by this probelm. Just make sure all EJB's within a jar point to the same web context thriugh something like:
Thanks Heiko. That worked great. Not sure what I was doing wrong earlier when I had tried that (using @WebContext) and wasn't able to find the wsdl. It's working fine now, so I'll chalk my mistakes up to typical stupid human error:)
Is there an XML syntax that can override the WebContext or we must use the annotation?
Rick, can you confirm that your question in JIRA JBWS-1622 is solved (for you, but maybe not for the reporter of that issue) by Heiko's replies?
And for the archives: @WebContext is org.jboss.ws.annotation.WebContext as found in jbossws-core.jar
Even when deploying only a single web service, this error may also be caused by some left-overs after refactoring without properly cleaning up.
I changed the name of my service using Eclipse, which left the old compiled classes in various exploded archive folders. Those were then still copied to, and loaded by, JBoss. This resulted in multiple services (same implementation with different class names) within the same application, and thus yielding the "org.jboss.ws.WSException: Multiple context root not supported" error.
My stupid mistake, of course...
Can anyone provide the EJB 2.1 equivalent to:
I've seen in the FAQ this bit of text:
Use the explicit context root from webservices/context-root
Can be set in jboss.xml and is only relevant for EJB endpoints.
Can anyone clarify which file the webservices/context-root is referring to and the exact syntax?
Any help would be appreciated.
Sorry I am so dense, but where IS WebContext, I would like to try and
use it to solve an issue I am having with multiple Context in deploying multiple Web Services, and cannot find it in any Web Services JBOSS jar