1

I created a simple Maven web application in Spring that tests the strength of passwords and saves them to MySQL database. Then I changed it to Spring Boot so I can upload it to Heroku. Both versions work well on localhost:8080, but when I uploaded the Spring Boot version to Heroku, it doesn't see the CSS file nor a text file with the list of words I use to find out if the password contains any existing words in English. Here is the link to my app on Heroku https://passwords2.herokuapp.com As you can see, there are no background or font colors and there is an error as soon as it tries to find "english.txt" file which is the list of words. Here is the link to Git Hub: https://github.com/PiotrDawidziuk/passwords2 The only difference is that in the Heroku version I changed the database options to

spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.username=${JDBC_DATABASE_USERNAME}
spring.datasource.password=${JDBC_DATABASE_PASSWORD}
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create

in application.properties and I added Maven dependency for PostgreSQL. image that shows what files I think Heroku doesn't see

Edit: I used this tutorial to deploy my app to Heroku: https://www.youtube.com/watch?v=7RHYDNSRSOs

1
  • A link to a Youtube video is probably not of help to anybody- maybe you can report here the relevant portion of code you took from there? Commented May 31, 2018 at 19:55

2 Answers 2

1

Your english.txt will go inside a JAR and when running in Heroku your file will be inside the JAR, so try to read it as a stream, check 37233069 to see how to read the file as a stream. Also in the SpringBoot application, you do not need resources folder inside WEB-INF, create css folder inside src\main\resources\static and copy stylesheet.css file to this css folder. In jsps, include stylesheet.css like below

<link rel="stylesheet" href="/css/stylesheet.css">
Sign up to request clarification or add additional context in comments.

Comments

0

There seems to be some mix-up in your view code, it is referencing static/stylesheet.css whereas your screenshot shows the stylesheet.css in your resources folder. That's why you're getting a 404 (resource not found) error.

There may be some custom configuration that's causing it to work in your local environment, but I recommend you debug properly before posting here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.