Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-beta-2
    • Fix Version/s: 1.0.0-beta-2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux, Java6

      Description

      A WAR's context.xml is not loaded.

      If the context.xml is put in the WAR in META-INF/context.xml it is not loaded. This works with Tomcat 6 + OpenEJB.

      I attached a simple EAR containing a web module with a valid META-INF/context.xml. As test modify the context.xml so that it is invalid, e.g.

      <Context
      this context.xml is not valid
      path="/opencrx-core-CRX"
      docBase="$

      {catalina.home}

      /apps/opencrx-core-CRX/opencrx-core-CRX.war"
      >
      </Context>

      TomEE deploys the EAR without warnings or errors.

      I tested a real EAR with a context.xml defining a realm which is also not loaded.

      1. opencrx-core-CRX.ear
        2 kB
        Werner Froidevaux

        Activity

        Werner Froidevaux created issue -
        Werner Froidevaux made changes -
        Field Original Value New Value
        Attachment opencrx-core-CRX.ear [ 12499960 ]
        Hide
        Romain Manni-Bucau added a comment -

        did you try to define a context in server.xml for your webapp? (soemething witha docBase like apps/opencrx-core-CRX/opencrx-webapp)

        Show
        Romain Manni-Bucau added a comment - did you try to define a context in server.xml for your webapp? (soemething witha docBase like apps/opencrx-core-CRX/opencrx-webapp)
        Hide
        Romain Manni-Bucau added a comment -

        i just commited a fix, it will take some time to be redeployed but it should work (at least i managed to change the path of the context throught META-INF/context.xml)

        Show
        Romain Manni-Bucau added a comment - i just commited a fix, it will take some time to be redeployed but it should work (at least i managed to change the path of the context throught META-INF/context.xml)
        Hide
        Werner Froidevaux added a comment -

        Setting an attribute of the element <Context> (such as 'path') does work now.

        However, nested elements are still ignored.

        You can test it by adding a realm definition

        <Realm
        className="xxx.org.apache.catalina.realm.UserDatabaseRealm"
        resourceName="UserDatabase"
        />

        to the context.xml. It does not matter what you put as className, the definition seems to be ignored.

        Show
        Werner Froidevaux added a comment - Setting an attribute of the element <Context> (such as 'path') does work now. However, nested elements are still ignored. You can test it by adding a realm definition <Realm className="xxx.org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" /> to the context.xml. It does not matter what you put as className, the definition seems to be ignored.
        Hide
        Romain Manni-Bucau added a comment -

        i just committed another patch, i'll try to run the deployment in the afternoon, hope it will be enough

        Show
        Romain Manni-Bucau added a comment - i just committed another patch, i'll try to run the deployment in the afternoon, hope it will be enough
        Hide
        Werner Froidevaux added a comment -

        I tested with apache-tomee-1.0.0-beta-2-20111021.160446-14-webprofile.tar.gz:

        According to the console the context.xml are recognized:

        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-ldap-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-imap-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-caldav-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-carddav-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-rest-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-news-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-core-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-ical-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-airsync-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-vcard-CRX/META-INF/context.xml
        using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-webdav-CRX/META-INF/context.xml

        However, a few lines later in the log I get the following exception:

        TomcatWebAppBuilder.start /opencrx-rest-CRX
        java.lang.NullPointerException
        at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJava(TomcatJndiBuilder.java:218)
        at org.apache.tomee.catalina.TomcatJavaJndiBinder.lifecycleEvent(TomcatJavaJndiBinder.java:33)
        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)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
        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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)

        My context.xml contains the following nested element:

        <Realm className="org.apache.catalina.realm.CombinedRealm">
        <Realm
        className="org.apache.catalina.realm.UserDatabaseRealm"
        resourceName="UserDatabase"
        />
        </Realm>

        Show
        Werner Froidevaux added a comment - I tested with apache-tomee-1.0.0-beta-2-20111021.160446-14-webprofile.tar.gz: According to the console the context.xml are recognized: using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-ldap-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-imap-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-caldav-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-carddav-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-rest-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-news-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-core-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-ical-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-airsync-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-vcard-CRX/META-INF/context.xml using context file /home/wfro/temp/apache-tomee-webprofile-1.0.0-beta-2-SNAPSHOT/apps/opencrx-core-CRX/opencrx-webdav-CRX/META-INF/context.xml However, a few lines later in the log I get the following exception: TomcatWebAppBuilder.start /opencrx-rest-CRX java.lang.NullPointerException at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJava(TomcatJndiBuilder.java:218) at org.apache.tomee.catalina.TomcatJavaJndiBinder.lifecycleEvent(TomcatJavaJndiBinder.java:33) 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) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.startup.Catalina.start(Catalina.java:621) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450) My context.xml contains the following nested element: <Realm className="org.apache.catalina.realm.CombinedRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" /> </Realm>
        Hide
        Romain Manni-Bucau added a comment -

        hmm, i'm not sure you've got the good version, can you have another try soon please?

        Show
        Romain Manni-Bucau added a comment - hmm, i'm not sure you've got the good version, can you have another try soon please?
        Hide
        Werner Froidevaux added a comment -

        I tried with apache-tomee-1.0.0-beta-2-20111021.174029-15-webprofile.tar.gz

        I get the same result, however the stack trace looks a little bit different:

        TomcatWebAppBuilder.start /opencrx-rest-CRX
        java.lang.NullPointerException
        at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJava(TomcatJndiBuilder.java:223)
        at org.apache.tomee.catalina.TomcatJavaJndiBinder.lifecycleEvent(TomcatJavaJndiBinder.java:33)
        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)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
        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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)

        Show
        Werner Froidevaux added a comment - I tried with apache-tomee-1.0.0-beta-2-20111021.174029-15-webprofile.tar.gz I get the same result, however the stack trace looks a little bit different: TomcatWebAppBuilder.start /opencrx-rest-CRX java.lang.NullPointerException at org.apache.tomee.catalina.TomcatJndiBuilder.mergeJava(TomcatJndiBuilder.java:223) at org.apache.tomee.catalina.TomcatJavaJndiBinder.lifecycleEvent(TomcatJavaJndiBinder.java:33) 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) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148) at org.apache.catalina.startup.Catalina.start(Catalina.java:621) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
        rmannibucau committed 1187705 (2 files)
        Hide
        Romain Manni-Bucau added a comment -

        can you have a try with the last one please?

        Show
        Romain Manni-Bucau added a comment - can you have a try with the last one please?
        Hide
        Werner Froidevaux added a comment -

        It tested with apache-tomee-1.0.0-beta-2-20111022.170518-16-webprofile.tar.gz and it works. Perfect!

        Show
        Werner Froidevaux added a comment - It tested with apache-tomee-1.0.0-beta-2-20111022.170518-16-webprofile.tar.gz and it works. Perfect!
        Hide
        Romain Manni-Bucau added a comment -

        cool, sorry for the multiple tries

        Show
        Romain Manni-Bucau added a comment - cool, sorry for the multiple tries
        Romain Manni-Bucau made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Romain Manni-Bucau [ romain.manni-bucau ]
        Fix Version/s 1.0.0-beta-2 [ 12318446 ]
        Resolution Fixed [ 1 ]
        Show
        David Blevins added a comment - 2011-10-21 - http://svn.apache.org/viewvc?view=revision&revision=1187205 - rmannibucau 2011-10-22 - http://svn.apache.org/viewvc?view=revision&revision=1187705 - rmannibucau

          People

          • Assignee:
            Romain Manni-Bucau
            Reporter:
            Werner Froidevaux
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development