OpenEJB
  1. OpenEJB
  2. OPENEJB-1523

TomEE 6.0.26 / 3.1.4: NPE in org.apache.catalina.startup.HostConfig.manageApp

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.4
    • Fix Version/s: 4.0.0-beta-2
    • Component/s: tomee
    • Labels:
      None
    • Environment:
      - Apache TomEE (Tomcat 6.0.29 / OpenEJB 3.1.4)
      - Snapshot apache-tomee-4.0.0-20110825.075723-21

      Description

      When deploying an EAR (containing web modules) I get the following Exception:

      org.apache.openejb.OpenEJBException: Creating application failed: /home/wfro/temp/apache-tomcat-6.0.29/apps/opencrx-core-CRX: null
      	at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:679)
      	at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
      	at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
      	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
      	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
      	at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
      	at org.apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.java:161)
      	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.openejb.loader.Embedder.init(Embedder.java:75)
      	at org.apache.openejb.tomcat.loader.TomcatHook.hook(TomcatHook.java:137)
      	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.openejb.tomcat.loader.TomcatEmbedder.embed(TomcatEmbedder.java:92)
      	at org.apache.openejb.tomcat.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java:64)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      	at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
      	at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
      	at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
      	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.load(Bootstrap.java:261)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: java.lang.NullPointerException
      	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1389)
      	at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:188)
      	at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658)
      	... 28 more
      

      Debugging shows that the reason is in the constructor of TomcatWebAppBuilder. I can fix the NullPointer if I patch the constructor as follows:

      OLD:

      for (LifecycleListener listener : host.findLifecycleListeners()) {
          if (listener instanceof HostConfig) {
      	HostConfig hostConfig = (HostConfig) listener;
      	deployers.put(host.getName(), hostConfig);
          }
      }
      

      NEW:

      if (listener instanceof HostConfig) {
          HostConfig hostConfig = (HostConfig) listener;
          if(hostConfig.getConfigBaseName() != null) { 
      	    deployers.put(host.getName(), hostConfig);
          }
      }
      

      In some cases the method getConfigBaseName() returns null (I suppose in the cases when the context.xml is put in the web module META-INF and not in conf/Catalina/localhost).

      Adding a hostConfig to the deployers map with hostConfig.getConfigBaseName() == null results in the reported NPE in org.apache.catalina.startup.HostConfig.manageApp.

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

        Activity

        No work has yet been logged on this issue.

          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