用cxf发布服务,在web.xml中配置了两个cxf的servlet
<servlet>
<servlet-name>CXFServlet1</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet1</servlet-name>
<url-pattern>/Aplace/*</url-pattern>
</servlet-mapping>
和
<servlet>
<servlet-name>CXFServlet2</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet2</servlet-name>
<url-pattern>/Bplace/*</url-pattern>
</servlet-mapping>
然后在spring的配置中配置了:
<jaxws:endpoint id="mycxf" implementor="#myService" address="/myService" />
这时,启动tomcat,如果我先输入:http://localhost:8080/myApp/Aplace/myService?wsdl,可以显示,然后在输入
http://localhost:8080/myApp/Bplace/myService?wsdl就无法显示。反之亦然,总之就是先启动那个,另一个就无法显示。
这是为什么啊?
ps:无法显示时,tomcat报错:
警告: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation: (HTTP GET PATH_INFO: /myApp/myService)
at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:83)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:392)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:170)
at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
相关推荐
2、把web.xml里的spring的监听器注释掉,保证WEB-INF下有cxf-servlet.xml,然后发布到WEB服务器即可 3、web.xml里配置spring监听器,及其加载的beans.xml,把cxf-servlet.xml删掉,发布到WEB服务器即可,注意这种方式...
geronimo-servlet_2.5_spec-1.1.2.jar geronimo-stax-api_1.0_spec-1.0.1.jar geronimo-ws-metadata_2.0_spec-1.1.3.jar h2-1.3.169.jar isorelax-20030108.jar jaxb-api-2.2.6.jar jaxb-impl-2.2.5.jar jaxb-xjc-...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/rest/* </servlet-...
<import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <cxf:bus> <cxf...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/* </...
在实际使用中,开发者可能还需要配置CXF的相关XML配置文件(如cxf.xml或cxf-servlet.xml),以定制服务行为和设置。此外,通过Maven或Gradle等构建工具,可以更方便地管理和引入CXF的依赖。 总之,Apache CXF 2.7.5...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFService</servlet-name> <url-pattern>/* </servlet-mapping> 3....
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> ... ``` 在上面的代码中,我们定义了一个CXFServlet来处理WebService请求,并配置了相关的参数。 使用Apache CXF和...
5. 配置CXF:在`src/main/webapp/WEB-INF/web.xml`中配置CXF Servlet。 6. 打包部署:使用Maven的`package`目标打包为WAR文件,然后部署到应用服务器上。 ### `test-cxf`项目分析 在提供的`test-cxf`压缩包中,很...
- **Servlet配置**:在`web.xml`中配置CXF Servlet以及其映射规则。这通常包括对CXFNonSpringServlet的配置。 #### 三、发布服务 ##### 1. Endpoint配置 - **发布方式**:在`WebServiceServlet`类的`loadBus`方法...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/* </...
3. 配置CXF:在Web应用的配置文件(如web.xml)中,配置CXF的Servlet,指定服务接口和实现的位置,以及服务发布到的URL。 4. 编译和部署:编译项目,将结果部署到Web服务器,如Tomcat或Jetty。 二、CXF客户端调用 ...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/* </...
<bean id="myServletTransport" class="org.apache.cxf.transport.servlet.CXFServlet"> <property name="bus" ref="cxf"/> <bean class="org.springframework.web.servlet.mvc.ServletForwardingController"> ...
- 在其中配置context-param来指定Spring框架的配置文件位置,添加servlet和servlet-mapping来指定CXF Servlet的名称、类和URL映射。 6. **配置service-beans.xml**: - 在WebContent/WEB-INF目录下创建service-...
编辑`WebContent/WEB-INF/web.xml`文件,添加CXF的相关配置。`<context-param>`指定Spring配置的位置,`<listener>`加载Spring上下文,`<servlet>`和`<servlet-mapping>`配置CXF的Servlet,处理HTTP请求。`...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/* </...
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1 </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/services/* </...
5. 配置Web应用的web.xml,设置CXF的Servlet映射和上下文初始化参数。 在提供的"springmvc_cxf_spring_hibernate包"中,我们可以推测这包含了Spring MVC、CXF和Hibernate的相关配置和实现。可能的文件结构可能包括...