0

I am making a simple Jersey-Spring webapp. While deploying the app, I am getting errors like this

~/W/repo/webapp$ mvn tomcat7:run [INFO] Scanning for projects... [INFO] [INFO] -----------------< com.tarkshala.sudoku:Mudoku-webapp >----------------- [INFO] Building Mudoku-webapp 1.0 [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ Mudoku-webapp >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Mudoku-webapp --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ Mudoku-webapp --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ Mudoku-webapp <<< [INFO] [INFO] [INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ Mudoku-webapp --- [INFO] Running war on http://localhost:8080/Mudoku-webapp [INFO] Creating Tomcat server configuration at /Users/kuldeep/Work/repos/Mudoku-webapp/target/tomcat [INFO] create webapp with contextPath: /Mudoku-webapp Apr 20, 2020 10:18:52 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Apr 20, 2020 10:18:52 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Tomcat Apr 20, 2020 10:18:52 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Apr 20, 2020 10:18:52 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/jakarta/json/jakarta.json-api/1.1.5/jakarta.json-api-1.1.5.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976) . . . . Apr 20, 2020 10:18:52 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1961) . . . . Apr 20, 2020 10:18:52 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/ow2/asm/asm/7.1/asm-7.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010) . . . . Apr 20, 2020 10:18:52 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) . . . . . Apr 20, 2020 10:18:52 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) . . . . Apr 20, 2020 10:18:53 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/ow2/asm/asm-util/7.1/asm-util-7.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) . . . . Apr 20, 2020 10:18:53 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) . . . . Apr 20, 2020 10:18:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/apache/logging/log4j/log4j-api/2.13.1/log4j-api-2.13.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) . . . . Apr 20, 2020 10:18:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) . . . . . Apr 20, 2020 10:18:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/jakarta/ws/rs/jakarta.ws.rs-api/2.1.6/jakarta.ws.rs-api-2.1.6.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) . . . . Apr 20, 2020 10:18:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [module-info.class] from Jar [jar:file:/Users/kuldeep/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.2/jakarta.xml.bind-api-2.3.2.jar!/] for annotations org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19 at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:133) at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60) at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209) at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2134) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1961) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1319) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:830) Apr 20, 2020 10:18:54 PM org.apache.catalina.core.ApplicationContext log INFO: 1 Spring WebApplicationInitializers detected on classpath Apr 20, 2020 10:18:54 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Apr 20, 2020 10:18:54 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization started Apr 20, 2020 10:18:54 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh INFO: Refreshing Root WebApplicationContext: startup date [Mon Apr 20 22:18:54 IST 2020]; root of context hierarchy Apr 20, 2020 10:18:54 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [applicationContext.xml] Apr 20, 2020 10:18:54 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init> INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2020-04-20 22:18:55,340 localhost-startStop-1 DEBUG Apache Log4j Core 2.13.1 initializing configuration XmlConfiguration[location=/Users/kuldeep/Work/repos/Mudoku-webapp/target/classes/log4j2.xml] 2020-04-20 22:18:55,349 localhost-startStop-1 DEBUG Installed 0 script engines 2020-04-20 22:18:55,349 localhost-startStop-1 DEBUG PluginManager 'Core' found 123 plugins 2020-04-20 22:18:55,350 localhost-startStop-1 DEBUG PluginManager 'Level' found 0 plugins 2020-04-20 22:18:55,352 localhost-startStop-1 DEBUG PluginManager 'Lookup' found 16 plugins . . . . . 2020-04-20 22:18:55,457 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=7bb79d55,component=ContextSelector 2020-04-20 22:18:55,459 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=7bb79d55,component=Loggers,name= 2020-04-20 22:18:55,460 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=7bb79d55,component=Loggers,name=com.tarkshala.sudoku 2020-04-20 22:18:55,462 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=7bb79d55,component=Appenders,name=LogToRollingRandomAccessFile 2020-04-20 22:18:55,463 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=7bb79d55,component=Appenders,name=LogToConsole 2020-04-20 22:18:55,467 localhost-startStop-1 DEBUG org.apache.logging.log4j.core.util.SystemClock supports precise timestamps. 2020-04-20 22:18:55,468 localhost-startStop-1 DEBUG Reconfiguration complete for context[name=7bb79d55] at URI /Users/kuldeep/Work/repos/Mudoku-webapp/target/classes/log4j2.xml (org.apache.logging.log4j.core.LoggerContext@7b055925) with optional ClassLoader: null 2020-04-20 22:18:55,469 localhost-startStop-1 DEBUG Shutdown hook enabled. Registering a new one. 2020-04-20 22:18:55,470 localhost-startStop-1 DEBUG LoggerContext[name=7bb79d55, org.apache.logging.log4j.core.LoggerContext@7b055925] started OK. Apr 20, 2020 10:18:55 PM org.springframework.web.context.ContextLoader initWebApplicationContext INFO: Root WebApplicationContext: initialization completed in 824 ms Apr 20, 2020 10:18:56 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] 

The pom file looks like this

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.tarkshala.sudoku</groupId> <artifactId>Mudoku-webapp</artifactId> <packaging>war</packaging> <version>1.0</version> <name>Mudoku-webapp</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>11</java.version> <jersey.version>2.30.1</jersey.version> <commons-logging-version>1.2</commons-logging-version> <apache-log4j-version>2.13.1</apache-log4j-version> <lombok-version>1.18.12</lombok-version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> </properties> <build> <finalName>Mudoku-webapp</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <inherited>true</inherited> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> </plugin> </plugins> </build> <dependencyManagement> <dependencies> <dependency> <groupId>org.glassfish.jersey</groupId> <artifactId>jersey-bom</artifactId> <version>${jersey.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Jersey related dependencies start --> <!-- It also contains jersey's spring requirements for DI --> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId> <version>${jersey.version}</version> </dependency> <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-moxy</artifactId> <version>${jersey.version}</version> </dependency> <dependency> <groupId>org.glassfish.jersey.ext</groupId> <artifactId>jersey-spring4</artifactId> <version>${jersey.version}</version> </dependency> <!-- Javax dependencies start --> <!-- Not sure where is this getting used, but gives error if removed --> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1.1</version> </dependency> <!-- Javax dependencies end --> <!-- Tomcat/Jersey'requirement dependency start --> <!-- Not sure where is this getting used, but gives error if removed --> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>${commons-logging-version}</version> </dependency> <!-- Tomcat/Jersey'requirement dependency end --> <!-- Log4j Logging dependencies start --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>${apache-log4j-version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>${apache-log4j-version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-web</artifactId> <version>${apache-log4j-version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <version>2.13.1</version> </dependency> <!-- Log4j Logging dependencies end --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok-version}</version> </dependency> </dependencies> </project> 

Surprisingly, this is working in Intellij's Run Configuration where I configured a Tomcat Servlet-Container only?

I am tired of debugging and out of all the options I could think of. Any help or hint will be hugely appreciated.

1
  • I was able to deploy the war on already running instance of Tomcat-9 and Tomcat-7 as well. But maven-tomcat-plugin is not working. Commented Apr 21, 2020 at 2:22

2 Answers 2

0

module-info.class was introduced in Java 9. Libraries have been adding the class to their jars since then. Libraries that place the module-info.class file in the root are likely to have problems working with applications running in Java 8 or earlier. However, you will notice that it is also complaining about the module-info.class file for Log4j-API which is located in META-INF/versions/9. Applications prior to Java 9 shouldn't be looking in META-INF for class files as that was an invalid location. It appears the Maven plugin might be using an older version of Tomcat that needs to be upgraded. This stackoverlow answer provides more details on the tomcat version. You simply need to find out what artifact the plugin is using and then add a newer version of it as a dependency to the plugin.

After modification your plugin should look something like:

 <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <dependencies> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat7Version}</version> </dependency> ... </dependencies> </plugin> 

but should include all the dependencies listed in the plugin's pom.xml and with the tomcat7Version being set to 7.0.56 or higher. The version of tomcat7-maven-plugin you are using uses 7.0.47 of tomcat, which has this problem.

Sign up to request clarification or add additional context in comments.

3 Comments

There are no newer versions of maven-tomcat-plugin, shall I have to change the way to deploy my App?
I didn't tell you to update the version of the maven tomcat plugin. You need to add a dependency to the plugin configuration in your pom.xml. That dependency needs to be the newer version of whatever tomcat dependencies that plugin uses. You should be able to find that by looking at the pom.xml for the plugin.
I used all the dependencies of the latest versions.
0

I found a workaround for tomcat plugin. Basically, there is Heroku webapp plugin is available. I added the plugin to my pom as following:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals><goal>copy</goal></goals> <configuration> <artifactItems> <artifactItem> <groupId>com.heroku</groupId> <artifactId>webapp-runner</artifactId> <version>9.0.30.0</version> <destFileName>webapp-runner.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> 

And I changed the way to start my application. Presently, I am using heroku-webapp-runner jar as following:

java -jar target/dependency/webapp-runner.jar target/*.war 

This can also be considered an alternate to maven-tomcat-plugin for Tomcat-9.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.