Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 application deployed on JBOSS 6.4 eap with java services as backend

Problem 1: Angular 2 application deployed on JBOSS server but not able to load static content (js/css). The problem is the website is hosted under its own context (localhost:8080/sample/) and static resources is refered in index.html as (link href="css/index.css" rel="stylesheet") however it doesnt get loaded as network calls are made to localhost:8080/css/index.css.

I need it to point to localhost:8080/sample/css/index.css

Problem 2: Alternately we tried hosting angular application on tomcat but services need to be hosted on jboss, we tried implementing CROS filter (https://amodernstory.com/2014/12/27/using-cors-headers-with-java-example/) but the first request goes through but other request shows pending status in Chrome network's tab.

like image 642
Nayan Suchak Avatar asked Feb 15 '17 15:02

Nayan Suchak


People also ask

What is JBoss EAP used for?

JBoss EAP includes everything needed to build, run, deploy, and manage enterprise Java applications in a variety of environments, including on-premise, virtual environments, and in private, public, and hybrid clouds. JBoss EAP is based upon the popular open source project WildFly.

How many ways we can deploy application in JBoss?

Deployment Modes The scanner can operate in one of two different modes, depending on whether it will directly monitor the deployment content in order to decide to deploy (or redeploy) it.

What is JBoss deployment?

Deployment is the term used for the process of installing a web application (either a 3rd party WAR or your own custom web application) into the JBoss Web server. Web application deployment may be accomplished in a number of ways within the JBoss Web server.

What is the difference between JBoss and spring boot?

JBoss can be classified as a tool in the "Web Servers" category, while Spring Boot is grouped under "Frameworks (Full Stack)". Spring Boot is an open source tool with 39.8K GitHub stars and 25.8K GitHub forks. Here's a link to Spring Boot's open source repository on GitHub.


1 Answers

I'm having the same problem. To get it to load the static content, you need to set the base href inside index.html to "./". I have found that "." also works. The application should then load properly, BUT you will run into another problem: if you try to visit any of the application routes directly using the address bar, you will see "Not Found". This seems to be related to JBoss's ability to rewrite HTML5 URLs and redirect them to the index. I am trying to solve that problem using the information on this page: https://issues.jboss.org/browse/JDF-512. I will let you know if I succeed.

like image 86
Ben Avatar answered Oct 20 '22 10:10

Ben