TomEE
  1. TomEE
  2. TOMEE-51

Deployment without web.xml not possible. With web.xml, tests do not run.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Invalid
    • Affects Version/s: 1.0.0-beta-1
    • Fix Version/s: 1.0.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mac OS X Lion

      Description

      1. Steps to reproduce the issue:
      a) unzip the included sample project
      b) delete the folder src/main/resources/WEB-INF
      c) mvn package
      d) start TomEE
      e) copy the created war file to <TOMEE>/webapps

      2. Expected behaviour:
      TomEE deploys the application
      The application can be visited at localhost:8080

      3. Actual behaviour:
      The following exception is thrown (see catalina.out):

      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHo
      st[localhost].StandardContext[/football-bet-1.0-SNAPSHOT]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1370)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:294)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1242)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(Contain
      erBase.java:1400)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1410)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1389)
      at java.lang.Thread.run(Thread.java:680)
      Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.get(ArrayList.java:322)
      at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.loadWebModule(TomcatWebAppBuilder.java:892)
      at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:879)
      at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:416)
      at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:377)
      at org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:117)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
      ... 15 more

      Alternative steps:

      • Do not delete WEB-INF in 1b.
      • mvn test
        --> Tests do not pass with the following exception:

      org.apache.openejb.OpenEjbContainer$NoModulesFoundException: No modules found to deploy.
      1)Maybe descriptors are placed in incorrect location.
      Descriptors could go under:
      <base-dir>/META-INF or <base-dir>/WEB-INF
      but not directly under <base-dir>
      Check 'Application Discovery via the Classpath' docs page for more info
      2)Maybe no modules are present in the classpath.
      Is 'openejb.base' system property pointing to the intended location?
      at org.apache.openejb.util.Exceptions.newNoModulesFoundException(Exceptions.java:98)
      at org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:415)
      at org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:231)
      at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
      at com.codebrickie.footballbet.service.ServiceBeanTest.bootContainer(ServiceBeanTest.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      java.lang.NullPointerException
      at com.codebrickie.footballbet.service.ServiceBeanTest.shutdownContainer(ServiceBeanTest.java:29)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      1. webxmlbug-corrected.zip
        13 kB
        Vishwanath
      2. webxmlbug.zip
        8 kB
        Tobias Bayer

        Activity

        Hide
        Tobias Bayer added a comment -

        Runs fine with the hints from the comments and on 1.0.0-beta-2.

        Show
        Tobias Bayer added a comment - Runs fine with the hints from the comments and on 1.0.0-beta-2.
        Hide
        Vishwanath added a comment -

        Hi,

        I did a few changes. Then the tests worked fine, and also the app deployed properly.
        Please see the attached zip.

        The changes were:

        1) Moved WEB-INF folder to webapps directory, so that maven would pick it up correctly
        2) Added an empty beans.xml in WEB-INF
        3) Added an empty beans.xml in src/test/resources/META-INF (I think, standaone apps require beans.xml in META-INF and webapps require it in WEB-INF )
        4) Had a JPA related exception, that required adding a JavaAgent in pom.xml ( http://openejb.apache.org/javaagent.html )

        PS: Tests run through maven would work fine (since JavaAgent was added).
        Eclipse based test (without using maven) would complain of a missing JavaAgent.

        And I used beta-2 snapshot.

        Show
        Vishwanath added a comment - Hi, I did a few changes. Then the tests worked fine, and also the app deployed properly. Please see the attached zip. The changes were: 1) Moved WEB-INF folder to webapps directory, so that maven would pick it up correctly 2) Added an empty beans.xml in WEB-INF 3) Added an empty beans.xml in src/test/resources/META-INF (I think, standaone apps require beans.xml in META-INF and webapps require it in WEB-INF ) 4) Had a JPA related exception, that required adding a JavaAgent in pom.xml ( http://openejb.apache.org/javaagent.html ) PS: Tests run through maven would work fine (since JavaAgent was added). Eclipse based test (without using maven) would complain of a missing JavaAgent. And I used beta-2 snapshot.
        Hide
        Romain Manni-Bucau added a comment -

        it works with trunk version since in your webapp you have WEB-INF folder.

        add this maven plugin to your pom then run mvn package t7:run:

        <plugin>
        <groupId>com.googlecode.t7mp</groupId>
        <artifactId>maven-t7-plugin</artifactId>
        <version>0.9.7</version>
        <configuration>
        <tomcatHttpPort>1234</tomcatHttpPort>
        <tomcatShutdownPort>13245</tomcatShutdownPort>
        <tomcatVersion>7.0.21</tomcatVersion>
        <webapps>
        <webappArtifact>
        <groupId>org.apache.openejb</groupId>
        <artifactId>tomee-webapp</artifactId>
        <version>4.0.0-beta-2-SNAPSHOT</version>
        <contextPath>openejb</contextPath>
        </webappArtifact>
        </webapps>
        </configuration>
        </plugin>

        Show
        Romain Manni-Bucau added a comment - it works with trunk version since in your webapp you have WEB-INF folder. add this maven plugin to your pom then run mvn package t7:run: <plugin> <groupId>com.googlecode.t7mp</groupId> <artifactId>maven-t7-plugin</artifactId> <version>0.9.7</version> <configuration> <tomcatHttpPort>1234</tomcatHttpPort> <tomcatShutdownPort>13245</tomcatShutdownPort> <tomcatVersion>7.0.21</tomcatVersion> <webapps> <webappArtifact> <groupId>org.apache.openejb</groupId> <artifactId>tomee-webapp</artifactId> <version>4.0.0-beta-2-SNAPSHOT</version> <contextPath>openejb</contextPath> </webappArtifact> </webapps> </configuration> </plugin>
        Hide
        Tobias Bayer added a comment -

        No, same exception there.

        Show
        Tobias Bayer added a comment - No, same exception there.
        Hide
        Romain Manni-Bucau added a comment -

        hi,

        it should work on the snapshot (1.0.0-beta-2-SNAPSHOT)

        Show
        Romain Manni-Bucau added a comment - hi, it should work on the snapshot (1.0.0-beta-2-SNAPSHOT)
        Hide
        Tobias Bayer added a comment -

        Minimal sample project

        Show
        Tobias Bayer added a comment - Minimal sample project

          People

          • Assignee:
            Unassigned
            Reporter:
            Tobias Bayer
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development