Mule - 导出的项目 - 错误 java.io.FileNotFoundException

Mule - Exported project - Error java.io.FileNotFoundException

我已经在 src.main.resources/wsdl-request.

中导出了包含 WSDL 文件的 mule 项目

导出的类型是AnyPoint Studio Project to AnyPoint Deployable Archive

问题是当我在服务器中执行可部署存档时 return 这个错误:

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'file:/C:/Users/usrAdmin/AnypointStudio/workspace/mule-project-test/src/main/resources/wsdl-test/Request.wsdl'. (The system cannot find the path specified)
    at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:249)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:192)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
    ... 54 more
Caused by: java.io.FileNotFoundException: C:\Users\usrAdmin\AnypointStudio\workspace\mule-project-test\src\main\resources\wsdl-test\Request.wsdl (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at java.io.FileInputStream.<init>(FileInputStream.java:101)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    ... 60 more

错误所说的路径是我在导出之前拥有项目的路径

如何将文件添加到项目中以避免该错误?。 我认为我需要使用类路径或类似的东西,但我不知道它是否有效。

已添加:

这是我的实际 wsdlLocation:

wsdlLocation = "file:/C:/Users/tstSrvr/AnypointStudio/workspace/test-project/src/main/resources/wsdl-test/Request.wsdl"

您似乎在配置中硬编码了此路径 C:\Users\usrAdmin\AnypointStudio\workspace\mule-project-test\src\main\resources\wsdl-test\Request.wsdl

改为使用 wsdl-test/Request.wsdl,这样在 Studio 中和打包应用程序时都可以找到文件,因为它将从类路径(作为资源)加载,而不是作为文件加载 (通过绝对路径)。