部署到 JBoss 后项目中的文件位置
File location in project after deploying to JBoss
在通过 .war
文件将项目部署到 JBoss 后,我试图获取项目中文件的文件位置。该程序公开了几个 Web 服务(使用 SOAP)。
这是 Eclipse 中的目录结构:
ProjectName
|-Java Resources
|-src
| +package.one
| +package.two
| ...
|-docs
| myFile.xsd
| otherFile.xml
|-WebContent
|+META-INF
|-WEB-INF
| +lib
| web.xml
|index.jsp
通常,如果我在 package.one
中有一个 Java class,myFile.xsd
的文件路径将是 ../ProjectName/docs/myFile.xsd
。如果我编写一个 main
方法,这很好用。
一旦我在 JBoss 上部署这个项目,但是,它找不到文件。 JBoss 开始查看其 bin
文件夹。实际项目部署到{wildflyHome}/standalone/deployments/ProjectName.war
。所以我不确定它为什么要查看 bin
文件夹。
我在尝试访问 myFile.xsd
时遇到此错误:
08:36:47,908 ERROR [stderr] (default task-3) org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'file:/C:/Users/Flow/Documents/Tools/wildfly-10.0.0.Final/bin/../ProjectName/docs/myFile.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
我根除了选项 2 和 3,因为如果没有像上面提到的那样部署在服务器上,它工作得很好。
一旦文件在服务器上,我将如何访问它?
于是尝试了很久,最后还是放弃了,直接把文件放到了bin
文件夹中。
我在bin
文件夹中创建了一个文件夹。从那里文件路径只是 folder/file.ext
.
在通过 .war
文件将项目部署到 JBoss 后,我试图获取项目中文件的文件位置。该程序公开了几个 Web 服务(使用 SOAP)。
这是 Eclipse 中的目录结构:
ProjectName
|-Java Resources
|-src
| +package.one
| +package.two
| ...
|-docs
| myFile.xsd
| otherFile.xml
|-WebContent
|+META-INF
|-WEB-INF
| +lib
| web.xml
|index.jsp
通常,如果我在 package.one
中有一个 Java class,myFile.xsd
的文件路径将是 ../ProjectName/docs/myFile.xsd
。如果我编写一个 main
方法,这很好用。
一旦我在 JBoss 上部署这个项目,但是,它找不到文件。 JBoss 开始查看其 bin
文件夹。实际项目部署到{wildflyHome}/standalone/deployments/ProjectName.war
。所以我不确定它为什么要查看 bin
文件夹。
我在尝试访问 myFile.xsd
时遇到此错误:
08:36:47,908 ERROR [stderr] (default task-3) org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'file:/C:/Users/Flow/Documents/Tools/wildfly-10.0.0.Final/bin/../ProjectName/docs/myFile.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
我根除了选项 2 和 3,因为如果没有像上面提到的那样部署在服务器上,它工作得很好。
一旦文件在服务器上,我将如何访问它?
于是尝试了很久,最后还是放弃了,直接把文件放到了bin
文件夹中。
我在bin
文件夹中创建了一个文件夹。从那里文件路径只是 folder/file.ext
.