You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Terry <ma...@aol.com.INVALID> on 2022/04/20 19:05:17 UTC
Ear context-root
I have a web app deployed as a ear file that contains a war file. The ear file is named "MyApp.ear" and the war file it contains is named "MyApp-war.war". I have the code below in application.xml.
<?xml version="1.0"?>
<application version="7"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd">
<display-name>MyApp</display-name>
<module>
<web>
<web-uri>MyApp-war.war</web-uri>
<context-root>/MyApp</context-root>
</web>
</module>
</application>
With the above config, the app will deploy the first time, but if I restart TomEE the app will fail with the errors below. So, if it's a fresh first-time deployment, it works, otherwise it doesn't work. In the Tomcat Web Application Manger there is only one application listed, "/MyApp".
20-Apr-2022 13:08:03.349 INFO [Catalina-utility-2] org.apache.openejb.assembler.classic.Assembler.destroyApplication Undeploying app: D:\tomcat\apache-tomee-plume-8.0.10\webapps\MyApp
20-Apr-2022 13:08:03.535 SEVERE [Catalina-utility-2] org.apache.openejb.assembler.classic.Assembler.destroyApplication undeployException original cause
java.lang.Exception: deployment not found: MyApp-war.Comp82524256
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2378)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1103)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:762)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:758)
at org.apache.tomee.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:2318)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:142)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1162)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1347)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
20-Apr-2022 13:08:03.537 WARNING [Catalina-utility-2] org.apache.tomee.catalina.TomcatWebAppBuilder.checkHost Error deploying application D:\tomcat\apache-tomee-plume-8.0.10\webapps\MyApp.ear
org.apache.openejb.OpenEJBException: Creating application failed: D:\tomcat\apache-tomee-plume-8.0.10\webapps\MyApp: Child name [/MyApp] is not unique
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1107)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:762)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:758)
at org.apache.tomee.catalina.TomcatWebAppBuilder.checkHost(TomcatWebAppBuilder.java:2318)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:142)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1162)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1347)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Child name [/MyApp] is not unique
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:711)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar(TomcatWebAppBuilder.java:687)
at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:614)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1057)
... 17 more
If I rename "MyApp.ear" to "MyApp-ear.ear", then everything works including restarting TomEE. In this case, the Tomcat Web Application Manger lists two applications, "/MyApp-ear" and "/MyApp".
It seems TomEE gets confused when the ear file is named MyApp.ear with the implied context-root for the ear being "MyApp" and the context-root for the war file is also specified to be "MyApp" in application.xml.
Can I name the ear file "MyApp.ear" and also have the context-root for the war file be "MyApp"? Is there a way to change the context-root for the ear file besides changing the ear filename?
Thanks,
Terry