JPro-one / JPro-Tickets

The right place to report about bugs or suggest improvements for JPro.
https://www.jpro.one
9 stars 4 forks source link

How to deploy JPro-one JavaFx App on Heroku server? #103

Open lepton-gmbh opened 3 years ago

lepton-gmbh commented 3 years ago

Hi. im trying to deploy a JPro-one server with maven in Heroku. i have follow this one starckoverflow question to deploy it, uploading build packs github.com/heroku/heroku-buildpack-apt and a Aptfile. i also upload a a system.properties to change to jdk11 and Procfile with the instruction web: java $JAVA_OPTS -cp target/classes:target/dependency/* com.mycompany.mavenproject2.App but no way. its right deployed with heroku but it returns H10 error Heroku log --tail.

21-05-25T23:39:21.819064+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 2021-05-25T23:39:22.028473+00:00 app[web.1]: Error: JavaFX runtime components are missing, and are required to run this application

i´m deploying with mvn clean heroku:deploy as order instead of git push heroku master because i have installed after create process 2 building packs: https://github.com/jkutner/heroku-buildpack-javafx and https://github.com/heroku/heroku-buildpack-apt.git to get the libraries for the stack of heroku that are ubuntu 20.04 as same as you recomend in apt-get install xorg gtk2-engines libasound2 libgtk2.0-0.

Any idea Florian would be wellcome. im 3 days working with this. i´m sure its possible, only that i havent any idea how to do it.

FlorianKirmaier commented 3 years ago

I'm pretty sure you cannot use the javafx buildpack. It uses Java8 (no longer supported by JPro) and nowadays, JavaFX is no longer part of the JDK (except for some strange JDKs).

Calling the java command directly is not recommended. The JPro Plugins download various dependencies and add various parameters to the application. Actually, I don't think it's possible to not use the JProPlugins, without immense effort and internal knowledge.

I would recommend yourself to orient yourself on this Heroku sample: https://github.com/FlorianKirmaier/JPro-Heroku/blob/master/Dockerfile

We probably should make it and official example.

lepton-gmbh commented 3 years ago

Unfortunately i havent been lucky with this. i have been working for a couple of days with this threath of work and in the other hand trying to exploit jproserver in raspberry pi, with not good results.

in Heroku, compilation seems to be ok modifying the docker line you give in the upper case, but the server sometimes is able to load bash script of the release aplication, and sometimes fails, and gives strange --log tails. https://hdockfinaly22.heroku.com/ this is the link. sometimes works some times not.

In raspberry pi when i try to exploit jpro locally with maven, it says architecture mismatch... it seems realise that the sdk 16 of javafx in the original program in apache netbeans, and when compiles and loads sdk armhf arquitecture, it is not eable. the only way i found to resolve the problem, its to execute netbeans in raspberry pi localy, and exploit there aplication localy .... but this all project is something im going to leave for this summer holidays. im very bussy at work now, and this takes me lots of time.

this will continue...

lepton-gmbh commented 3 years ago

when i run in raspberry pi, with exploid jpro in amd64 arch, the zip i get taken to pi..... i run bash ./start.sh error. no charged libraries because dismatch.

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:8080 [info] c.jpro.activity - Starting the server [info] c.j.i.s.Initializer$ - Starting JPro: https://www.jpro.one/ [info] c.j.i.s.Initializer$ - OS: Linux [info] c.j.i.s.Initializer$ - JPro: 2021.1.1 [info] c.j.i.s.Initializer$ - Java version: 11.0.11 [info] c.j.i.s.Initializer$ - JVM: 11.0.11 AdoptOpenJDK [info] c.j.i.s.Initializer$ - redirected OUT / ERR [info] c.j.i.s.Initializer$ - installed SLF4JBridge [info] c.j.i.s.MonocleInitializer$ - screen: null [warn] javafx - Unsupported JavaFX configuration: classes were loaded from 'unnamed module @1a3f75b' OpenJDK Server VM warning: You have loaded library /root/.openjfx/cache/16.0.0.2-jpro/libprism_es2.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'. Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /root/.openjfx/cache/16.0.0.2-jpro/libprism_es2.so: /root/.openjfx/cache/16.0.0.2-jpro/libprism_es2.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch) architectures words mismatch el programa roto y no me deja ni escapar de la aplicacion cancelar ni reboot. he de apagar la pi.

now deploying the app first time in pi. problem seems to be the same.

el error parece ser el mismo

[INFO] [INFO] Waiting for JPro Server WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/root/.m2/repository/com/google/inject/guice/4.2.3/guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [info] a.e.s.Slf4jLogger - Slf4jLogger started [info] play.api.Play - Application started (Prod) (no global state) [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:8080 [info] c.jpro.activity - Starting the server [info] c.j.i.s.Initializer$ - Starting JPro: https://www.jpro.one/ [info] c.j.i.s.Initializer$ - OS: Linux [info] c.j.i.s.Initializer$ - JPro: 2021.1.1 [info] c.j.i.s.Initializer$ - Java version: 11.0.11 [info] c.j.i.s.Initializer$ - JVM: 11.0.11 AdoptOpenJDK [info] c.j.i.s.Initializer$ - redirected OUT / ERR [info] c.j.i.s.Initializer$ - installed SLF4JBridge [info] c.j.i.s.MonocleInitializer$ - screen: null [warn] javafx - Unsupported JavaFX configuration: classes were loaded from 'unnamed module @14d7b25' OpenJDK Server VM warning: You have loaded library /root/.openjfx/cache/16.0.0.2-jpro/libprism_es2.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecsta architectures words mismatch

How shall i tell (which command) that the sdk16 for javafx deploying with maven, is armhf architecture which has been downloaded there in pi such mvn and jdk11 from adoptjdk ???

heroku problems yet. heroku.yml i simply wrote.

1) build: docker: web: Dockerfile

docker file:

FROM adoptopenjdk:11-hotspot-bionic RUN apt-get update RUN apt-get -y install xorg gtk2-engines libasound2 libgtk2.0-0

Added in docker-compose.yml

ADD . jproserver/

CMD (chmod +x ./bin/start.sh; bash ./bin/start.sh)

i think this should be enough to the deployed app start.sh script, but i believe heroku dont understand this with stack 18...

¿is this the reason of finaly lines ?

RUN chmod +x ./app-jpro/bin/start.sh RUN ["sh", "-c", "echo -Dhttp.port=$PORT"] CMD ["sh", "-c", "./app-jpro/bin/start.sh -Dhttp.port=$PORT"]

¿ports writen like this or 8080 here above ?

?

FlorianKirmaier commented 3 years ago

Now we have 2 topics, Heroku and raspberry,

Heroku: The link doesn't work on my machine. Can you post the "strange logs" which you get? Then we can take a look into it.

Raspberry Pi / Arm Linux: JPro uses a forked version of JavaFX. We currently don't provide builds for Linux Arm. This is the simple reason why it doesn't work. We are probably gonna take a look into this next week. When JPro provides arm builds for Linux, it will automatically detect the correct version, and it should work automatically.