web-services - 尝试定位 WSL 时出现 JBoss EAP 7.3 错误
问题描述
我正在尝试部署一个基本的 Web 服务,我的 wsdl 位于如下 beans.xml 中所示:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<jaxws:endpoint
id="helloWorld"
implementor="com.tsdevelopment.HelloWorldImpl"
wsdlLocation="src/main/resources/wsdl/HelloWorld.wsdl"
address="/HelloWorld" />
</beans>
当我使用 mvn wildfly:deploy 部署时,出现以下错误:
Caused by: java.io.FileNotFoundException: C:\Users\codereadystudio\jboss-eap-7.3\bin\src\main\resources\wsdl\HelloWorld.wsdl (The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:108)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:1009)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:144)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:832)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:298)
at deployment.soap-cxf-wsdlfirst-jbosseap73-1.0-SNAPSHOT.war//com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188)
... 56 more
为什么它在 jboss 安装文件夹而不是代码中搜索 WSDL?
解决方案
似乎无法找到 WSDL 的原因是,在 pom.xml 中,wsdl 路径如下:
<wsdlOptions>
<wsdlOption>
<wsdl>
src/main/resources/wsdl/HelloWorld.wsdl
</wsdl>
<wsdlLocation>wsdl/HelloWorld.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
cxf cxf-codegen-plugin 生成的java类没有在@WebService注解中包含wsdlLocation参数。另请注意,参数路径必须仅包含构建路径下的文件夹。也就是说,虽然我的 pom.xml 位置是 /src/main/resources/wsdl/HelloWorld.wsdl,但我的参数是 wsdl/HelloWorld.wsdl,因为我已经在构建路径中包含了 /src/main/resources 文件夹。
推荐阅读
- python - 出现错误:消息:过时的元素引用:元素未附加到页面文档
- pytorch - 将列和行添加到多维 torch.tensor(一种总结或填充)
- r - 无法安装 R 依赖项,大量错误
- deep-learning - 骰子损失仅在概率以分母平方时起作用
- node.js - 用玩笑检查函数返回
- reactjs - React Typescript:可选函数不被认为是未定义的
- java - 在浏览器上显示本地 PDF 文件
- json - 如何在反应中使用 onChange 处理程序在击键时更新 json.stringify
- r - 如何以编程方式将转换应用于多个变量并使用 dplyr for R 保留原始变量和转换后的变量
- docker - 已解决 Forbidden 403:从 openvpn 网络访问私有网站(客户端使用公共 ip 而不是 openvpn ip)