equinox.http.registry.servlets and spring as server [message #104170] |
Mon, 21 January 2008 04:21  |
Eclipse User |
|
|
|
Hi,
I am trying to build a RCP server using the Spring framework to establish
client communication. I experimented with various protocols and standard
RMI is working perfect, but I am having troubles with e.g. HTTP-Invoker.
What I did was to define a server bundle with this Spring configuration:
<beans>
<bean id="remoteService" class="server.ServiceImpl"/>
<bean id="serviceRMI"
class="org.springframework.remoting.rmi.RmiServiceExporter" >
<property name="serviceName" value="RemoteService"/>
<property name="service" ref="remoteService"/>
<property name="serviceInterface" value="server.Service"/>
</bean>
<bean name="/RemoteServiceHttpInvoker"
class=" org.springframework.remoting.httpinvoker.HttpInvokerServiceE xporter ">
<property name="serviceInterface" value="server.Service" />
<property name="service" ref="remoteService" />
</bean>
</beans>
I added the following to my plugin.xml to launch the internal http server
and to publish the spring servlets:
<plugin>
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/context"
class="org.springframework.web.context.ContextLoaderServlet ">
</servlet>
<servlet
alias="/remote"
class="org.springframework.web.servlet.DispatcherServlet">
</servlet>
<servlet
alias="/RemoteServiceHttpInvoker"
class=" org.springframework.remoting.httpinvoker.HttpInvokerServiceE xporter ">
</servlet>
</extension>
</plugin>
On the client-side, the spring configuration looks like this:
<beans>
<bean id="serviceRMI"
class="org.springframework.remoting.rmi.RmiProxyFactoryBean ">
<property name="serviceUrl"
value="rmi://localhost:1099/RemoteService"/>
<property name="serviceInterface" value="client.Service"/>
</bean>
<bean id="remoteServiceHttpInvoker"
class=" org.springframework.remoting.httpinvoker.HttpInvokerProxyFac toryBean ">
<property name="serviceInterface" value="client.Service" />
<property name="serviceUrl"
value="http://localhost:8080/RemoteServiceHttpInvoker" />
</bean>
</beans>
But everytime I try to use the HTTP-Invoker servlet like this:
ApplicationContext ctx = new
ClassPathXmlApplicationContext("rmi-client.xml");
service = (Service) ctx.getBean("remoteServiceHttpInvoker");
service.put("Some test string");
I receive a connection refused exception:
!ENTRY org.eclipse.ui.workbench 4 0 2008-01-21 10:01:58.281
!MESSAGE Unable to create view ID perspective2.view4: Could not connect to
HTTP invoker remote service at
[http://localhost:8080/RemoteServiceHttpInvoker]; nested exception is
java.net.ConnectException: Connection refused: connect
!STACK 0
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.ja va:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:516)
at java.net.Socket.connect(Socket.java:466)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
...
Also a browser keeps on telling me, that the service is unavailable. Can
anybody explain me, where the bus is? Do I have to add some configuration
params on the server side? Does anyone have experience with RCP and Spring?
Reagrds,
Markus
|
|
|
Re: equinox.http.registry.servlets and spring as server [message #104287 is a reply to message #104170] |
Mon, 21 January 2008 23:29  |
Eclipse User |
|
|
|
Hi Markus,
I'm guessing that you're using org.eclipse.equinox.http.jetty as your Http
Service.
You need to configure which port it listens on.
If you start the bundle explicitly you can define the system property
"org.osgi.service.http.port=8080".
Another approach is to use org.eclipse.equinox.http.jetty.JettyConfigurator
and configure yourself a server.
HTH
-Simon
"Markus Bach" <markus.bach@hydrometer.de> wrote in message
news:85cd1e8eef33bea99f461b677d7125b1$1@www.eclipse.org...
> Hi,
>
> I am trying to build a RCP server using the Spring framework to establish
> client communication. I experimented with various protocols and standard
> RMI is working perfect, but I am having troubles with e.g. HTTP-Invoker.
>
> What I did was to define a server bundle with this Spring configuration:
>
> <beans>
> <bean id="remoteService" class="server.ServiceImpl"/>
>
> <bean id="serviceRMI"
> class="org.springframework.remoting.rmi.RmiServiceExporter" >
> <property name="serviceName" value="RemoteService"/>
> <property name="service" ref="remoteService"/>
> <property name="serviceInterface" value="server.Service"/>
> </bean>
>
> <bean name="/RemoteServiceHttpInvoker"
> class=" org.springframework.remoting.httpinvoker.HttpInvokerServiceE xporter ">
> <property name="serviceInterface" value="server.Service" />
> <property name="service" ref="remoteService" />
> </bean> </beans>
>
> I added the following to my plugin.xml to launch the internal http server
> and to publish the spring servlets:
>
> <plugin>
> <extension
> point="org.eclipse.equinox.http.registry.servlets">
> <servlet
> alias="/context"
> class="org.springframework.web.context.ContextLoaderServlet ">
> </servlet>
> <servlet
> alias="/remote"
> class="org.springframework.web.servlet.DispatcherServlet">
> </servlet>
> <servlet
> alias="/RemoteServiceHttpInvoker"
> class=" org.springframework.remoting.httpinvoker.HttpInvokerServiceE xporter ">
> </servlet>
> </extension>
> </plugin>
>
> On the client-side, the spring configuration looks like this:
>
> <beans>
> <bean id="serviceRMI"
> class="org.springframework.remoting.rmi.RmiProxyFactoryBean ">
> <property name="serviceUrl"
> value="rmi://localhost:1099/RemoteService"/>
> <property name="serviceInterface" value="client.Service"/>
> </bean>
>
> <bean id="remoteServiceHttpInvoker"
> class=" org.springframework.remoting.httpinvoker.HttpInvokerProxyFac toryBean ">
> <property name="serviceInterface" value="client.Service" />
> <property name="serviceUrl"
> value="http://localhost:8080/RemoteServiceHttpInvoker" />
> </bean> </beans>
>
> But everytime I try to use the HTTP-Invoker servlet like this:
>
> ApplicationContext ctx = new
> ClassPathXmlApplicationContext("rmi-client.xml");
> service = (Service) ctx.getBean("remoteServiceHttpInvoker");
> service.put("Some test string");
>
> I receive a connection refused exception:
>
> !ENTRY org.eclipse.ui.workbench 4 0 2008-01-21 10:01:58.281
> !MESSAGE Unable to create view ID perspective2.view4: Could not connect to
> HTTP invoker remote service at
> [http://localhost:8080/RemoteServiceHttpInvoker]; nested exception is
> java.net.ConnectException: Connection refused: connect
> !STACK 0
> java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.ja va:195)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> at java.net.Socket.connect(Socket.java:516)
> at java.net.Socket.connect(Socket.java:466)
> at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
> ..
>
> Also a browser keeps on telling me, that the service is unavailable. Can
> anybody explain me, where the bus is? Do I have to add some configuration
> params on the server side? Does anyone have experience with RCP and
> Spring?
>
> Reagrds,
>
> Markus
>
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.23112 seconds