我有一个CXF服务,我首先创建了WSDL,当我将WAR部署到glassfish app server 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不存在 at 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个 |#]
答案 0 :(得分:2)
通常情况下,你会把它放在WEB-INF的某个地方。然后,当您使用wsdl2java或maven插件生成代码时,使用WEB-INF / TestService.wsdl或类似函数传入-wsdlLocation标志,以便将get生成到代码中。
也就是说,使用CXF,在jaxws:endpoint config中,您可以使用jaxws:endpoint上的属性覆盖wsdlLocation,以指定类似“WEB-INF / TestService.wsdl”的内容。
答案 1 :(得分:2)
如果您将WSDL文件放在WEB-INF / wsdl / TestService.wsdl中
您的代码应为
@WebService(wsdlLocation = “TestService.wsdl”)
此外,您还可以在日志中找到状态
文件:/ C:/development/wexlink/FileUploadService/wsdl/FileUploadService.wsdl没有 存在用于Web服务FileUploadService
这似乎是在你的一个文件中硬编码进行文件扫描,以确保你没有硬编码。