title: Is there a generic way to specify the context-root for a WebService?
body: <p>I'm new to writing web services, and am struggling with understanding how to specify the context root.</p>
  
  <p>I've got my class annotated with</p>
  
  <pre><code>@Service 
  @javax.jws.WebService(endpointInterface=  "com.domain.clientservices.lendingsimulation.model.v1.LendingSimulationServicePortType", targetNamespace="http://www.domain.com/ClientServices/LendingSimulation/V1.2", serviceName="LendingSimulationService", portName="LendingSimulationServicePort")
  </code></pre>
  
  <p>but I am not sure how to configure the context-root/path for it.  I read that I could configure it as a servlet  in web.xml, but that seems to be the case for a web service that is not annotate.  Am I wrong?  I have tried the following configuration in web.xml:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;description&gt;This is the description for the LendingSimulation Service&lt;/description&gt;
      &lt;display-name&gt;Lending Simulation Service&lt;/display-name&gt;
      &lt;servlet-name&gt;LendingSimulationService&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.domain.clientservices.lendingsimulation.service.LendingSimulationServiceImpl&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;LendingSimulationService&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/WebService&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>however, when I launch in JBoss, I get an error msg:</p>
  
  <pre><code>17:39:33,710 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/LendingSimulationService].[LendingSimulationService]] (http--127.0.0.1-8080-2) Allocate exception for servlet LendingSimulationService: java.lang.ClassCastException: com.domain.clientservices.lendingsimulation.service.LendingSimulationServiceImpl incompatible with javax.servlet.Servlet
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1156) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
  ... (omitted for brevity)
  </code></pre>
  
  <p>I've read that I can configure jboss-web.xml specifically, but I assume there is a more generic way of doing this that can be applied to all app servers - isn't there?  Or must I configure the service independently, depending on the AS that I am deploying to (ie: one way for Tomcat, one way for GlassFish, one way for JBoss, one way for WebSphere, etc...).  </p>
  
  <p>Is there an annotation I can use to specify my path for the web-service?  Or a config param in the web.xml file?</p>
  
  <p>Thanks!</p>
  
  <p>Eric</p>