i found something weird. maybe anyone can help me?...
# ktor
b
i found something weird. maybe anyone can help me? i start my ktor server with
Copy code
embeddedServer(Netty, environment = environment).start(true)
do a curl on localhost:8080/version and it works (it returns some json) .. then i only change that line to
Copy code
embeddedServer(Jetty, environment = environment).start(true)
hit the same URL and i get "curl: (52) Empty reply from server" any ideas?
setting the debug level to trace reveals an exception:
Copy code
2020-10-13 19:22:31.638 [qtp129153987-23] DEBUG org.eclipse.jetty.io.ManagedSelector -
java.lang.ExceptionInInitializerError: null
        at org.eclipse.jetty.server.HttpConnection.<clinit>(HttpConnection.java:59)
        at org.eclipse.jetty.server.HttpConnectionFactory.newConnection(HttpConnectionFactory.java:86)
        at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:618)
        at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:352)
        at org.eclipse.jetty.io.ManagedSelector.access$2000(ManagedSelector.java:62)
        at org.eclipse.jetty.io.ManagedSelector$Accept.run(ManagedSelector.java:853)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
        at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at org.eclipse.jetty.http.PreEncodedHttpField.<clinit>(PreEncodedHttpField.java:68)
        ... 9 common frames omitted
2020-10-13 19:22:31.640 [qtp129153987-23] WARN  org.eclipse.jetty.io.ManagedSelector - java.lang.ExceptionInInitializerError
2020-10-13 19:22:31.640 [qtp129153987-23] DEBUG org.eclipse.jetty.io.ManagedSelector -
java.lang.ExceptionInInitializerError: null
        at org.eclipse.jetty.server.HttpConnection.<clinit>(HttpConnection.java:59)
        at org.eclipse.jetty.server.HttpConnectionFactory.newConnection(HttpConnectionFactory.java:86)
        at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.newConnection(ServerConnector.java:618)
        at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:352)
        at org.eclipse.jetty.io.ManagedSelector.access$2000(ManagedSelector.java:62)
        at org.eclipse.jetty.io.ManagedSelector$Accept.run(ManagedSelector.java:853)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
        at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at org.eclipse.jetty.http.PreEncodedHttpField.<clinit>(PreEncodedHttpField.java:68)
        ... 9 common frames omitted
whatever that means ­čÖé
e
No idea.. If it helps I usually start with
Copy code
val server = embeddedServer(
    factory = Netty,
    module = Application::main,
    port = Config.port,
    watchPaths = Config.watchPaths,
    configure = {
        responseWriteTimeoutSeconds = Config.responseTimeout
    },
)
server.start()
where
Config
contains my environment specific values.
b
with Netty it works fine .. the problem appears when i try to run the Jetty engine
maybe it's related to some classpath error .. i run my app from a fat jar built with the gradle shadowJar plugin. maybe something goes wrong there
yes .. that was the reason
Copy code
mergeServiceFiles()
in the shadowJar configuration did the trick
­čĹŹ 1