我有一个首先创建WSDL的CXF服务服务,当我将WAR部署到glassfish应用服务器2.1.1中时,出现以下异常:
java.io.FileNotFoundException: C:\Sun\AppServer\domains\domain1\config\TestService.wsdl
如果将WSDL放在该位置,则一切正常.如何设置我的WAR,以便将TestService.wsdl放入config文件夹?
谢谢!
更新:在将此服务部署到Glassfish时仍然遇到问题.照原样部署并在Tomcat中正常运行.
我在构建过程中将-wsdlLocation属性设置为“ WEB-INF / wsdl / TestService.wsdl”,但是现在当我在glassifish中部署应用程序时,server.log中出现以下异常
[#|2010-02-01T10:47:06.164-0500|SEVERE|sun-
appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Thread-
501;_RequestID=d3a3f49b-9329-477d-b6fc-24e0f4e4f3fa;|wsdl file
file:/C:/development/wexlink/FileUploadService/wsdl/FileUploadService.wsdl does not
exist for web service FileUploadService|#]
[#|2010-02-01T10:47:06.977-0500|SEVERE|sun
appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Thread-
501;_RequestID=d3a3f49b-9329-477d-b6fc-24e0f4e4f3fa;|Exception occured in J2EEC
Phasejava.lang.RuntimeException: wsdl file
file:/C:/development/wexlink/FileUploadService/wsdl/FileUploadService.wsdl does not
exist for web service FileUploadService
com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment
descriptors for module [FileUploadService] -- wsdl file
file:/C:/development/wexlink/FileUploadService/wsdl/FileUploadService.wsdl does not
exist for web service FileUploadService
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:406)
at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:426)
at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:160)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:182)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
引起原因:java.lang.RuntimeException:wsdl文件文件:/ C:/development/wexlink/FileUploadService/wsdl/FileUploadService.wsdl对于Web服务FileUploadService不存在
在com.sun.enterprise.deployment.util.ModuleContentValidator.accept(ModuleContentValidator.java:187)
在com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1410)
在com.sun.enterprise.deployment.archivist.WebArchivist.postOpen(WebArchivist.java:171)
在com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:215)
在com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:813)
在com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:794)
位于com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:365)
…还有10个
|#]
解决方法:
通常,您会将其放在WEB-INF中.然后,当您使用wsdl2java或maven插件生成代码时,将带有WEB-INF / TestService.wsdl或类似内容的-wsdlLocation标志传入,以将get生成到代码中.
就是说,使用CXF,可以在jaxws:endpoint配置中使用jaxws:endpoint上的属性覆盖wsdlLocation以指定类似“ WEB-INF / TestService.wsdl”的名称.