gpt4 book ai didi

java - 添加Spring库时出现"Given parent is not an ancestor of this virtual file"错误

转载 作者:行者123 更新时间:2023-12-02 11:57:01 26 4
gpt4 key购买 nike

我正在实现一些使用大量库(Spring、Log4j、Jackson 等)的 Web 应用程序。到目前为止,一切正常,但如果我尝试添加另一个 Spring 库(webmvc - 我正在实现需要 DispatcherServlet 类的 REST API),则在 JBoss AS 上部署时会收到以下错误7.1.1:

    2017-11-28 08:31:26,678 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "Office.war"
2017-11-28 08:31:27,973 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."Office.ear"."Office.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Office.ear"."Office.war".PARSE: Failed to process phase PARSE of subdeployment "Office.war" of deployment "Office.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.IllegalArgumentException: Given parent is not an ancestor of this virtual file
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:116) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:110) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.as.web.deployment.TldParsingDeploymentProcessor.processTlds(TldParsingDeploymentProcessor.java:107)
at org.jboss.as.web.deployment.TldParsingDeploymentProcessor.deploy(TldParsingDeploymentProcessor.java:83)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more

2017-11-28 08:31:28,224 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "Office.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"Office.ear\".\"Office.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Office.ear\".\"Office.war\".PARSE: Failed to process phase PARSE of subdeployment \"Office.war\" of deployment \"Office.ear\""}}
2017-11-28 08:31:28,336 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment Office.war in 113ms
2017-11-28 08:31:28,339 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment Office.ear in 116ms
2017-11-28 08:31:28,341 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.subunit."Office.ear"."Office.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Office.ear"."Office.war".PARSE: Failed to process phase PARSE of subdeployment "Office.war" of deployment "Office.ear"

2017-11-28 08:31:28,347 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"Office.ear\".\"Office.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Office.ear\".\"Office.war\".PARSE: Failed to process phase PARSE of subdeployment \"Office.war\" of deployment \"Office.ear\""}}}}

这是我的 EAR 部署程序集

enter image description here

和我的网络模块组件。

enter image description here

我不知道为什么会出现这个错误,其他库不会造成任何麻烦。有什么建议吗?

编辑1:

我注意到另一件奇怪的事情。在 Eclipse 的“添加和删除”对话框中,可用资源部分有三个 Spring webmvc jar 条目。

enter image description here

这些条目来自哪里?难道是Eclipse的问题?

编辑2:

我已将所有 jar 直接移至 lib 文件夹中(而不是像 lib/spring/spring-webmvc-4.0.6.jar 这样的子文件夹),并部署了我的应用成功。谁能解释为什么移动 jar 后该错误消失了?

最佳答案

从standalone/deployments 文件夹中删除以前的部署。清理服务器并重新部署 EAR。如果您使用的是 Java 6,您可以尝试将 java 版本更改为 Java 7。

Jboss AS 7.1.1 有很多这样的问题。如果可能,将服务器更改为 Jboss AS 7.2。这是 JBoss 7.1.2 中修复的问题之一。你可以看看这个link关于此错误及其修复的版本。

关于java - 添加Spring库时出现"Given parent is not an ancestor of this virtual file"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47526415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com