jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.48k stars 4.02k forks source link

Weird characters when deploying to tomcat #10698

Closed bonsmik closed 4 years ago

bonsmik commented 4 years ago
Overview of the issue

After deploying application to tomcat weird chars in application.   becomes Ƃ 

Example from login page:

Screenshot 2019-10-28 at 19 41 57
Motivation for or Use Case

Instead of using boxfuse to deploy I use jhipster aws subgenerator. Now I see those weird characters when running the application on Tomcat.

Reproduce the error

Create minimal application. Build the war as instructed. Deploy the application on tomcat. See login page.

Dockerfile for tomcat:

FROM tomcat:8.5-alpine

RUN cd webapps/ && rm ROOT -rf
ADD myapp-0.0.1-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war

EXPOSE 8080

CMD ["catalina.sh", "run"]

Steps to reproduce:

./gradlew -Pprod -Pwar clean bootWar
docker build -f Dockerfile -t myapp ./build/libs
docker run -d -p 8080:8080 myapp:latest
open "http://localhost:8080/login"
Related issues

Similar issue have been reported and fixed earlier https://github.com/jhipster/generator-jhipster/issues/8586

Suggest a Fix

Most probably something similar than in #8586

JHipster Version(s)

6.4.1

JHipster configuration
<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mycompany.myapp"
    },
    "jhipsterVersion": "6.4.1",
    "applicationType": "monolith",
    "baseName": "myapp",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "no",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "no",
    "devDatabaseType": "no",
    "prodDatabaseType": "no",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "gradle",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": false,
    "blueprints": []
  }
}

</pre>
</details>

##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>

</pre>
</details>

##### **Environment and Tools**

java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

git version 2.21.0 (Apple Git-122)

node: v12.13.0

npm: 6.12.0

yeoman: 3.1.0

yarn: 1.19.1

Docker version 19.03.4, build 9013bf5

docker-compose version 1.24.1, build 4667896b
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

macOS 10.15, reproduces on chrome, safari and firefox

ruddell commented 4 years ago

I could not reproduce with Maven, but I could reproduce with Gradle, both Angular and React. The weird characters are present on the home page with no changes in the message: You don't have an account yet?Ƃ Register a new account

I'm not familiar with Gradle so did not look into a fix.

For reference, here's the script I use for testing Tomcat (no database for easy Tomcat testing):

echo '{ "generator-jhipster": { "promptValues": { "packageName": "com.mycompany.myapp", "nativeLanguage": "en" }, "jhipsterVersion": "6.4.1", "applicationType": "gateway", "baseName": "nodb", "packageName": "com.mycompany.myapp", "packageFolder": "com/mycompany/myapp", "serverPort": "8080", "authenticationType": "uaa", "uaaBaseName": "uaa", "cacheProvider": "ehcache", "enableHibernateCache": false, "websocket": false, "databaseType": "no", "devDatabaseType": "no", "prodDatabaseType": "no", "searchEngine": false, "messageBroker": false, "serviceDiscoveryType": false, "buildTool": "gradle", "enableSwaggerCodegen": false, "clientFramework": "angular", "clientTheme": "none", "clientThemeVariant": "", "useSass": true, "clientPackageManager": "npm", "testFrameworks": [], "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", "otherModules": [], "enableTranslation": true, "nativeLanguage": "en", "languages": [ "en" ], "embeddableLaunchScript": false, "blueprints": [] } }' > .yo-rc.json
jhipster --skip-install --force
./gradlew -Pprod -Pwar clean bootWar -DskipTests
docker run -d -p 8080:8080 --name=tomcat tomcat:8.5.40-jre8-alpine
docker cp ./build/libs/nodb-0.0.1-SNAPSHOT.war tomcat:/usr/local/tomcat/webapps/ROOT.war
sleep 30
open http://localhost:8080/
atomfrede commented 4 years ago

Will have a look. Sounds strange indeed. Maybe some resource processing or so

On Mon, Oct 28, 2019, 21:07 Jon Ruddell notifications@github.com wrote:

I could not reproduce with Maven, but I could reproduce with Gradle, both Angular and React. The weird characters are present on the home page with no changes in the message: You don't have an account yet?Ƃ Register a new account

I'm not familiar with Gradle so did not look into a fix.

For reference, here's the script I use for testing Tomcat (no database for easy Tomcat testing):

echo '{ "generator-jhipster": { "promptValues": { "packageName": "com.mycompany.myapp", "nativeLanguage": "en" }, "jhipsterVersion": "6.4.1", "applicationType": "gateway", "baseName": "nodb", "packageName": "com.mycompany.myapp", "packageFolder": "com/mycompany/myapp", "serverPort": "8080", "authenticationType": "uaa", "uaaBaseName": "uaa", "cacheProvider": "ehcache", "enableHibernateCache": false, "websocket": false, "databaseType": "no", "devDatabaseType": "no", "prodDatabaseType": "no", "searchEngine": false, "messageBroker": false, "serviceDiscoveryType": false, "buildTool": "gradle", "enableSwaggerCodegen": false, "clientFramework": "angular", "clientTheme": "none", "clientThemeVariant": "", "useSass": true, "clientPackageManager": "npm", "testFrameworks": [], "jhiPrefix": "jhi", "entitySuffix": "", "dtoSuffix": "DTO", "otherModules": [], "enableTranslation": true, "nativeLanguage": "en", "languages": [ "en" ], "embeddableLaunchScript": false, "blueprints": [] } }' > .yo-rc.json

jhipster --skip-install --force

./gradlew -Pprod -Pwar clean bootWar -DskipTests

docker run -d -p 8080:8080 --name=tomcat tomcat:8.5.40-jre8-alpine

docker cp ./build/libs/nodb-0.0.1-SNAPSHOT.war tomcat:/usr/local/tomcat/webapps/ROOT.war

sleep 30

open http://localhost:8080/

ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/10698?email_source=notifications&email_token=AABRVCMJ3VY2N4QXAY3BHEDQQ5A7LA5CNFSM4JF6CDE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECOG7KA#issuecomment-547123112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRVCIUY4KYXA6VONALDT3QQ5A7LANCNFSM4JF6CDEQ .

atomfrede commented 4 years ago

I can't reproduce it on my machine. image

Sorry, just added and &nbsp; and I have the same error now.

atomfrede commented 4 years ago

I found a solution (the web.xml is missing from generated war). Will provide a PR tomorrow.