FreeKB - Tomcat Resolve "Failed to load Premain-Class manifest attribute"
Tomcat - Resolve "Failed to load Premain-Class manifest attribute"

Let's say the following is returned when attempting to start a Tomcat application server.

Failed to load Premain-Class manifest attribute

 

This typically means that the -javaagent option is being used to load a JAR file, and the JAR file's MANIFEST.MF file does not include the Premain-Class attribute. Typically, the -javaagent option and JAR file are defined in the setenv.sh file. For example, let's say setenv.sh contains the following. In this example, the foo.jar file would be the JAR file that does not include the Premain-Class attribute.

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/local/tomcat/jars/foo.jar"

 

On a Linux system, the vi editor can be used to examine the JAR file. Or, the jar -tf command can be used.

~]# jar -tf foo.jar
META-INF/MANIFEST.MF
.classpath
.project
com/foo/Bar.class

 

Let's say the MANIFEST.MF file in the JAR contains the following. In this scenario, it most certainly makes sense that "Failed to load Premain-Class manifest attribute" is being returned since the MANIFEST.MF file does not contain the Premain-Class attribute.

Manifest-Version: 1.0

 

The JAR may need to be recompiled so that the JAR contains the Premain-Class attribute, like this.

Manifest-Version: 1.0
Premain-Class: Bar

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 3a2c6 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |