I want to execute my java
web application (ear
is deployed in the server) in the same JBoss
server but in two different ports.
one is for development which would carry 8080
and other one which is for QA testing which would use 8180
.
Can someone please provide me guidence to do this with JBoss
?
I have tried out several ways but ended up getting errors.
I do not want to use two JBoss
servers but to run the application in one JBoss
server using two different ports. E.g. 8080
and 8180
.
After searching and testing so many ways I was able to find a way to deploy my java
web application in JBoss
server and run on two ports which are 8080
and 8180
.
One JBoss server serving from two ports (8080 and 8180)
Firstly, you need to build QA EAR and Development EAR accordingly.
Secondly, go to the JBoss
Server location and find the following path.
D:\Servers\jboss-4.2.3.GA\server
In this location you need to create new server environment for QA, in my case I will name it as server_uat
Now the folder sturuture should display like above.
Copy following folders from default
folder and paste it inside the server_uat
folder,
conf
deploy
lib
Now you can deploy the QA and Dev build to necessary to servers E.g. Dev build for deploy folder in default and QA build for deploy folder in server_uat.
Now go inside the server_uat
folder and edit the following file which is in the following path
D:\Servers\jboss-4.2.3.GA_UAT\server\server_uat\conf\jboss-service.xml
Then search for this area in the XML file and start editing the mbean code fragment
<!-- ==================================================================== -->
<!-- Service Binding -->
<!-- ==================================================================== -->
Edit should be done as follows.
<attribute name="ServerName">ports-01</attribute>
Add ports-01
value into the <attribute name="ServerName">________</attribute>
ports-01 refers to 8180 port
ports-02 refers to 8280 port
ports-03 refers to 8380 port
These are defined by JBoss
Server for the ease of configuration.
Once all done go to D:\Servers\jboss-4.2.3.GA_UAT\bin
using Command Prompt and execute the run.bat
file.
Then again open Command Prompt and execute run.bat
file using following command to up and run newly created server_uat
server instance
./run.bat -c server_uat
Now check application using both,
http://localhost:8080/login.do //Dev
http://localhost:8180/login.do //QA
mbean
code fragment after the change
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>