我想通過一個對象到另一個類使用春天(我不知道我使用正確的術語,我很新春)這樣說:春天錯誤 - 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