Java Maven build failure
jamesolas
FREEOP

4 months ago

java.lang.NoClassDefFoundError errror due to not being able to find

com.equiz.project.EquizApplication.main

The pom file specifies com.equiz.project.EquizApplication.

I think this is happening because Railway is adding "main" to the end of the build path.

Solved$10 Bounty

4 Replies

4 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 4 months ago


4 months ago

Can you share the repository please?


jamesolas
FREEOP

4 months ago

I use Maven. My POM file build section:

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-jar-plugin</artifactId>

<configuration>

<archive>

<manifest>

<addClasspath>true</addClasspath>

<mainClass>com.equiz.project.EquizApplication</mainClass>

</manifest>

</archive>

</configuration>

</plugin>

</plugins>

</build>

Package path:

com.equiz.project

Main application class name:

EquizApplication

Below is the build error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication

at com.equiz.project.EquizApplication.main(EquizApplication.java:11)

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)


4 months ago

I hate Java.

I hate Maven even more. Using Maven over Gradle in 2025 is literally insanity.

You should ask your question in a SpringBoot targeted server. People here are not fluent in SpringBoot, and your issue has nothing to do with Railway.


jamesolas
FREEOP

4 months ago

It works now. Below is the build section I used.

This is a Java project using SpringBoot framework with Maven for dependency management.

<build>

<plugins>

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

</plugins>

</build>


Status changed to Solved brody 4 months ago


Loading...