How to change port number in jboss-7 - jboss

I am using jboss-7 and I want to change the port number from 8080 to 7001. Which file do I need to change?

The file is $JBOSS_HOME/standalone/configuration/standalone.xml. Find <socket-binding-group> and <socket-binding> there.
EDIT
There's multiple ways to do this. The recommended way is to use the management console.
If JBoss AS runs on your local computer, open the URL http://localhost:9990/console/App.html#socket-bindings and edit the socket-bindings there. I tested it on Wildfly 8.1.0 Final, don't know if the URL is valid for other versions of JBoss AS.

When starting use
./standalone.sh -b 0.0.0.0 -Djboss.socket.binding.port-offset=1000 &
- for linux
standalone.bat -Djboss.socket.binding.port-offset=1000
- windows
here 1000 is the offset value. 8080 + 1000 = 9080 the application will start

go to installation directory ....
Mine directory like that
C:\wildfly-10.0.0.CR5\standalone\configuration\
find standalone.xml file, open and change the http port 8080 inside
<socket-binding-group>
Here I change my port number 8080 to 3333
<socket-binding name="http" port="${jboss.http.port:3333}"/>

For Windows:
standalone.bat
is using
standalone.conf.bat
Open in notepad
Add the last 2 lines (as seen below, aka the 2 "Alter Port Settings Offset" lines) (the first 3 lines should already be there...and provide the breadcrumb to where to place the 2 new lines that you need)
rem # Make Byteman classes visible in all module loaders
rem # This is necessary to inject Byteman rules into AS7 deployments
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman"
REM NEW LINE HERE Alter Port Settings Offset
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.socket.binding.port-offset=1000"

Change the socket-binding of http to your desire port number you want to use inside the socket-binding-group in your standalone.xml file of jboss.For example i am using 8090 as my port number.
<socket-binding name="http" port="8090"/>

Go to jboss directory exp -
jboss-7.0.0.CR1\jboss-7.0.0.CR1\standalone\configuration
open standalone.xml file
then change port number according to you.

In eclipse I open port-offset (that corrispondes to standalone.xml) and modify jboss.socket.binding.port-offset from 0 to 1000

To change the port for JBoss in local, when running multiple instances below are the steps.
In the JBoss folder, go to standalone.xml.
search for
change the "port-offset=${jboss.socket.binding.port-offset:0} to 100 like below
port-offset="${jboss.socket.binding.port-offset:100}
Then when ran standalone.bat, then Jboss will run on port 10090

If you are using Intellij (Ultimate is required) Jboss/Wildfly configuration, you could easily edit port offset inside run configuration window.

Related

414 URI too long with Apache Tomcat Eclipse

I have a long uri when i launch my query.
I use apache tomcat 7.0.42 as server. I know my request is long but i want to increase the uri's length limit to do my requests. Because i always have a
414 error : request too long.
How can i do that ?
I've already tried with maxHttpHeader in server.xml but there was no effects. It appears that : when i restart my server with eclispe, the 'maxHttpHeader' disappears ... why ?
<Connector URIEncoding="UTF-8" maxHttpHeaderSize="65536" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
Is any files to configure or to modify to handle this error ? I really need to.
My request is to fill a dataTable.
Thank's in advanced.
i just pass my request in POST. Now it works !
when i restart my server with eclispe, the 'maxHttpHeader' disappears
Using eclipse WTP your tomcat's server config is not (only) stored in the conf folder of the tomcat installation.
Go to the Servers view and double-click on your server, under General Information you will find a Configuration path field that points to the configuration directory. Usually this is a folder in a separate eclipse project (called Servers).
After editing the server.xml there you can synchronize your server (in the Servers view) and the changes should not vanish anymore.
Edit: As for maxHttpHeader: just saw you are defining the maxHttpHeader setting for your 8080 connector and using a redirect to 8443. The setting will not take effect for https connections. Try adding the same setting to your 8443connector.

How to start Weblogic admin server

when I am starting WebLogic admin server with local host:port no/console I am getting the following error:
Console/Management requests or requests with <require-admin-traffic> specified to 'true' can only be made through an administration channel.
How to overcome this error?
You can manualy change your config.xml, find the <require-admin-traffic> element and change it's value to false.
This is because the option administration-port-enabled is set to true in config.xml
(available under ../MW_HOME/user_projects/domains/config)
<administration-port-enabled>false</administration-port-enabled>
Perfect. Or you can use the administration port you entered when configuring the server to use the admin server, which will be different from the default one. The default one 7001, the default for the admin server is 9002 and you can only access it via https.
Not downvoting the answer as it is accepted and maybe useful for users which can't recover their admin port, but this is obviously not best practise.
Once you open config.xml under the folder ../config,
change this row from 'true' to 'false':
true
It should then be ok.
Skender Kollcaku
You are most probably trying to use the administration console on the application port. You need the administration port.
Go to your domain directories (ex. /opt/weblogic/domains/mydomain)
Go into sub-directory config
Run grep "administration-port" config.xml
This will give you a port number, like: <administration-port>12345</administration-port>
Use that port to connect to /console/.
ex: https://YOUR-SERVER:12345/console/
This is much preferable to using the application port for the console, like #Peter pointed out.

