Waffle 1.3 Tomat 6 service : startup fail with ClassDefNotFound

Apr 21, 2011 at 2:33 PM

Hello everybody,

First of all : thanks for the product...

We are using Waffle 1.3 and a servlet filter with Tomcat 6.0.29. We have put the following jars in tomcat's lib directory :

  • commons-logging-1.1.1.jar
  • jna.jar
  • platform.jar
  • waffle-jna.jar

This is just working fine as long as tomcat is started using startup.bat. So far so good...

The issue is that starting tomcat in console mode is not suittable for production. So, we have set-up tomcat as a Windows service using tomcat6w.exe.
Then, at startup, tomcat raise class not found exception :

java.lang.NoClassDefFoundError: org/apache/catalina/authenticator/AuthenticatorBase

In service mode and without Waffle, the web application itself is working fine. Even after adding the folowwing to the "Java classpath" properties of the service definition, we get the above exceptions : D:\apache-tomcat-6.0.29\bin\bootstrap.jar;D:\apache-tomcat-6.0.29\lib\jna.jar;D:\apache-tomcat-6.0.29\lib\platform.jar;D:\apache-tomcat-6.0.29\lib\waffle-jna.jar;D:\apache-tomcat-6.0.29\lib\commons-logging-1.1.1.jar 

 Has anyone an idea about why tomcat6w.exe does not take the classpath into account at startup ?

 We tried the Tomcat 6 installer as wall as Tomcat 6 as a zip file. Defining the tomcat service with both packaging leads to the same issue. (I found another post here where using Tomcat6 zip file allowed to set-up a well working tomcat service). I found severals posts here related to similar issue. But none of them helps me to resolve this issue.

Here is a piece of the script I am using to create the Tomcat services for the miscellaneous applications :

echo on
set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
set PR_CLASSPATH=%CATALINA_HOME%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_HOME%\lib\jna.jar;%CATALINA_HOME%\lib\platform.jar;%CATALINA_HOME%\lib\waffle-jna.jar;%CATALINA_HOME%\lib\commons-logging-1.1.1.jar
set PR_STDOUTPUT=%PR_LOGPATH%\catalina.out
set PR_STDERROR=%PR_LOGPATH%\catalina.out
@echo off
%EXECUTABLE% //IS//%SERVICE_NAME% --DisplayName=%SERVICE_DISPLAY_NAME% --Description=%SERVICE_DESC% --Startup=manual --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
@if errorlevel 1 goto installError
if not '%SERVICE_DESC%' == '' %EXECUTABLE% //US//%SERVICE_NAME% --Description %SERVICE_DESC%
%EXECUTABLE% //US//%SERVICE_NAME% --JvmOptions="-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-XX:MaxPermSize=256M" 
@if errorlevel 1 goto installError
%EXECUTABLE% //US//%SERVICE_NAME% --JvmMs=256 --JvmMx=512
@if errorlevel 1 goto installError

Thansk in advance for your help.

Kind regards,

      Patrick Guillot

Apr 23, 2011 at 11:05 PM

I would ask the Tomcat mailing list. But generally that means that the class loader that loaded waffle.jar can't find (doesn't have access) to the AuthenticatorBase class. It could have something to do with java.endorsed.dirs, but I am not an expert in class loading.