How to Fix “java/lang/NoClassDefFoundError: java/lang/Object” When Starting Tomcat 6.0 Service on Windows


4 views

When attempting to start Apache Tomcat 6.0 as a Windows service, the service fails immediately with the following critical error in jakarta_service.log:

[2010-04-08 14:22:42] [info] Error occurred during initialization of VM
[2010-04-08 14:22:42] [info] java/lang/NoClassDefFoundError
[2010-04-08 14:22:42] [info] : java/lang/Object

The error indicates the JVM cannot find java.lang.Object - the root class of Java's class hierarchy. This suggests either:

  • The Java installation is corrupted
  • JRE path configuration is fundamentally wrong
  • Environment variables aren't properly set

First verify your Java installation:

# Command prompt check
java -version
javac -version

If these commands fail or show mismatched versions, you likely have multiple conflicting Java installations. The JRE referenced in JRE_HOME must match the architecture (32/64-bit) of your Tomcat installation.

1. Environment Variable Configuration
Ensure these variables exist in System Properties > Environment Variables:

JRE_HOME=C:\Program Files\Java\jre6
PATH=%JRE_HOME%\bin;...existing paths...

2. Tomcat Service Reconfiguration
Run this from Tomcat's bin directory:

# Remove existing service
tomcat6 //DS//Tomcat6

# Reinstall with correct JVM
tomcat6 //IS//Tomcat6 --Jvm="C:\Program Files\Java\jre6\bin\server\jvm.dll"

If issues persist, check the registry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\Java

Verify all paths point to valid JRE6 locations.

For clean installations:

  1. Uninstall all Java versions
  2. Install only Java 6 JRE (not JDK)
  3. Reinstall Tomcat 6.0.35+ (later 6.0.x releases)
  4. Use the 32-bit version if on 64-bit Windows

After applying fixes, check the service startup with:

sc query Tomcat6
eventvwr.msc (check Application logs)

When attempting to start Tomcat 6.0 as a Windows service, the Java Virtual Machine fails to initialize with a critical error:

java/lang/NoClassDefFoundError: java/lang/Object

This fundamental error indicates the JVM cannot find core Java classes during bootstrap, which typically points to either:

  • Severe JRE installation corruption
  • Incorrect environment variable configuration
  • Mismatched Java/Tomcat versions

First verify your Java installation by running these commands in Command Prompt:

java -version
javac -version

For Tomcat 6.0, you should see output similar to:

java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)

Update your system environment variables (Control Panel > System > Advanced > Environment Variables):

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45
JRE_HOME=C:\Program Files\Java\jre6
CATALINA_HOME=C:\apache-tomcat-6.0.53

Add to Path variable:

%JAVA_HOME%\bin;%JRE_HOME%\bin;%CATALINA_HOME%\bin

If the issue persists, recreate the Tomcat service with proper Java paths:

cd %CATALINA_HOME%\bin
tomcat6 //DS//Tomcat6 ++Jvm="C:\Program Files\Java\jre6\bin\server\jvm.dll"
tomcat6 //US//Tomcat6 --JvmMs=256 --JvmMx=512

Add explicit classpath to Tomcat's service configuration:

tomcat6 //US//Tomcat6 --Classpath="%JRE_HOME%\lib\rt.jar;%JRE_HOME%\lib\jce.jar"

After making changes, restart the service and check logs:

net stop Tomcat6
net start Tomcat6
type "%CATALINA_HOME%\logs\catalina.log" | more

Successful startup should show:

INFO: Server startup in 1234 ms

If the issue persists, try these advanced steps:

  1. Completely uninstall Java and Tomcat, then reinstall
  2. Use Process Monitor to check file access patterns during startup
  3. Test with different JVM implementations (e.g., IBM J9)