Ticket: User Management -- mflix frontend issue [SORTED]

Edit: I’ve sorted this out now, by just downloading the starting source code and starting completely from scratch! Not a true solution I know but I had to get this sorted asap so I could continue with the course.

Hi all,

I have searched the forums for a solution to my problem, but it seems I am alone with this issue.
I have just done the required code changes to UserDao.java, for the User Management Ticket.

When I run mvn test -Dtest=UserTest the tests all pass fine.
I then run mvn spring-boot:run and the application starts no problem.

The issue is when I navigate to the mflix app at localhost:5000/ (yes, port number is correct per the application.properties file). Here I just get a wall of text for the index.html file.

Note: I haven’t changed this file for this ticket (a change was required for the previous ticket and the UI worked). This seems to be a sudden issue and hopefully one that is relatively simple to solve…

I am using IntelliJ IDEA to make code changes, and am running through the Terminal view. I noticed in the Terminal the following error:
2019-05-23 11:22:52.962 ERROR 10404 --- [nio-5000-exec-2] mflix.api.security.JWTAuthEntryPoint : Unauthorized error: Full authentication is required to access this resource

Any help will be greatly appreciated, as I’d like to get this sorted as soon as possible.

Cheers,
Thomas

Hi Thomas,

is this the only error you are seeing in the console output?

Have you tried with a different browser ?

Please run the following and report back:

curl -s -I localhost:5000 | grep "^Content-Type:"

This will verify if there is some change in the media type of the server response, that is telling your browser not to parse the received html message and instead show it as text.

N.

Hi Norberto,

Thank you very much for your reply!

  • This was the only error (see below).
  • I tried on multiple browsers, and tried Nuking the cache, etc, etc.

It appears, however, that Sod’s law is very much in action. Today when I attempt to run the mflix application using mvn spring-boot:run, I am getting the following error:

I have cleaned & rebuilt the project, and have successfully run a Maven build using mvn install -DskipTests.

Interestingly I can run by right-clicking Application.java > Run 'Application.main()'

I’m not sure why this is happening, I’ve made no changes since I posted this ticket yesterday… I still cannot access the UI, even when doing the Run 'Application.main()' method.

Cheers,
Thomas

Hi @Thomas_26064,

A few things I’ve noticed:

  • There is a typo in your first screenshot. You are running mvn spring-boot: run there is a space between spring-boot: and run. This is why it is giving you that error.

  • On your second screenshot, aside from the fact that you are running the app but skipping the tests, not ideal, I can’t see any activity in the logs. This means that you have not hit the server with a request yet.

2019-05-24 11:13:11.399  INFO 65960 --- [           main] mflix.Application                        : Started Application in 6.393 seconds (JVM running for 15.532)

 __          __  _                            _          __  __ ______ _ _
 \ \        / / | |                          | |        |  \/  |  ____| (_)
  \ \  /\  / /__| | ___ ___  _ __ ___   ___  | |_ ___   | \  / | |__  | |___  __
   \ \/  \/ / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | __/ _ \  | |\/| |  __| | | \ \/ /
    \  /\  /  __/ | (_| (_) | | | | | |  __/ | || (_) | | |  | | |    | | |>  <
     \/  \/ \___|_|\___\___/|_| |_| |_|\___|  \__\___/  |_|  |_|_|    |_|_/_/\_\


     ^
   /'|'\
  / \|/ \
  | \|/ |
   \ | /
    \|/
     |


2019-05-24 11:13:22.314  INFO 65960 --- [nio-5000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2019-05-24 11:13:22.319  INFO 65960 --- [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2019-05-24 11:13:22.491  INFO 65960 --- [nio-5000-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 147 ms

Once you send the first request, you should see at least these three lines after our MFLIX ascii art logo in the logs.

After that, we might see some more information about why you are getting into these issues.

N.

Hi Norberto,

Thank you for pointing this out! I am feeling rather stupid right now. I have run the application using mvn spring-boot:run (no space) and it runs without any errors (I no longer seem to be getting the JWTAuthEntryPoint error, which seems promising).

I am, however, now back where I started with my front-end issue.
Terminal:

The web browser window for localhost:5000/ still shows as the index.html text.

I tried to run your suggested command: curl -s -I localhost:5000 | grep "^Content-Type:", but it is saying:


Do I need something else installed?

Thank you,
Thomas

Hi @Thomas_26064,

Please use below command:

  curl -s -I localhost:5000 | findstr /b "^Content-Type:"

findstr command is used to search for specific pattern in the console output/file in Windows machine.

grep is usually used in Linux/OSX machines for the same reason: to search for patterns.

Kanika

Hi Norberto & kanikasingla,

I appreciate both of your help and time - but I’ve abandoned trying to fix this issue - I have instead elected to completely start over and re-download the source code from the lesson 1 handout.

This has sorted my issue and I can now progress.

Cheers,
Thomas

Glad to hear that @Thomas_26064. Good luck for the rest of the course! :slight_smile:

Let us know if you need any help.

Kanika