2012-11-13 83 views
0

我試圖運行使用cxf從wsdl生成的webservice。運行從wsdl2java生成的webservice cxf

  1. 獲取樣本WSDL(hello_world.wsdl)
  2. 生成WSDL從Java代碼
  3. 由於服務執行力度在生成的代碼丟失,我從這裏
  4. 'ant compile'成功。
  5. 'ant GreeterServer'不成功。

我錯過了什麼?


compile: 

GreeterServer: 
    [java] Starting Server 
    [java] After implementor 
    [java] Before publish 
    [java] Exception in thread "main" java.lang.ExceptionInInitializerError 
    [java]  at org.eclipse.jetty.util.component.AbstractLifeCycle.<clinit>(AbstractLifeCycle.java:33) 
    [java]  at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:178) 
    [java]  at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48) 
    [java]  at org.apache.cxf.binding.AbstractBaseBindingFactory.addListener(AbstractBaseBindingFactory.java:97) 
    [java]  at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:901) 
    [java]  at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131) 
    [java]  at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:349) 
    [java]  at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:247) 
    [java]  at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:151) 
    [java]  at javax.xml.ws.Endpoint.publish(Endpoint.java:57) 
    [java]  at org.apache.hello_world_soap_http.Greeter_SoapPort_Server.<init>(Greeter_SoapPort_Server.java:21) 
    [java]  at org.apache.hello_world_soap_http.Greeter_SoapPort_Server.main(Greeter_SoapPort_Server.java:26) 
    [java] Caused by: java.lang.IllegalArgumentException: key can't be empty 
    [java]  at java.lang.System.checkKey(System.java:774) 
    [java]  at java.lang.System.getProperty(System.java:647) 
    [java]  at org.eclipse.jetty.util.log.Log$1.run(Log.java:122) 
    [java]  at java.security.AccessController.doPrivileged(Native Method) 
    [java]  at org.eclipse.jetty.util.log.Log.<clinit>(Log.java:85) 
    [java]  ... 12 more 
    [java] Java Result: 1 

BUILD SUCCESSFUL 
Total time: 1 second 

回答

1

不知道什麼會導致此。看起來不知何故,你的JVM從System.getProperties()。propertyNames()返回一個空屬性名稱。在此之前調用到CXF代碼,你可以嘗試這樣的:

@SuppressWarnings("unchecked") 
Enumeration<String> systemKeyEnum = (Enumeration<String>)System.getProperties().propertyNames(); 
while (systemKeyEnum.hasMoreElements()) { 
    String key = systemKeyEnum.nextElement(); 
    String val = System.getProperty(key); 
    System.out.println(key + ": " + val); 
} 

,看是否實際工作?

+0

是的,它打印良好。我不知道是什麼導致了這個問題。這是實際的項目文件。 [源](https://www.dropbox.com/s/nym2ojb8brpz5pc/cxf_test.zip)謝謝。 – Sean