haproxy - which configuration files

I have an HAProxy install which was configured by someone who left the company. It runs on Ubuntu 10.04 and it seems to use 3 configuration files in the directory /etc/haproxy
haproxy.cfg
haproxy.http.cfg
haproxy.https.cfg
I don't see the point in using the haproxy.https.cfg file as I believe (in our configuration) it can all be configured from a single haproxy.http.cfg file but when I remove that httpS file it complains bitterly and refuses to run. My question
Is this the standard configuration haproxy uses or if not, I can't find a reference to the "S" file anywhere. Can anyone suggest how HAProxy concludes it should use it?
Thanks
The very answer to your question: your haproxy is simply launched with those three config files ( -f haproxy.cfg -f haproxy.http.cfg -f haproxy.https.cfg, maybe from /etc/init.d/haproxy but mileage varies depending on your distribution ).
If you remove the file, of course it will complain.
This is not particularly standard, but ain't bad either, it helps structuring the conf rather than having a very long file.
The task of the .https version will certainly be to redirect the https traffic towards a service that can handle HTTPS (stunnel or nginx usually), since haproxy cannot terminate ssl connections. (stunnel has to be patched, see on the haproxy page)
If you want you can merge those files into one or two, just find out how haproxy is launched (check for init.d or let us know which distribution) and fix it appropriately.
I believe that it is only /etc/haproxy/haproxy.cfg that is used by default.
This may be of use to you (1.4 configuration reference):
http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

using old port after chaging domain.xml

