2013-03-06 67 views
2

我正在使用Eclipse Juno v4.2 R2,一個eclipse內部的GlassFish 3.1.2(與3.1.2.2之前有同樣的問題)和Apache CXF 2.7.1,試圖實現通過JAX-RS提供REST風格的Web服務。當GlassFish服務器啓動並且應用程序的部署成功時,自從我重新啓動IDE後,該應用程序不能再部署了。當Eclipse嘗試發佈在GlassFish應用程序,我不斷收到此錯誤:使用Eclipse,GlassFish和Apache CXF的異常

Severe: wsdl file classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl does not exist for web service Discovery 
Severe: Exception while deploying the app [MyFunnyApp] 
Severe: wsdl file classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl does not exist for web service Discovery 
java.lang.RuntimeException: wsdl file classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl does not exist for web service Discovery 
    at com.sun.enterprise.deployment.util.ModuleContentValidator.accept(ModuleContentValidator.java:196) 
    at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1999) 
    at com.sun.enterprise.deployment.archivist.WebArchivist.postOpen(WebArchivist.java:284) 
    at com.sun.enterprise.deployment.archivist.WebArchivist.postOpen(WebArchivist.java:89) 
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:245) 
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252) 
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:213) 
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:165) 
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:185) 
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:827) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:769) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368) 
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) 
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) 
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) 
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461) 
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212) 
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) 
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:722) 


Severe: Exception while deploying the app [MyFunnyApp] : wsdl file classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl does not exist for web service Discovery 

有誰知道是什麼原因造成這個錯誤?

+0

爲什麼要用'REST'使用'CXF'?你不知道爲了製作Web服務而使用它,你試過編輯'web.xml'嗎? – 2013-03-06 16:42:52

+0

我將CXF用作JPA實現,因此信息可能會產生誤導。我沒有觸及web.xml,因爲它是由Eclipse自動創建的,它在我重新啓動IDE之前就已經工作了。 – grobmotoriker 2013-03-06 16:57:15

+0

檢查了這一點:http://www.vogella.com/articles/REST/article.html – 2013-03-06 17:19:43

回答

3

到目前爲止,我的解決這個問題一直跟隨在這裏找到了建議:http://osdir.com/ml/users-cxf-apache/2012-12/msg00046.html

我搬到從CXF lib /目錄下面的JAR:

CXF服務-WS發現-api-2.7.4.jar cxf-services-ws-discovery-service-2.7.4.jar cxf-services-wsn-api-2.7.4.jar cxf-services-wsn-core-2.7.4 .jar

然後我刷新了Eclipse項目構建路徑選項卡上的CXF庫(刪除了libr ary然後再次添加它,檢查是否沒有cxf-services-ws-discovery- *和cxf-services-wsn- * JARs)。

使用這個新的CXF JAR創建和部署客戶端和服務工作。我剛剛用CXF 2.7.4(CXF 2.7.5在Eclipse 4.2中遇到了更大的問題... Java2Ws立即停止...)