Change port of domain GlassFish using asadmin - glassfish

Is there any way or command to change the port 4848 to 4949 of Glassfish?
N.B
I don't want to change it from domain.xml

Try the following:
asadmin set
configs.config.server-config.network-config.network-listeners.network-listener.admin-listener.port=4949
or
asadmin set
server.http-service.http-listener.admin-listener.port=4949
to change the port of the "admin" HTTP listener which is configured in Glassfish. To change the port of the "main" port, change "admin-listener" in the command to "http-listener-1".

Related

SSL springboot Verify the connector's configuration

I want to use ssl in my springboot app. I use this tutorial but when I try up start my app gives me this error:
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8443 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8443, or configure this application to listen on another port.
And my application.properties
#ssl
server.port=8443
server.ssl.key-alias=alias
server.ssl.key-password=password
server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store-provider=SUN
server.ssl.key-store-type=JKS
Or do you know another way to do SSL trusted?
Generate the key with command line running in admin mode.

Monit Httpd interface not working

I am trying to use httpd interface to view monit results in web browser.
I have used the below commands in my monitrc file.
set httpd port 2812
allow monit:monit
But when i try to log into web browser with http://localhost:2812/
The page fails with page not found error.
I have ensured that there is no firewall restriction for localhost:2812 port and also from the local host, the port is listening for monit.
$netstat -nlpt |grep 2812
tcp 0 0 0.0.0.0:2812 0.0.0.0:* LISTEN 42291/monit
I dont even get any failure logs under monit.log
Appreciate your help on this concern.
If you want to be able to access from "localhost", you need also the following line:
set httpd port 2812
allow localhost # <-----
allow monit:monit
Regards
Reference: https://www.mmonit.com/monit/documentation/monit.html#MONIT-HTTPD

glassfish says port is occupied. but netstat says no process uses port 80

when i started the glassfish 3+ server, it says that it cannot start because port is occupied. but i tried netstat -aon on command prompt. there is no process using port 80. I have the same problem with wamp and xampp. please help. thanks in advance.
GlassFish runs per default on port 8080 (normal http service) and port 4848 (admin frontend).
You may have to look for these ports to fix the issue.

How to run an asadmin command for a specific glassfish-domain?

I'm trying to run a number of commands, such as:asadmin create-custom-resource, however, I have multiple domains, and I wish to specify which domain to be affected.
How do I run asadmin commands and specify which domain to be affected?
I'm using Glassfish 3.1.2.2
You can't specify a domain directly for most of the asadmin commands.
But you can specify the Domain Administration Server, which controls the domain. It identifies the domain indirectly. To do this just use --host and --port parameters:
asadmin --host localhost --port 4848 create-custom-resource ...
See also:
Glassfish 3.1.1 - How to enable secure admin for different domains?
How to specify domain name while creating jdbc resource/connection pool in glassfish 3

How to run glassfish 4 on port 80 instead of 8080? root access is not an issue

Did some google on it and the solution was to redirect using iptables or mod in apache? Since my application uses websockets the above solution breaks my websocket connectivity and I again have to connect to my websockets using port 8080. Is there any way that I can run the glassfish itself on port 80 so that my websockets also run on port 80 making easier for users behind corporate firewall to access the app since corparates may block 8080.
I have root access as well.
To run GlassFish on port 80 you need to :
Connect to the administration interface (by default on port :4848)
In the left menu go to Configurations
Then select the appropriate configuration you need to change eg server-config
Then go to Network Config
Then go to Network Listeners
Select the appropriate listener, probably http-listener-1
Change the Port value to 80
Save and reboot your GlassFish server/instance/cluster according to your needs
Using the command line utility
asadmin set configs.config.server-config.network-config.network-listeners.network-listener.http-listener-1.port=80
you may need to replace server-config and/or http-listener-1
Go to glassfish4\glassfish\domains\domain1\config folder and here open domain.xml file
and find tag
<network-listeners>
<network-listener port="9999" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
</network-listeners>
in port attribute of <network-listeners> you can specify your port address whichever you want.
Here's another approach.
You can go to the admin console under port 4848 (I am using Glassfish 4.1.2) and navigate to "Configuration" > "server-config" > "HTTP Service" > "Http Listeners" > "http-listener-1" in the left hand navigation.
Click on the "http-listener-1" link in the main content window.
Change the port to desired number and save.
Restart Glassfish and run your application.
in some cases you have to change port before glassfish is started (in my case port 8080 is already in use by another instance) so answer 4 worked for me.
Following are simple steps to change the port number of Glassfish server (GlassFish runs by default on port number 8080):
Go to the folder where Glassfish is installed.
Locate config folder which is as follows (Windows):
C:\Program Files\glassfish-3.0.1\glassfish\domains\domain1\config
Open domain.xml using any text editor.
Look for 8080 and change it to some other port number that doesn’t conflict with other port numbers (e.g. 8081).
Save domain.xml.
Additional step if necessary:
Now remove GlassFish from IDE and add it again so that IDE understands the new port number.
Restart GlassFish, if it was already running.
Soruce Link