【发布时间】:2014-09-01 14:01:21
【问题描述】:
我正在尝试使用 Spring 将对象传递给另一个类(我不确定我使用的术语是否正确,我对 Spring很陌生>) 这样:
TestServicesUtils.getTemplate().postForLocation(
"http://"
+ serverConfig
+ ":"
+ port
+ "/test/rest/TestResultService/insertTestResult/",
results);
当我运行程序时,它会到达该行并抛出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 文件吗?
标签: java spring maven weblogic