0

我正在使用 Apache CXF D-OSgi 和 Eclipse Equinox 作为我的开发环境,我注册了服务,但我无法在 IE 中打开 wsdl 页面。服务注册码如下:

 `      Dictionary<String, String> props = new Hashtable<String, String>();
    props.put("osgi.remote.interfaces", "*");       
    props.put("osgi.remote.configuration.type","pojo");
    props.put("osgi.remote.configuration.pojo.address", "http://localhost:9000/1");

        sr = bundleContext.registerService
    (service1.class.getName(), new impl1(), props);`

当我尝试运行客户端程序时,它显示以下错误:

Caused by: java.net.SocketException: SocketException invoking http://localhost:9000/1: Network is unreachable: connect
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:2058)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2043)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 43 more

Caused by: java.net.SocketException: Network is unreachable: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1955)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1907)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1974)
... 46 more

2011-5-10 23:22:04 org.apache.cxf.dosgi.topologymanager.RemoteServiceAdminListenerImpl remoteAdminEvent

信息:收到未处理的事件类型:1 2011-5-10 23:22:04 org.apache.cxf.dosgi.topologymanager.TopologyManager$1 modifiedService 信息:TopologyManager: EndpointListener changed ... 2011-5-10 23:22:04 org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore importService 信息:importService() 端点:{endpoint.id=http://localhost:9000/1, objectClass=[Ljava.lang.String;@988707, osgi. remote.configuration.pojo.address=http://localhost:9000/1, osgi.remote.configuration.type=pojo, osgi.remote.interfaces=, service.imported=true, service.imported.configs=org.apache.cxf.ws} 2011-5-10 23:22:04 org.apache.cxf.dosgi.topologymanager.RemoteServiceAdminListenerImpl remoteAdminEvent 信息:收到未处理的事件类型: 1 2011-5-10 23:22:04 org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore importService 信息:importService() 端点:{endpoint.id=http://localhost:9000/1, objectClass=[ Ljava.lang.String;@988707, osgi.remote.configuration.pojo.address=http://localhost:9000/1, osgi.remote.configuration.type=pojo, osgi.remote.interfaces= , service.imported=是的,service.imported.configs=org.apache.cxf.ws} 2011-5-10 23:22:04 org.apache.cxf.dosgi.topologymanager.RemoteServiceAdminListenerImpl remoteAdminEvent 信息:收到未处理的事件类型:1

4

1 回答 1

1

我认为这些是注册远程服务的不准确属性。

我遇到了同样的问题(从浏览器访问时没有显示 WSDL,尽管OSGi控制台说我的服务注册成功),但是可以通过使用以下属性来远程服务CXF OSGi

props.put("service.exported.interfaces", "*");
    props.put("service.exported.configs", "org.apache.cxf.ws");
    props.put("org.apache.cxf.ws.address", "http://localhost:8080/TDMSAPIService");

希望有帮助。

于 2011-06-22T12:16:34.217 回答