On JBoss 5.1.0, when I have an EJB3 stateless session bean exposed as a web service using the @WebService annotation in a jar it gets deployed successfully to the following url: http://localhost:8080/SessionTest/MyBean
However, if I package the ejb jar in an EAR file it get's deployed to the following url: http://localhost:8080/TestEAR-SessionTest/MyBean
i.e. E开发者_Go百科ar name - jar name as the context instead of just jar name.
Is there a way to specify the context that should be used (i.e. SessionTest) so that it is consistent regardless of whether it is deployed as a standalone ebj jar or in an EAR?
You can use @WebContext( contextRoot = "/webservices" )
to set the context root to a fixed location.
There are more options, that are described in the FAQ document.
精彩评论