With JHipster 6.0.1, the war generated by the command ./mvnw -Pprod,war clean verify does not serve the webapp when deployed in Tomcat. It was working fine with JHipster 5.8.2 (because war was the default package type I guess).
When the app is deployed on Tomcat (the startup is working fine) and accessed via Chrome, the following appears in the console:
Console errors
loading.css:1 Failed to load resource: the server responded with a status of 404 () main.70794c3….css:1 Failed to load resource: the server responded with a status of 404 () global.2305a38….css:1 Failed to load resource: the server responded with a status of 404 () 0.e733838….chunk.js:1 Failed to load resource: the server responded with a status of 404 () polyfills.e733838182…ea31ccb.bundle.js:1 Failed to load resource: the server responded with a status of 404 () main.e733838….bundle.js:1 Failed to load resource: the server responded with a status of 404 () global.e733838….bundle.js:1 Failed to load resource: the server responded with a status of 404 () 0.e733838….chunk.js:1 Failed to load resource: the server responded with a status of 404 () polyfills.e733838182…ea31ccb.bundle.js:1 Failed to load resource: the server responded with a status of 404 () main.e733838….bundle.js:1 Failed to load resource: the server responded with a status of 404 () global.e733838….bundle.js:1 Failed to load resource: the server responded with a status of 404 () :8080/manifest.webapp:1 Failed to load resource: the server responded with a status of 404 () :8080/manifest.webapp:1 Manifest: Line: 1, column: 1, Unexpected token. loading.css:1 Failed to load resource: the server responded with a status of 404 () global.2305a38….css:1 Failed to load resource: the server responded with a status of 404 () main.70794c3….css:1 Failed to load resource: the server responded with a status of 404 ()
On screen, the page displayed is:

Trying to execute the war from command line with java -jar testwar-0.0.1-SNAPSHOT.war output the following error:
_no main manifest attribute in .\testwar-0.0.1-SNAPSHOT.war_
Please note that this command works if I try to run the jar and not the war (with a start-class property I needed to add otherwise I had the same error).
Everything is working fine if the app is started with ./mvnw.
I use JHipster to create an app deployed on Tomcat.
I needed to upgrade JHipster because there is a bug in 5.8.2 about the Tomcat metrics (https://github.com/jhipster/generator-jhipster/issues/9195) fixed in 6.0.
The change about the war profile seems to be the cause (https://github.com/jhipster/generator-jhipster/pull/9034).
The current structure of the war is :
6.0.1
[email protected] D:\Projects\testwar
`-- [email protected]
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.test.testwar",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.0.1",
"applicationType": "monolith",
"baseName": "testwar",
"packageName": "com.test.testwar",
"packageFolder": "com/test/testwar",
"serverPort": "8080",
"authenticationType": "session",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mysql",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"rememberMeKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
"clientFramework": "angularX",
"clientTheme": "none",
"clientThemeVariant": "",
"useSass": true,
"clientPackageManager": "yarn",
"testFrameworks": ["gatling", "cucumber", "protractor"],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": ["en", "fr"]
}
}
entityName.json files generated in the .jhipster directory
JDL entity definitions
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
git version 2.21.0.windows.1
node: v10.15.3
npm: 6.4.1
yarn: 1.15.2
entityName.json files generated in the .jhipster directorynone
Windows 10
Chrome 74, IE 11, Firefox 67
Apache Tomcat 9.0.14
Apache Maven 3.6.1
I'm not sure we support WARs anymore, @PierreBesson ?
Honestly the way we do it has had numerous iterations. So it's possible that it broke at some point being rarely tested. However it does deploy correctly to appengine so the war should be valid.
The problem here seems to be that the frontend files are not properly served from the war.
@PierreBesson exactly, the app is correctly deployed. It has created my database with Liquibase and the backend is logging to the tomcat log files.
Unfortunately the frontend is not served.
Tomcat deploys under a context-path by default (yours is /testwar-0.0.1-SNAPSHOT), did you check the "Running the application under a Context Path" section of the production docs?
Yes I have tried to change the basehref but I still have the issue
What errors do you see in the browser console?
As suggested by @ruddell, you need to change the baseHref in webpack.common.js.
Just tested it, and I don't have any issue. Everything works fine for me.
See my screenshots:


I'm closing this, as I can't reproduce it.
Don't hesitate to provide more information, steps, etc, if you think there is a real bug.
Thanks guys it works fine. I did not put the last slash in the basehref path. Hope this helps someone else in the future.
Nice, good to know the last "slash" is important !
Thanks for your feedback
I am also getting the same issue with jhipster 6.3.1. I have updated the baseHref as mentioned with slashes at start and end, still not working. Please help.
I am also getting the same issue with jhipster 6.3.1. I have updated the baseHref as mentioned with slashes at start and end, still not working. Please help.
I updated my app to JHipster 6.4.1 and it works as expected.
Hi guys,
Have similar issue to resolve css/js fileswhen deploying a frontend react app using nginx on kubernetes, anyone has a clue how to setup nginx with proxy_pass for static files?
I have changed baseHref on webpack.common.js and added nginx_proxy pass following https://www.jhipster.tech/separating-front-end-and-api/ but looks like is not enough
new BaseHrefWebpackPlugin({ baseHref: '/jhipster/' }),
Thanks
I tried to change contezxt pth on webpack but still same error
Wars not working but jars are working:
https://stackoverflow.com/questions/60338181/jhipster-spring-angular-jar-working-but-not-war-working
@aydincaner : I think you're right, I saw this few weeks ago. Could you open a new specific ticket for this, with all details to reproduce plz ?
Most helpful comment
@aydincaner : I think you're right, I saw this few weeks ago. Could you open a new specific ticket for this, with all details to reproduce plz ?