我想通过一个对象到另一个类使用春天(我不知道我使用正确的术语,我很新春)这样说:春天错误 - springframework.web.client.HttpClientErrorException:404没有找到
TestServicesUtils.getTemplate().postForLocation(
"http://"
+ serverConfig
+ ":"
+ port
+ "/test/rest/TestResultService/insertTestResult/",
results);
当我运行它得到该行的程序,它trows的Exception
:
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.springframework.web.client.HttpClientErrorException: 404 Not Found
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76)
了试图连接到班级:
@Service("TestRestImpl")
@Path("TestResultService")
@Produces("application/json")
public class TesttRestImpl implements TestResultRest
{
...
@POST
@Override
@Path("/insertTestResult")
@Consumes("application/xml")
public void insertTestResult(TestRestCollection list) {
testresultservicedao.insertTestResult(list.getListOfResults());
}
}
路径似乎很好,我不知道为什么找不到方法。我需要注册路径吗?
你能告诉我们你的* web.xml *文件吗? – tmarwen 2014-09-02 09:13:12