Jboss 7.1 AS に Spring ベースの REST Web サービスをデプロイしようとしています。展開後、残りのクライアントを介して Web サービスにアクセスできません。404エラーが発生するたびに。以下は詳細です。
rest-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<context:component-scan base-package="com.rest.controller"/>
<!-- To enable @RequestMapping process on type level and method level -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="marshallingConverter" />
<!--
<ref bean="atomConverter" />
-->
<ref bean="jsonConverter" />
</list>
</property>
</bean>
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.rest.Model1</value>
<value>com.rest.Model1List</value>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml"/>
<entry key="html" value="text/html"/>
<entry key="json" value="application/json" />
</map>
</property>
<property name="defaultContentType" value="application/xml" />
</bean>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<display-name>TestRestProject</display-name>
<!--
Beans in these files will makeup the configuration of the root web
application context
-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context.xml</param-value>
</context-param>
<!--
Bootstraps the root web application context before servlet
initialization
-->
<listener>
<listener- class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
Deploys the 'transactions' dispatcher servlet whose configuration resides
in /WEB-INF/accounts-servlet-config.xml
-->
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<!-- <init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
<param-value>/WEB-INF/transactions-servlet-config.xml</param-value>
</init-param> -->
</servlet>
<!-- Maps all URLs starting with /app to the 'accounts' servlet. -->
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/myrest/*</url-pattern>
</servlet-mapping>
</web-app>
RestController.java
package com.rest.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/myrest")
public class RestController {
@RequestMapping(value="/getTestMethod", method=RequestMethod.GET)
public @ResponseBody String getTestMethod(@PathVariable String param1,@PathVariable String param2){
String returnValue = "";
returnValue = "This is from the Controller" + param1 + param2;
return returnValue;
}
}