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

           Summary: Tomcat doesn't start when JULI is not used
                    (NoClassDefFoundError)
           Product: Tomcat 6
           Version: 6.0.18
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If there is no file CATALINA_BASE/conf/logging.properties, then Tomcat will not
start and the JVM outputs the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:

without any additional information.

Quoting from a user's mail:

I believe commit 652629 (which appeared in 6.0.17) broke catalina.sh startup
when JULI is not used -- that is, when $CATALINA_BASE/conf/logging.properties
does not exist.  If this file is absent, LOGGING_CONFIG is not set.  However
the variable appears quoted in the shell command to exec the JVM:

    "$_RUNJAVA" $JAVA_OPTS "$LOGGING_CONFIG" $CATALINA_OPTS ...

Which introduces an empty argument when LOGGING_CONFIG is unset, and the JVM
interprets this empty argument as the class to be invoked.

Three possible fixes are:

* Set LOGGING_CONFIG to a harmless flag if JULI is not used.  With my Sun JVM,
a plain -D is safe.  I don't know how portable this is.  It isn't very pretty.

* Maintain separate JVM invocations for the cases when LOGGING_CONFIG is set
and when it's unset.  This involves more code duplication.  The code in
question is already duplicated; I'm not sure whether that argues for or against
this strategy.

* Use a one-item shell array with an @ subscript, which is immune to word
splitting when between double quotes but expands to nothing when unpopulated. 
For example:

   
LOGGING_CONFIG[0]="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"

followed by:

    "$_RUNJAVA" $JAVA_OPTS "[EMAIL PROTECTED]" $CATALINA_OPTS ...

This method may be too clever.  I think POSIX requires shell arrays but being
portable to true Bourne shell would require $@, which is already being used.


-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to