0

I need to deploy a aplication in railway, but any time returno this error:

Caused by: java.lang.ClassNotFoundException: br.com.zezinho.helpdesk

Error: Could not find or load main class br.com.zezinho.helpdesk

My path is correct.

github: https://github.com/Luciannodev/helpdesk-back

plugins {
   java
   id("org.springframework.boot") version "2.7.8"
   id("io.spring.dependency-management") version "1.1.0"
}


group = "br.com.zezinho"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
val mainClassName = "HelpDeskApplication.java"

configurations {
   compileOnly {
      extendsFrom(configurations.annotationProcessor.get())
   }
}

repositories {
   mavenCentral()
   maven { url = uri("https://repo.spring.io/milestone") }
   maven { url = uri("https://repo.spring.io/snapshot") }
}

dependencies {
   implementation("org.springframework.boot:spring-boot-starter-data-jpa")
   implementation("org.springframework.boot:spring-boot-starter-validation")
   implementation("org.springframework.boot:spring-boot-starter-web")
   implementation("org.springframework.boot:spring-boot-starter-security")
   implementation("io.jsonwebtoken:jjwt-api:0.11.5")
   implementation("io.jsonwebtoken:jjwt-impl:0.11.5")
   implementation("io.jsonwebtoken:jjwt-jackson:0.11.5")
   implementation("mysql:mysql-connector-java:8.0.28")
   implementation("com.h2database:h2:1.4.200")
   testImplementation("org.springframework.boot:spring-boot-starter-test")
   annotationProcessor("org.projectlombok:lombok")
}



tasks.withType<Test> {
   useJUnitPlatform()
}

tasks.jar {
   manifest.attributes["Main-Class"] = "br.com.zezinho.helpdesk"
   manifest.attributes["Class-Path"] = configurations
      .runtimeClasspath
      .get()
      .joinToString(separator = " ") { file ->
         "libs/${file.name}"
      }
}


  • You've set the main class to `br.com.zezinho.helpdesk`, which is the _package_ that contains your main class. It should be the FQN of the class. Since you're using Spring Boot, you can easily generate a correct JAR using the [`bootJar` task](https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable) - why not use that instead? – aSemy Feb 18 '23 at 16:12
  • i can genarate, railsway that can't. – LuciannoDev Feb 23 '23 at 23:15

0 Answers0