You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/08/12 12:36:54 UTC

DO NOT REPLY [Bug 51654] New: NullPointerException in startup (org.apache.catalina.startup.HostConfig.filterAppPaths) due to missing app base

https://issues.apache.org/bugzilla/show_bug.cgi?id=51654

             Bug #: 51654
           Summary: NullPointerException in startup
                    (org.apache.catalina.startup.HostConfig.filterAppPaths
                    ) due to missing app base
           Product: Tomcat 7
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: d.tonhofer@m-plify.com
    Classification: Unclassified


A hard-to-diagnose NullPointerException at startup which can be bettered with
an appropriate error message:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.19
java.lang.NullPointerException
at org.apache.catalina.startup.HostConfig.filterAppPaths(HostConfig.java:493)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:466)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)

Ok, what's this about?

In "protected String[] filterAppPaths(String[] unfilteredAppPaths)"
the exception is raised at

  for (String appPath : unfilteredAppPaths)

Which means the "unfilteredAppPaths" passed in is null. filterAppPaths does not
check for that (shouldn't there be an assertion at least)

The problems comes from "deployApps()":

    protected void deployApps() {

        File appBase = appBase();
        File configBase = configBase();
        String[] filteredAppPaths = filterAppPaths(appBase.list()); <----
        // Deploy XML descriptors from configBase
        deployDescriptors(configBase, configBase.list());
        // Deploy WARs, and loop if additional descriptors are found
        deployWARs(appBase, filteredAppPaths);
        // Deploy expanded folders
        deployDirectories(appBase, filteredAppPaths);

    }

Where "appBase.list()" returns null. This must be because "appBase" does not
actually denote a directory (A-HA!)

Indeed, the server.xml points to a nonexisting appBase.

Suggesting to add a check to "deployApps":

    protected void deployApps() {

        File appBase = appBase();
        File configBase = configBase();

        if (!appBase.exists() || appBase.list()==null) {
            throw new IllegalArgumentException("The appBase " + appBase + "
does not exist or cannot be listed");
        }

        String[] filteredAppPaths = filterAppPaths(appBase.list()); <----
        // Deploy XML descriptors from configBase
        deployDescriptors(configBase, configBase.list());
        // Deploy WARs, and loop if additional descriptors are found
        deployWARs(appBase, filteredAppPaths);
        // Deploy expanded folders
        deployDirectories(appBase, filteredAppPaths);

    }

This probably violates some I18N requirement though.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51654] NullPointerException in startup (org.apache.catalina.startup.HostConfig.filterAppPaths) due to missing app base

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51654

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> 2011-08-15 18:59:04 UTC ---
This has been fixed in trunk and 7.0.x and will be included in 7.0.21 onwards.

The fix logs an error message and disables automatic deployment if the appBase
is not a directory.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org