Search code examples
dockerfilextexteclipse-cheshadowjarfatjar

Fat Jar to Implement a Language Server


I am trying to build a language server to be implemented as a sidecar for eclipse che. I built a fat jar from a xtext language server that I've created. Can I use this fat jar to implement my language server in a dockerfile in order to run my language server as a container?

I wrote a Dockerfile as below:

FROM barais/eclipse-xtend
ADD build/libs/dsl-language-server-ls.jar dsl-language-server-ls.jar
RUN sudo apt-get install socat
CMD socat TCP4-LISTEN:4417,reuseaddr,fork EXEC:"mydsl"

"dsl-language-server-ls.jar" is the jar file made by building my project (i.e, the LS). My question is, can I run my language server by including the .jar file as in the above dockerfile? It actually worked in eclipse che, but I still get a broken pipe error, and a timeout error which makes me doubt my approach.

Language Server Initialization Error

This is the error I'm getting.


Solution

  • this will only work if you package your docker image correctly

    • make sure you include java 8
    • make sure that your either include not only the jar but the startupscripts from the build directory too
    • or you simply call java -jar yourjar.jar instead of the mydsl startup script