2012-12-11 64 views
0

我想在AXIS2框架上編寫的Web服務中使用spring web範圍的bean。 如何配置它? Axis2和Spring文檔彼此不一致。春季網絡範圍的bean和axis2

Axis2 documentation says

For the purpose of this example, we'll configure Spring via a WAR file's web.xml. Let's add a context-param and a listener: 
<listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 
<context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/applicationContext.xml</param-value> 
</context-param> 

Spring documentation says

When using a Servlet 2.4+ web container, with requests processed outside of Spring's DispatcherServlet (e.g. when using JSF or Struts), you need to add the following javax.servlet.ServletRequestListener to the declarations in your web application's 'web.xml' file. 
<web-app> 
    ... 
    <listener> 
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
    </listener> 
    ... 
</web-app> 

當我使用的Axis2推薦的ContextLoaderListener與Spring Web作用範圍的豆類我上部署

java.lang.IllegalStateException:未找到線程綁定請求:是否 你指的請求屬性的實際網絡之外請求, 或處理原始接收線程之外的請求?如果 你實際上是一個Web請求內運行,並仍收到此消息 ,你的代碼可能運行 DispatcherServlet的/ DispatcherPortlet的以外:在這種情況下,使用 RequestContextListener或RequestContextFilter兩個揭露當前 請求。

當我使用Spring的特別建議RequestContextListener我得到了正在運行的Web服務上請求故障:

 <faultstring>The SERVICE_OBJECT_SUPPLIER parameter is not specified.</faultstring> 

換句話說:如何與Spring和RequestContextListener配置AXIS2?

+0

此處也開始討論:https://issues.apache.org/jira/browse/AXIS2-5467 – popalka

回答