0

I have a simple RESTful Java web service...

@Service
@Path("/getAccountBalance")
public class GetAccountBalanceService {

@Autowired
private ILicenseService licenseService;

@GET
@Path("/{param}")
public Response provideService(@PathParam("param") String licenseUUID) {

    License license = this.licenseService.getByUUID(licenseUUID);

    String output = "Balance on the account : " + license.getBalanceValue();

    return Response.status(200).entity(output).build();

}

At first I was getting an error where the bean licenseService was null even though I am autowiring it. So based on advice from another post I swtiched to use the Spring servlet for jersey, thus in my web-xml I changed from com.sun.jersey.spi.container.servlet.ServletContainer to...

    <servlet>
      <servlet-name>jersey-servlet</servlet-name>
      <servlet-class>
             com.sun.jersey.spi.spring.container.servlet.SpringServlet
      </servlet-class>
      <init-param>
         <param-name>com.sun.jersey.config.property.packages</param-name>
         <param-value>com.freedomoss.crowdcontrol.api</param-value>
    </init-param>
      <load-on-startup>1</load-on-startup>

<servlet-mapping>
    <servlet-name>jersey-serlvet</servlet-name>
    <url-pattern>/service/*</url-pattern>
</servlet-mapping>

But now when I start Tomcat I am getting the error..

  Dec 19, 2014 12:13:13 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
 SEVERE: Parse error in application web.xml file at jndi:/localhost/mturk-web/WEB-INF/web.xml
 java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name jersey-serlvet

Why is this happening? As you can see there is a servlet defined with that name in web-xml. If there was something wrong with loading that servlet why don't the logs tell that story?

Thanks.

Community
  • 1
  • 1
AbuMariam
  • 3,282
  • 13
  • 49
  • 82

0 Answers0