How to create a react project war and deploy it on jboss?

Viewed 382

I know there are many articles on google about this but in some cases they are keeping react(frontend) + springboot(backend) together in a single war, but my requirement is different I want to keep the both wars as separate.

So what I tried till now,

  1. Directly adding the react build folder in jboss->standalone->deployment but it does not work, it works on tomcat but not on jboss
  2. Then I created a new dynamic web maven project and renamed react build folder and added it to maven project webapps directory and created a war, but after deployment its giving 403 error, and I am not getting why.

Here is a snapshot of my folder structure, pom file and error on browser

enter image description here

enter image description here

enter image description here

enter image description here

Please help regarding this have been stuck at it for days now with jboss

Is there any other way to do it, I will be happy to change my approach.

tried this also, did not worked https://www.megadix.it/blog/create-react-app-servlet/

2 Answers

I have the same problem and I haven't found a good solution. The best I found is to create a dynamic web project in eclipse. Copy the build files into webContent and use HashRouter instead of BrowserRouter with basename equal to the project name. Finally compile and generate the war. I hope the advice helps you.

Related