14 September 2015

Application on a separate custom port - Webspher Application Server 8.5

I've just spotted a question on developerworks forum whether it's possible to run one of the applications on Websphere Application Server on a separate, custom port. There's a way to achieve this and in this post I'm going to show how to do it.

1. First, we need to define a new port for our server. Go to Application servers -> your server -> Ports, anc click New....


Type in non-standard value (eg. 9081) and a custom name (WC_customPort)
Click OK and save the changes, and you will see your newly added port on the list:
But there's a small culprit now - we got the port, but "No associated transport" means that nothing really listens on the requests on this port. That's why we need to define a new transport chain for our port.

2. The new transport chain will essentially be identical to existing default transport chain. To create it we need to  go to Application servers -> Web container -> Web container transport chains:

Click New... and create on from webContainer template:


Click Next, and pick the existing port created in step 1. (as you can see, WAS could have made this for us in this place)

Confirm the data on the last screen and click Finish, save changes and you should have your new transport chain on the list:


We're almost ready: we've got the port and transport associated with it, but we still have no way to map our application to a different port, because we only have one default virtual host defined for standard 9080 port:


3. Let's create a new virtual host then:




Now, go again into custom_host, and go to Mime Aliases screen and define it to be 'any' (*) host, port 9081:


Click OK, save changes. The only thing remaining now is to map the application you want to use on custom port to this new virtual host. Go to Enterprise Applications > Your application > Virtual hosts and map it to custom_host:



All necessary changes have been made, so be sure you save them to server's config and restart the server. And there we go, after server reboot, we have two different applications on two different ports:



In this post I showed how to make J2EE application running on Websphere Application Server 8.5 use custom, non standard port along with other applications running on default web container port. I hope this helps you and if you have any questions, feel free to post it in comments.

Good day, and good luck to you!

2 comments: