1
votes

Using my application through jhipster

https://github.com/trustjalaj/DockerDemo and environment of java 8

I created a war file using ./gradlew bootWar command for prod profile and then I executed it in my Linux(Ubuntu) Laptop using below commands

Things I Did

Assume I am in Application Home folder i.e /media/jalaj/OS/DockerDemo

I used

1)build/libs/checking-docker-0.0.1-SNAPSHOT.war and

2)java -jar build/libs/checking-docker-0.0.1-SNAPSHOT.war

I did not see any UI component loaded for the latter but it showed the application has started on localhost:8080

and the former command shows error

build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 1: $'PK\003\004': command not found
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 2:5F,Morg/PK: No such file or directory
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 3:5F,Morg/springframework/PK: No such file or directory
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 4:5F,Morg/springframework/boot/PK: No such file or directory
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 5: $'\b5F,M': command not found
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 6:5F,M%org/springframework/boot/loader/data/PK: No such file or directory
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 7:5F,M/springframework/boot/loader/jar/PK: No such file or directory
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 8: syntax error near unexpected token `$'org/springframework/boot/loader/archive/PK\003\004''
build/libs/checking-docker-0.0.1-SNAPSHOT.war: line 8: 5F,M(org/springframework/boot/loader/archive/PK'

3)I have also followed the docs https://www.jhipster.tech/production/

for execution and it said that something like .original.war will also be created in build/libs folder but I can't see the orginal war present in the same directory

I also read other SO answers and I find that it needs to be deployeded on tomcat server as nginx is not a servlet container.

Can any experienced person guide on how to execute the war file.

1
Which JDK version are you using? Are you using a dev or prod build.. Is your question about prod deployment or also about dev? The way you start the app using java -jar is correct though in dev it's usually simpler to use gradlew (see your project's README.md), anyway I suggest you avoid to deploy in an app server like tomcat, it's much more complex for little benefits.Gaël Marziou
@GaëlMarziou I am using Jdk 8 and I am using prod build.Jal Abhi
@GaëlMarziou Okay I will use gradlew thankx.How about prod?Jal Abhi
Well I don't know, your problem seems to be related to classpath or packaging.Gaël Marziou
@GaëlMarziou Thankx for being thereJal Abhi

1 Answers

1
votes

For the Dev profile as suggested by @GaëlMarziou ./gradlew is working fine and for the prod profile as mentioned in the readme of my project is working fine

./gradlew -Pprod clean bootWar

java -jar build/libs/*.war