spring httpinvoker客户端找不到服务url
我对网络应用程序有以下配置。
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:mail-application-context.xml
....
</context-param>
....
<servlet>
<servlet-name>mailbox</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mailbox</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
mailbox-servlet.xml
<bean name="remoteProvisioningServiceImpl" class="pw.domain.service.RemoteProvisioningServiceImpl"/>
<bean name="/remote/domain/provision.htm" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service" ref="remoteProvisioningServiceImpl" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
我已经在 mail-application-context.xml 中正确配置了客户端,如下所示
<bean id="remoteProvisioningService1" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://${mailapp.dc.host.1.url}/remote/domain/provision.htm" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
<bean id="remoteProvisioningService2" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://${mailapp.dc.host.2.url}/remote/domain/provision.htm" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
。 .. 问题。 在适当的事件中,客户端通过 httpinvoker 工具正确调用服务,但响应是 http-404。在 nginx 日志中,我跟踪 spring 对 http://{host}/remote/domain/provision.htm 进行了 POST 调用。
问题:
我需要为 httpInvoker 位创建单独的应用程序上下文吗?我的意思是,我已经有了一个网络上下文来处理正常的网络操作。我是否需要在 web.xml 中为 httpInvoker 设施声明 {another-context} 并进行服务配置。在 {another-context}-servlet.xml 中定义?
如果不是 1,我的配置出了什么问题?
I have following configuration for the web application.
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:mail-application-context.xml
....
</context-param>
....
<servlet>
<servlet-name>mailbox</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mailbox</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
mailbox-servlet.xml
<bean name="remoteProvisioningServiceImpl" class="pw.domain.service.RemoteProvisioningServiceImpl"/>
<bean name="/remote/domain/provision.htm" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service" ref="remoteProvisioningServiceImpl" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
I have the clients configured properly, like following, in mail-application-context.xml
<bean id="remoteProvisioningService1" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://${mailapp.dc.host.1.url}/remote/domain/provision.htm" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
<bean id="remoteProvisioningService2" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://${mailapp.dc.host.2.url}/remote/domain/provision.htm" />
<property name="serviceInterface" value="pw.domain.service.RemoteProvisioningService" />
</bean>
And now... the problem.
On an appropriate event, the clients rightly call service through httpinvoker facility but the response is http-404. In nginx logs, i trace that spring makes a POST call to http://{host}/remote/domain/provision.htm.
Questions :
Do i need to create a separate app-context for httpInvoker bit? i mean, i already have one web context to deal with normal web operations. Do i need to declare {another-context} in web.xml for httpInvoker facility and having the service config. defined in {another-context}-servlet.xml?
If not 1, what is wrong in my configuration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
明白了..上面的问题 1 已附有答案。我需要为 http 调用工具创建一个单独的 Web 上下文才能工作。
这是因为,在我正常的 web 应用程序上下文(邮箱)中,我已经定义了 SimpleUrlHandlerMapping ,它将适当的 url 映射到控制器。在那里它找不到我想要定义的 http-invoker-serivce 的位置。当我分离网络上下文时,它就像一个魅力! :D
编码愉快! :)
Got it.. Question 1 above has the answer attached to it. I need to create a separate web context for http-invoking facility to work.
This is because, in my normal webapp context (mailbox), i already have defined SimpleUrlHandlerMapping which maps appropriate urls to controllers. There it doesnt find place for http-invoker-serivce i want to define. When i separated web contexts, it worked like a charm! :D
Happy coding! :)