Search code examples
javaintellij-ideaideruntime-errorexecutable-jar

Problem with running Project outside of IDE


My question is the following: When i start my programm inside my IDE (IntelliJ) via the run main class button, my project just works fine. I later found out that when i shadow Jar my project and try to run it outside of my IDE (IntelliJ) it throws me an error that some type of Class was not found. I alreay tried to use the artifact build system of my IDE (IntelliJ) but no success. I apperiate any help!

Pictures:

Running inside my IDE: running my programm inside my ide

Running my Shadow Jar outside of my IDE: running my jar outside of intellij

Error when running outside of IntelliJ:

[etp239465106-49] WARN org.eclipse.jetty.io.ManagedSelector - Could not accept java.nio.channels.SocketChannel[closed]: java.lang.IllegalStateException: Connection rejected: No ALPN Processor for sun.security.ssl.SSLEngineImpl from [org.eclipse.jetty.alpn.conscrypt.server.ConscryptServerALPNProcessor@3af94f7b]

My gradle.build file:

plugins {
    id 'java'
    id "com.github.johnrengelman.shadow" version "8.1.1"
}

group = 'me.alex'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation ('com.github.GoldenGamerLP:DependencyLoader:eed2460e41') {
        exclude module: 'DependencyExamples'
    }

    annotationProcessor('com.github.GoldenGamerLP:DependencyLoader:eed2460e41') {
        exclude module: 'DependencyExamples'
    }

    implementation 'org.slf4j:slf4j-simple:2.0.7'
    //Javalin
    implementation 'io.javalin:javalin:5.6.2'

    implementation 'com.github.HttpMarco:Aeon:-SNAPSHOT'
    //JsonParser
    implementation 'com.google.code.gson:gson:2.8.8'

    //Lombok
    implementation 'org.projectlombok:lombok:1.18.28'
    annotationProcessor 'org.projectlombok:lombok:1.18.28'
    //OpenAPI
    compileOnly 'io.javalin.community.openapi:javalin-openapi-plugin:5.6.2'

    implementation 'io.javalin.community.ssl:ssl-plugin:5.6.2'

    implementation ('org.eclipse.jetty:jetty-nosql:11.0.15') {
        exclude group: 'org.mongodb'
    }

    compileOnly 'org.mongodb:mongodb-driver-sync:4.6.0'
}

//Manifest
jar {
    manifest {
        attributes(
                'Main-Class': 'me.alex.app.street14endpoint.EndpointBootstrap',
                'Multi-Release': true
        )
    }
}

Unfortunately my project is private, but feel free to ask for anything regarding the code!

I tried to:

  1. Build a Shadow/Uber/Fat Jar and running it (which gives the error message)
  2. Give the jar full permissions
  3. Reporgramed it several times
  4. I asked my tech teacher for advice but he did not knew anything regarding this issue
  5. I opened an issue on github for the ssl plugin, but no one answered yet
  6. I spoke to the discord members on their discord, they came to the conclusion that its my fault. (I dont know whats wrong)

Solution

  • I fixed the same issue by adding this line to my dependencies:

    implementation 'org.eclipse.jetty:jetty-alpn-java-server:11.0.18'
    

    It seems to be a problem with the dependency imported by Javalin-SSL.