- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有以下cxf配置文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<context:component-scan base-package="test.stub.rest" />
<!-- Enable CXF logging -->
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<!-- CXF Services -->
<jaxrs:server id="test" address="/stub/postUrl">
<jaxrs:serviceBeans>
<ref bean="testClass" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="testClass" class="test.stub.rest.TestClass">
</bean>
</beans>
网络.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Stubby CXF</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/stub-cxf-applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
服务等级
@Path("/test")
public class TestService {
protected final Logger log = LoggerFactory.getLogger(TestService.class);
@Path("/hello")
@Produces("text/html")
public String hello(@RequestBody String payload) {
return "OK";
}
}
现在,每当我调用此服务时,它都会转到 hello 方法,从该方法返回字符串“OK”后,它会给出以下错误
13:11:35.142 [http-bio-8080-exec-3] WARN o.a.cxf.jaxrs.utils.ResourceUtils - No resource methods have been found for resource class java.lang.String
13:11:35.142 [http-bio-8080-exec-3] ERROR org.apache.cxf.jaxrs.JAXRSInvoker - No subresource locator found for path /
13:11:35.142 [http-bio-8080-exec-3] WARN o.a.c.j.i.WebApplicationExceptionMapper - javax.ws.rs.NotFoundException
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:245)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:102)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:205)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
13:11:35.142 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.interceptor.OutgoingChainInterceptor@57fc218b
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by bus: [org.apache.cxf.ws.policy.PolicyOutInterceptor@687bb597, org.apache.cxf.interceptor.LoggingOutInterceptor@11cf0218]
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by service: []
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by endpoint: [org.apache.cxf.interceptor.MessageSenderInterceptor@6cc21725]
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.c.i.OutgoingChainInterceptor - Interceptors contributed by binding: [org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor@3a7db5eb]
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Chain org.apache.cxf.phase.PhaseInterceptorChain@59741d5f was created. Current flow:
setup [PolicyOutInterceptor]
prepare-send [MessageSenderInterceptor]
pre-stream [LoggingOutInterceptor]
marshal [JAXRSOutInterceptor]
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.ws.policy.PolicyOutInterceptor@687bb597
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.c.ws.policy.PolicyOutInterceptor - No binding operation info.
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@6cc21725
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@275146fe to phase prepare-send-ending
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Chain org.apache.cxf.phase.PhaseInterceptorChain@59741d5f was modified. Current flow:
setup [PolicyOutInterceptor]
prepare-send [MessageSenderInterceptor]
pre-stream [LoggingOutInterceptor]
marshal [JAXRSOutInterceptor]
prepare-send-ending [MessageSenderEndingInterceptor]
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.interceptor.LoggingOutInterceptor@11cf0218
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor@3a7db5eb
13:11:35.143 [http-bio-8080-exec-3] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@275146fe
13:11:35.144 [http-bio-8080-exec-3] INFO o.a.c.i.LoggingOutInterceptor - Outbound Message
---------------------------
ID: 2
Response-Code: 404
Content-Type:
Headers: {Date=[Fri, 27 Nov 2015 07:41:35 GMT], Content-Length=[0]}
--------------------------------------
13:11:35.144 [http-bio-8080-exec-3] DEBUG o.a.c.t.servlet.ServletController - Finished servicing http request on thread: Thread[http-bio-8080-exec-3,5,main]
我做错了什么吗?我正在使用 apache-cxf、spring、jas-rs。如果在其他地方回答了这个问题,请告诉我。
最佳答案
您需要一个 HTTP 方法,例如 @GET
:
@GET
@Path("/hello")
@Produces("text/html")
public String hello(@RequestBody String payload) {
return "OK";
}
关于java - Jax-rs apache-cxf :No resource methods have been found for resource class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33952729/
这段代码无法编译: for(vector::iterator it = shapes.end(); it >= shapes.begin(); --it){ *it.update(1,1);
我一直在研究 Common Lisp 对象协议(protocol) (CLOS),我遇到了一个疑问。 有人知道 CLOS 中的“标准方法组合”和“简单方法组合”是什么意思吗? 在“简单方法组合”中,“
在Rust上对值调用方法之间是否有任何区别,如下所示: struct A { e: u32 } impl A { fn show(&self) { println!("{}",
我在一些 StackOverflow 答案中看到了术语抽象方法、具体方法和默认方法的“不同”定义。 Java 语言规范给出的真正定义是什么?请在您的答案中包含相关的支持 JLS 引用资料。 最佳答案
如果method = "post",如何使rest[method]扩展为rest.post(uri, body).then(. .? function proxyUrl() { return
这个问题在这里已经有了答案: Method cannot be translated into a store expression (1 个回答) 关闭 9 年前。 我有一个问题。我在 Visua
它们各自的优缺点是什么? 接口(interface)方法 虚方法 抽象方法 什么时候应该选择什么?做出这一决定时应牢记哪些要点? 最佳答案 虚拟和抽象几乎是一样的。虚方法在基类中有一个可以选择被覆盖的
我在 Meteor.js 上的那段代码出错: 客户端 : Meteor.call("logUser", function(myvar){ console.log("le c
运行代码时出现以下错误 Line: 18 illegal start of expression Line: 18 ';' expected 这意味着第 18 行中有代码写得不正确(public bo
如果可能的话,如何从另一个方法的返回中调用一个方法? 例如…… class Example { public static void main(String[] args) {
当遍历指针的 vector (或其他容器)时,使用以下优势和/或优势之间是否有任何区别: for (it = v.begin(); it != v.end(); ++it) { (*it)->
在从带有参数的 void 方法打印值或将值返回给方法调用者并在方法调用者中打印它之间,哪个被认为是更好的做法(如果有的话)?比如第一个代码摘录是前者,第二个代码摘录是后者: public static
考虑这个例子https://codesandbox.io/s/1yvp4zz5x7?module=%2Fsrc%2FApp.vue Greet1 Greet2
晚上好, 我刚开始使用 Microsoft.Contracts(最新版本)并将其插入示例界面之上,现在它看起来像这样: namespace iRMA2.Core.Interfaces { us
我是 Laravel 4 的新手,并试图弄清楚为什么我收到一个错误,说 Method [show] 不存在。 我没有名为“show”的方法,只能想象这是一个内部的 Laravel 方法,但我不知道如何
有人可以向我解释一下当我们进行下一次返回时“或”(||) 是什么意思吗? 我的意思是这行: 返回封面(值,金额 - 值 [索引],索引 + 1)||覆盖(值、金额、索引 + 1); public st
这个问题已经有答案了: Why doesn't the post increment operator work on a method that returns an int? (11 个回答) 已
我很难理解 jQuery 的 $.method() 和 $(selector).method 之间的区别。 $.method() 实际适用于 DOM 中的哪些元素?如果有人能帮助解释这两种说法之间的区
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 5 年前。 Improve t
////////////////////////////////////////////////////////////////////////////// // 3 construct
我是一名优秀的程序员,十分优秀!