Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services JBoss7上部署的SpringRESTAPI不可访问_Web Services_Spring_Rest_Jboss7.x - Fatal编程技术网

Web services JBoss7上部署的SpringRESTAPI不可访问

Web services JBoss7上部署的SpringRESTAPI不可访问,web-services,spring,rest,jboss7.x,Web Services,Spring,Rest,Jboss7.x,我正试图在JBoss7.1AS上部署基于spring的RESTWebServices。部署后,我无法通过rest客户端访问webservices。每次我都会遇到404错误。详情如下 <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <list>

我正试图在JBoss7.1AS上部署基于spring的RESTWebServices。部署后,我无法通过rest客户端访问webservices。每次我都会遇到404错误。详情如下

<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>
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>

如果有人能在这里帮助我,我会被告知这是我试图访问的URL添加控制器代码。此外,URL可能区分大小写,请确保路径的大小写与配置匹配。myrest->MyRestI已经添加了控制器代码。url区分大小写,请尝试使用url
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;
}
}