JBoss: IllegalArgumentException: Given parent (“myWar1.war”) is not an ancestor of this virtual file
heniuuuuu Aug 31, 2016 5:50 AMMy .ear package contains my jars, wars in root dir and 3rd party jars (like Spring) in separate dir.
myEar.ear looks like:
myEar.ear
- spring
|- spring-core-4.3.2.RELEASE.jar
|- spring-webmvc-4.3.2.RELEASE.jar
|- ....
- myJar1.jar
- myWar1.war
myWar1.war looks like:
myWar1.war
- META-INF
|- context.xml
|- MANIFEST.MF (contains class-paths to jars )
- WEB-INF |- classes (builded java classes)
|- tlds
||- spring-form.tld
||- spring.tld
|- my-war1-servlet.xml
|- web.xml
- homePage.jsp
- .... .jsp
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Some Web Application</display-name>
<servlet>
<servlet-name>my-war1</servlet-name>
<servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>my-war1</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/my-war1-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Spring Tag Library Descriptors -->
<taglib>
<taglib-uri>spring-form</taglib-uri>
<taglib-location>/WEB-INF/tlds/spring-form.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>spring</taglib-uri>
<taglib-location>/WEB-INF/tlds/spring.tld</taglib-location>
</taglib>
</web-app>
my-war1-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context/
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.mypackage.myapp.controller" />
<mvc:annotation-driven />
</beans>
I'm using ant to build all packages and put them into .ear. When I'm trying to run myEar.ear onJBoss 8.2.1 (WildFly), i'm getting error:
ERROR: Failed to start service jboss.deployment.subunit."myEar.ear"."myWar1.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."myEar.ear"."myWar1.war".PARSE: Failed to process phase PARSE of subdeployment "myWar1.war" of deployment "myEar.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.1.Final.jar:8.2.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_51]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017313: TLD file /C:/jboss_path/myEar.ear/spring/spring-webmvc-4.3.2.RELEASE.jar/META-INF/spring-form.tld not contained in root /C:/jboss_path/myEar.ear/myWar1.war
at org.wildfly.extension.undertow.deployment.TldParsingDeploymentProcessor.processTlds(TldParsingDeploymentProcessor.java:203)
at org.wildfly.extension.undertow.deployment.TldParsingDeploymentProcessor.deploy(TldParsingDeploymentProcessor.java:144)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.1.Final.jar:8.2.1.Final]
... 5 more
Caused by: java.lang.IllegalArgumentException: Given parent ("/C:/jboss_path/myEar.ear/myWar1.war") is not an ancestor of this virtual file at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:116) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:110) [jboss-vfs-3.2.5.Final.jar:3.2.5.Final]
at org.wildfly.extension.undertow.deployment.TldParsingDeploymentProcessor.processTlds(TldParsingDeploymentProcessor.java:201)
... 7 more
As you see, tlds was added to web.xml
(according to this answer), so why i'm getting this error ? How to solve this ?