java.lang.NoClassDefFoundError when deploying to Glassfish application server

81 views Asked by At

I have created a simple demo rest service which queries Ethereum to get basic information. I am using the Web3j library version 5.0.0 https://mvnrepository.com/artifact/org.web3j/core/5.0.0

I have added the library to the project using Maven. Built the project which compiles successfully and trying to debug it. I am using GlassFish 6.2.51 for my application server.

Any ideas why I am getting the below error?

[2023-02-09 11:44:19,706] Artifact demoapi:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoClassDefFoundError: org/web3j/protocol/Web3jService.

1

There are 1 answers

0
Yahor On

Try to delete target directory with maven clean, and deploy app again