5

I am trying to build a ReactJS application which i would like to host on a tomcat server. I already used the command npm run build and the build is ready.. Where do i copy these files in my tomcat server? DO i need to create another application and deploy it on the server which invokes the React Application?

2

1 Answer 1

1

Follow below steps:

  1. Goto 'webapp' folder in tomcat and create a folder(mostly your project name)
  2. Copy the files from your ReactJs build folder to the folder created in tomcat(note: your build folder should have index.html)
  3. Launch the url http : //localhost:< port > /< folder-name> in browser. By default port will be 8080

Instead if you have WAR file, you can go to http://localhost: < port > /manager/html and deploy it.

Sign up to request clarification or add additional context in comments.

5 Comments

I was facing similar requirements. I copied the build folder into webapps. In webapps now I have a folder named build and the contents of build folder inside that. But still I am unable to launch my application via tomcat
did you try this http : //localhost:< port >/build ?
I applied this steps but when i launch url i am getting 404 not found error
I am trying this solution and my react app searching for files in static folder in tomcat's root folder. when I add homepage in package.json file get searching get routed to folder. but still app is not working
@mertaksu for 404 this helps: stackoverflow.com/questions/41246261/…

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.