I am using Glassfish V3 which comes with netbeans only , as there are few servers running on my pc , i have changed the port from 8080 to 8787 of glassfish v3 by altering domain.xml
<http-listener id="http-listener-1" port="8787" address="0.0.0.0" default-virtual-server="server" server-name="" />
<http-listener id="http-listener-2" port="8181" enabled="false" address="0.0.0.0" security-enabled="true" default-virtual-server="server" server-name="">
Now when i deploy the restful webservies over server or click on Test Restful Webservice in netbeans
i am getting a page in a browser which still uses the old port and even there is not webservice option get displayed on it the page is blank. here is the screen shot
note: i tried restarting it may times but still using the old port
In your Netbeans project node there must be a sub node like "Generated sources (rest-test)" or similar (I don't have Netbeans in english).
If you expand this node, there must be a file named test-resbeans.html. Open this file and check the following entry:
var baseURL = "http://localhost:8080/MyFirstWebService/||/resources";
The term MyFirstWebservice needs to be replaced by your services's name.
Change the port there if necessary.
There was an open issue for something similar. I fixed it a while back, but the change will be in NB 7.0. I do not think anybody will backport the change into 6.7... but you never know.

How to run multiple instances of JBoss in a one single machine?

I need to run multiple(more than 4) instances of JBoss server on a single machine.
I am using JBoss 4.2.3 GA.
I found the answer. We have to configure the jboss-service.xml to run multiple instances in the same machine.
We may need to keep the same "default" instance same as it is under the JBOSS_HOME\Server.
We have to create another folder say "instance2" under JBOSS_HOME\Server.
Copy all the contents from JBOSS_HOME\Server\default to this newly created folder.
Now goto conf folder under JBOSS_HOME\Server\instance2 directory.
Edit the jboss-service.xml.
Search for mbean code="org.jboss.services.binding.ServiceBindingManager" in this configuration file.
By default this xml tag is commented. We have to un comment it and change the value ports-00 to ports-01.
Then start this instance2 jboss instance. We can access this application by using the port number 8180.
We can go for at maximum of 3 instances with this way.
To run more than this we have to add some more running tags in
JBOSS_HOME\docs\examples\binding-manager\sample-bindings.xml.
You can make things a lot simpler by simply changing the IP that the server is bound to.
You will need to copy the entire jboss folder several times and configure run.bat to use the -b parameter on startup.
If this is a Windows server and you're running jboss as a service, you might want to edit the service.bat for each instance too so that the servers all have different names in the services control panel.
Part of the problem we ran into when trying to use different HTTP ports was that jboss uses 'lots' of ports for different purposes and it was a pain to edit all of these port numbers to be unique on each instance. By changing the bind address you can avoid this problem entirely.
Create multiple loopback adapters and bind each ip address to different instance.
No need of changing port.
RK
1) Copy the default folder with new name: instance name
2) In jboss-service.xml Uncomment the ServiceBindingManager mbean and change the ServerName to ports-01 or 02 or 03 e.g:ports-01 and ports-01/02/03 configuration should be there in sample-bindings.xml(present in docs/examples/binding-manager) And make the changes in all the ports mentioned under ports-01/02/03 tags, So that ports will not get conflict. Remember the server will run on the binding port like 8080/8180/8182.
from cmd promt go to the bin folder and run the instances with cmd:
run -c instancename
Running multiple instances of JBoss on the same server:
We should keep the "default" instance same as it is under the **JBOSS_HOME\Server
Copy the default folder with new name (instance name) say default2 under JBOSS_HOME\Server. Copy all the contents from JBOSS_HOME\Server\default to this newly created folder.
The binding service manager needs to be enabled in conf/jboss-service.xml for instances that are not using the default ports.
a. (i.e.) In the copied instance, go to conf folder under JBOSS_HOME\Server\default2 directory. Edit the jboss-service.xml.
b. Search for mbean code="org.jboss.services.binding.ServiceBindingManager" in this configuration file.
c. By default this xml tag is commented. We have to uncomment it and change the value ports-00 to ports-01.
In the same file, Under "Socket transport Connector", in the "Configuration" section, serverBindPort must be changed to another value or it will conflict with the default (4446).
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:service=Connector,transport=socket"
display-name="Socket transport Connector">
...
<attribute name="Configuration">
...
<attribute name="serverBindPort">25447</attribute>
...
In default2/deploy/ejb3.deployer/META-INF/jboss-service.xml, for the remoting.transport.Connector mbean, port 3873 must be changed to another value or it will conflict with the default.
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
<depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="InvokerLocator">socket://${jboss.bind.address}:25874</attribute>
...
In default2\deploy\jboss-web.deployer\server.xml
set redirect port value to the one configured in step 4
<Connector port="8180" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="25447" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Also, the port value configured in step 5
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="25010" address="${jboss.bind.address}" protocol="AJP/1.3" //change the connector port value to avoid conflict
emptySessionPath="true" enableLookups="false" redirectPort="25874" /> // port value configured in step 5
In summary, the directory structure for setting up two other instances would be something
like the below with modifications in the filenames in bold.
$JBOSS_HOME/server/default
$JBOSS_HOME/server/default2
$JBOSS_HOME/server/default2/conf/jboss-service.xml
$JBOSS_HOME/server/default2/deploy/ejb3.deployer/META-INF/jboss-service.xml
$JBOSS_HOME/server/default2/deploy/jboss-web.deployer/server.xml**
$JBOSS_HOME/server/default3
$JBOSS_HOME/server/default3/conf/jboss-service.xml
$JBOSS_HOME/server/default3/deploy/ejb3.deployer/META-INF/jboss-service.xml
$JBOSS_HOME/server/default3/deploy/jboss-web.deployer/server.xml**
7.From command prompt go to the bin folder and run the instances with cmd:
run -c instancename
In this case, it is: run -c default2
And applications accessed with url’s like:
http://localhost:8080/myapp/
http://localhost:8180/myapp/
http://localhost:8280/myapp/
Note: We can go for maximum of 3 instances with this way.
To run more than this we have to add some more running tags in JBOSS_HOME\docs\examples\binding-manager\sample-bindings.xml.
I used this article to install mine.
http://wiki.adempiere.net/Setup_2_Adempiere_JBoss_server_in_1_physical_server
You should create different services to control the adempiere servers.
Also if you work with jasper report, use unique file names for reports or you will face permission denied exception.
Ex : if you attach "report.jrxml" to two servers. Server will create /tmp/report.jrxml tmp file.
The second server will also try to create the same file and get crashed
Copy complete JBOSS setup to new location, and start new server with offset option, which will start server on existing ip and changing port to previously_configured_port+offset
standalone.bat -c standalone-full.xml -Djboss.socket.binding.port-offset=100
This command will make default jboss console 9990 to 10090
Now you can add your war file in new deployments folder and start deployment on new port
The quickest and easiest way that comes into mind is simply configuring multiple IP addresses to the hosting machine. Then you can use the different IP addresses to bind to each instance. Doing this means you don't have to change any default ports and allows for an easier environment to manage.
We can easily do this on JBOSS EAP
For first instance, just start the JBOSS as it is.
for the second instance,
Copy the JBOSS home folder to a different location.
go to standalone/configuration/standalone.xml. go to the section(at bottom of the file) and set port-offset value to some value(EX: 10000) which doesn't have any port binding issue on currently running application. Here the default port-offeset value is 0.
start the second instance as usual .