Can't get my Ember app to display after deployment to Tomcat


#1

I deployed my Ember App to a Tomcat development server on my system. I copied all the files from the dist folder in my Ember-CLI environment to a folder on my Tomcat server called static-ember.

When I use the URL http://localhost:8080/static-ember/index.html my page partially loads(I see its light blue background) and when I check Elements(I’m using Chrome) it show the correct mark up for my index.html. However I am get the following errors:

This is the first time I’m deploying an Ember App, What am I doing wrong


#2

Update:

I refreshed my page an now I’m getting the following errors:

iled to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8080/assets/vendor.css” Failed to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8080/assets/app-ember.js” Failed to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8080/assets/vendor.js” Failed to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8080/assets/vendor.css” Failed to load resource: the server responded with a status of 404 (Not Found) “http://localhost:8080/assets/app-ember.css” Failed to load resource: the server responded with a status of 404 (Not Found)

Shouldn’t Tomcat be looking for the the resources in “static-ember/assets” instead of “assets”?


#4

change the base url(’/’ to /applicationName/dist) in config/environment.js file.


#5

I added this to my environment.js

if (environment === 'production') { ENV.baseURL = '/dist'; }

Then ran $ ember build --environment=production in CLI to build the production-ready files. (I’m in the root of each folder though, so you would need to address sub-folders if you were not.)


#6

Hey, just wanted to check how did you resolve this issue?


#7

i had similar issues when i was trying to deploy my ember app for the first time in webserver.

Solution is to go with some app-specific baseURL instead of “/”. 1)Before deploying to tomcat,make sure to change your base url and confirm if you are able to see it working.

ie change http://localhost:4200/ to http://localhost:4200/abcd/

2)Now if above url works then go to tomcat->webapps and create a folder “abcd” and paste the contents of your dist in “abcd”

3)Launch tomcat with context as “abcd” and problem solved.

Thanks, Ramesh