2010-08-11 22 views
1

有沒有辦法在OSGi包中使用Endpoint.publish()來發布Web服務?當我運行從它的工作原理命令行的代碼,但在包激活相同的代碼產生以下情況除外:使用OSGi中的Endpoint.publish()發佈Web服務?

Caused by: com.sun.xml.internal.ws.server.ServerRtException: [failed to localize] cannot.load.wsdl(file:/C:/ws/project/org.project.configuration/xml/Configuration.wsdl) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.getPrimaryWsdl(Unknown Source) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(Unknown Source) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source) 
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source) 
at javax.xml.ws.Endpoint.publish(Unknown Source) 
at org.project.internal.configuration.Activator.start(Activator.java:52) 
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783) 
at java.security.AccessController.doPrivileged(Native Method) 
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774) 
... 11 more 
Root exception: 
com.sun.xml.internal.ws.server.ServerRtException: [failed to localize] cannot.load.wsdl(file:/C:/ws/project/org.project.configuration/xml/Configuration.wsdl) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.getPrimaryWsdl(Unknown Source) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(Unknown Source) 
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source) 
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source) 
at javax.xml.ws.Endpoint.publish(Unknown Source) 
at org.project.internal.configuration.Activator.start(Activator.java:52) 
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783) 
at java.security.AccessController.doPrivileged(Native Method) 
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774) 
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755) 
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370) 
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374) 
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067) 
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561) 
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546) 
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459) 
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) 
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440) 
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) 
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337) 
+0

從堆棧跟蹤'cannot.load.wsdl(file:/ C:/ws/project/org.project.configuration/xml/Configuration.wsdl)'...這個文件是否存在? – 2010-08-21 22:57:03

+0

是的,它存在。如果我在OSGi之外運行這個相同的代碼,它沒有問題。 – oconnor0 2010-10-25 23:08:19

回答

0

我想我是能夠通過添加註釋,最終解決這個問題:@WebService(endpointInterface ,name,serviceName,targetNamespace)到服務實現。