日期:2014-05-20  浏览次数:20643 次

关于servlet,web.xml,cxf的问题
用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)