问题
Some back story: I'm in the process of setting up a test environment of an old(er) system (2008). The system is currently in working condition, but we need to start testing it before upgrading. There is a front-end proxy application interacting through Spring (2.5.4) HTTP invoking with a back-end application.
I have the source code and spring related dependencies in place, and I'm able to compile the system through build scripts shipped with the source code. I have set up a local VM acting as my back-end, and the applications are deployed and running on JBoss (4.2.2) on both sides.
I am able to run Soap requests to the proxy, authentication is working, so everything seems to be correct.
Now, the communication between applications through HTTP invoking does not work when I try to reach my servers services.
Here is my setup on the server side:
This creates a bean that holds all of my related services
<bean id="onlineService" class="my.own.class.OnlineService">
<property name="orderService" ref="orderService" />
<property name="invalidateService" ref="invalidateService" />
<property name="checkStatusService" ref="checkStatusService" />
</bean>
Exposing service using http invoker
<bean name="onlineServiceHttp"
class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service" ref="onlineService" />
<property name="serviceInterface" value="my.own.interface.OnlineServiceI" />
</bean>
<bean id="simpleUrlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/onlineServiceHttp">onlineServiceHttp</prop>
</props>
</property>
</bean>
This is my client setup:
<!-- Online Service using HTTP Invoker -->
<bean id="onlineservice"
class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl"
value="http://${ONLINE_SERVICES_HOST}:8080/vmosvcs/vmoservice/onlineServiceHttp" />
<property name="serviceInterface" value="my.own.interface.OnlineServiceI" />
</bean>
Finally, create my beans targeted through Soap on my client (the proxy application)
<bean id="orderMarshallEndpoint" class="my.proxy.endpoints.OrderMarshallEndpoint">
<property name="service" ref="onlineservice" />
</bean>
<bean id="invalidateMarshallEndpoint" class="my.proxy.endpoints.InvalidateMarshallEndpoint">
<property name="service" ref="onlineservice" />
</bean>
<bean id="checkStatusMarshallEndpoint" class="my.proxy.endpoints.CheckStatusMarshallEndpoint">
<property name="service" ref="onlineservice" />
</bean>
When I send a Soap request towards for example checkStatusMarshallEndpoint, I get the following error on the client:
CustomAuthenticationManager 16 -----New Request in Proxy -----
CustomAuthenticationManager 17 Request sent by username :peter:
CustomAuthenticationManager 19 Authentication Result:true:
CheckStatusMarshallEndpoint 22 Check Status request received
OnlineEndpoint 52 The authenticated partnerId is :imran
CheckStatusMarshallEndpoint 27 The request is :: serial Number :null: activation Code :[PROTECTED]::imran
CustomSoapFaultMappingExceptionResolver 28 org.springframework.remoting.RemoteInvocationFailureException:
Invocation of method [public abstract RmiDataTransferObject OnlineServiceI.getServed(...,...)]
failed in HTTP invoker remote service at [http://{ONLINE_SERVICE_HOST}:8080/vmosvcs/vmoservice/onlineServiceHttp];
nested exception is java.lang.NoSuchMethodException: com.sun.proxy.$Proxy76.getServed(..., ...)
at this spot
RmiDataTransferObject resp = service.getServed(getRequest(csr), OnlineServiceI.CHECK_STATUS_SERVICE);
where RmiDataTransferObject getServed(..., ...) is part of my.own.interface.OnlineServiceI. If I debug the execution, there is a JdkDynamicAopProxy declaring the correct HTTP path, but it has no methods registered. Only the intended interface.
What might I be missing? If I try the HTTP url in the browser, I get a 500, which indicate that the path is correct (something is mapped to that address).
来源:https://stackoverflow.com/questions/34949118/spring-remoting-jdkdynamicaopproxy-with-no-methods