T. Kah
T. Kah

Reputation: 21

New generated jhipster app not showing front-end in prod mode (404 error)

I generated a completely new jhipster app without touching the generated source. After that I build with the commands (according to docs):

./gradlew -Pprod bootWar jibExportDockerContext && docker build -t
myimage build/jib-docker-context

a docker image and started in docker. But I cannot reach the angular frontend. It gives me a 404 error with the following console output

A parser-blocking, crosssite (i.e. different eTLD+1) script,
https://linkhelp.clients.google.com/tbproxy/lh/wm?sourceid=wm&url=http%3A%2F%2Flocalhost%3A8080%2F&hl=de&site=localhost%3A8080&error=http404&js=true,
is invoked via document.write. The network request for this script MAY
be blocked by the browser in this or a future page load due to poor
network connectivity. If blocked in this page load, it will be
confirmed in a subsequent console message. See
https://www.chromestatus.com/feature/5718547946799104 for more
details.
    Qc @ fixurl.js:142
    ke @ fixurl.js:143
    (anonymous) @ fixurl.js:143

During the building and starting the image (container) there are no erros. The backend (management/health) is reachable through curl. Starting the app in dev mode is working (but not in docker container). The only thing what I think is a little bit confusing is that the Hazelcast ist in dev mode when starting in prod mode.

 jhipster-app_1         | 2019-03-01 09:04:30.981  INFO 1 --- [       
main] com.hazelcast.system                     : [172.21.0.3]:5701
[dev] [3.9.4] Hazelcast 3.9.4 (20180420 - b8001d5) starting at
[172.21.0.3]:5701
    jhipster-app_1         | 2019-03-01 09:04:30.982  INFO 1 --- [           main] com.hazelcast.system                     : [172.21.0.3]:5701
[dev] [3.9.4] Copyright (c) 2008-2018, Hazelcast, Inc. All Rights
Reserved.
    jhipster-app_1         | 2019-03-01 09:04:30.983  INFO 1 --- [           main] com.hazelcast.system                     : [172.21.0.3]:5701
[dev] [3.9.4] Configured Hazelcast Serialization version: 1
    jhipster-app_1         | 2019-03-01 09:04:31.283  INFO 1 --- [           main] c.h.s.i.o.impl.BackpressureRegulator     : [172.21.0.3]:5701
[dev] [3.9.4] Backpressure is disabled
    jhipster-app_1         | 2019-03-01 09:04:31.840  INFO 1 --- [           main] com.hazelcast.instance.Node              : [172.21.0.3]:5701
[dev] [3.9.4] Creating MulticastJoiner
    jhipster-app_1         | 2019-03-01 09:04:32.027  INFO 1 --- [           main] c.h.s.i.o.impl.OperationExecutorImpl     : [172.21.0.3]:5701
[dev] [3.9.4] Starting 2 partitio`enter code here`n threads and 3
generic threads (1 dedicated for priority tasks)
    jhipster-app_1         | 2019-03-01 09:04:32.042  INFO 1 --- [           main] c.h.internal.diagnostics.Diagnostics     : [172.21.0.3]:5701
[dev] [3.9.4] Diagnostics disabled. To enable add
-Dhazelcast.diagnostics.enabled=true to the JVM arguments.
    jhipster-app_1         | 2019-03-01 09:04:32.052  INFO 1 --- [           main] com.hazelcast.core.LifecycleService      : [172.21.0.3]:5701
[dev] [3.9.4] [172.21.0.3]:5701 is STARTING
    jhipster-app_1         | 2019-03-01 09:04:34.329  INFO 1 --- [           main] com.hazelcast.system                     : [172.21.0.3]:5701
[dev] [3.9.4] Cluster version set to 3.9
    jhipster-app_1         | 2019-03-01 09:04:34.330  INFO 1 --- [           main] c.h.internal.cluster.ClusterService      : [172.21.0.3]:5701
[dev] [3.9.4]
JHipster v5.8.2 H2 (dev) postgres (prod)

the yo-rc.json:

{
    "generator-jhipster": {
        "promptValues": {
            "packageName": "com.mycompany.myapp"
        },
        "jhipsterVersion": "5.8.2",
        "applicationType": "monolith",
        "baseName": "testapp",
        "packageName": "com.mycompany.myapp",
        "packageFolder": "com/mycompany/myapp",
        "serverPort": "8080",
        "authenticationType": "jwt",
        "cacheProvider": "hazelcast",
        "enableHibernateCache": true,
        "websocket": false,
        "databaseType": "sql",
        "devDatabaseType": "h2Disk",
        "prodDatabaseType": "postgresql",
        "searchEngine": false,
        "messageBroker": false,
        "serviceDiscoveryType": false,
        "buildTool": "gradle",
        "enableSwaggerCodegen": false,
        "jwtSecretKey": "deleted",
        "clientFramework": "angularX",
        "useSass": true,
        "clientPackageManager": "npm",
        "testFrameworks": [],
        "jhiPrefix": "jhi",
        "entitySuffix": "",
        "dtoSuffix": "DTO",
        "otherModules": [],
        "enableTranslation": false
    }
}

Upvotes: 1

Views: 750

Answers (1)

T. Kah
T. Kah

Reputation: 21

I do not know why, but the folder www is not copied into the jibContext Folder resources/static as defined in the docker.gradle file. After creating the context and copying manually the www folder to jib-docker-context/resources/static, building the docker image the things are working properly.

Perhaps a bug?

Upvotes: 1

Related Questions