jboss 5 changing default port - default

I am trying to change the default port on my jboss server to port 80.
i have had a look around the web and i have had suggestions of editing this file jboss5\server\default\deploy\jbossweb.sar\server.xml which is fine. changing this file alone still does not fix the issue.
There have also been suggestion to also change this file: jboss5\server\default\conf\bootstrap\bindings.xml Only problem is that i cant find this binding.xml
Is the binding.xml file a standard in JBoss 5? Or has it been renamed or changes location in JBoss 5.
Does anyone have any clear steps on changing the the default port from 8080 to 80.

Can you try changing in ${JBOSS_HOME}/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

${JBOSS_HOME}\server\default\deploy\jbossweb.sar\server.xml
For example, locate in the path:
D:\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\deploy\jbossweb.sar,
search for the section:
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
Then, change the port number to the one you choose, for example: from: "8080" to "8090" as follows:
<Connector protocol="HTTP/1.1" port="8090" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
I hope this would help you.

This works on jboss-5.1.0.GA :
Edit the file ${JBOSS_HOME}/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml as follows ->
Change ${jboss.service.binding.set:ports-default} to
${jboss.service.binding.set:ports-01}
This will change all defalt to default+100 port.
HTTP - > 8180 and so on.

It´s posible configure the ports as explained by peers in the next two files:
${JBOSS_HOME}/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
${JBOSS_HOME}/server/default/deploy/jboss-web.deployer/server.xml
When the two configurations coexist Jboss works for the highest port, for example:
jbossweb.sar
Connector protocol="HTTP/1.1" port="8980" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443"
bindings-jboss-beans.xml
*${jboss.service.binding.set:ports-01}*
Jboss will run in port 8980

another part could be
Blockquote
D:\jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\server.xml
Blockquote
There
*<Connector port=**"9090"** address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />*
change the port above

Just change the port number in the file
jboss-5.0.0.GA\server\default\deploy\jbossweb.sar\server.xml
<Connector protocol="HTTP/1.1" port="7070" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
In the above i have changed to 7070.

Change the port number in the file ${JBOSS_HOME}/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml. For example to 6060
<Connector protocol="HTTP/1.1" port="6060" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
If for any reason dont works also change this another too. To the same port.
jboss-5.0.0.GA\server\default\deploy\jbossweb.sar\server.xml

Related

Port no 8080 is already in use when running Solr with runjetty

When I am running solr with runjetty in eclipse ,I am getting an exception(IlleagalStateException) and port no:8080 already in use?
Can anyone help me on this?
in your solr installation folders, search for "example/etc/jetty.xml"
this is the relevant part you're looking for:
<Set name="port">
<SystemProperty name="jetty.port" default="8080"/>
</Set>
change the "default" value as you like (unused port)
or launch jetty adding
-Djetty.port=11111
from the command line (1111 is just a random number, you choose again the one you need)
This means that there is a java service which is using the port, go to task manager and process and kill any javaw process that is running currently ...
Hope that might fix.
change you apache tomcat port to some other port and try again...
Please set port value in server.xml file
Its path is like,
Tomcat-installation-dir\conf\server.xml
Search tag like this,
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Change the port number to any other number like 9090 for example, and after changes it should look like this,
<!-- Define a non-SSL HTTP/1.1 Connector on port 9090 -->
<Connector port="9090" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Dont change anything other than connector port,change only the value of port and save the file and now hit the url,
localhost:9090
Or use the port number which you have updated in the server.xml file.
localhost:port_in_server.xml
So if every thing goes fine it should open the tomcat home page....This will make sure that you have changed the tomcat's default port(i.e.8080)listen to 9090.
Shutdown the tomcat server at this point.
Now you stop and restart the jetty server and it will work for you with no issues..
Hope this helps....

Ajp invalid message received with signature

I am using Tomcat 7.0.29 fronted with Apache 2.2.22 modproxy.
Configured Ajp as the protocol in httpd.conf and AjpNioProtocol in server.xml.
After the server starts, the logs are filled with the following message:
Severe: Invalid message received with signature 20599
com.apache.coyote.ajp.AjpMessage processHeader
There are no requests sent to the web or tomcat server and it still throws that error. Access logs in tomcat and apache show that no request is coming in.
What is causing the invalid message error?
Here is the configuration :
httpd.conf
ProxyPass /wl ajp:// ip : port /wl
ProxyPassReverse /wl ajp:// ip : port /wl
server.xml
<Connector port="port"
protocol="org.apache.coyote.ajp.AjpNioProtocol"
connectionTimeout="20000"
acceptorThreadCount="2"
maxThreads="1600"
redirectPort="8443" />
For me, the problem was simple. I was sending HTTP requests but the connector was configured with AJP protocol. My connector in server.xml was configured like this:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
But when I changed it to this:
<Connector port="8009" protocol="HTTP/1.1" redirectPort="8443"/>
The error went away.
Hopefully that will help someone with this error.
This may also happen when buffer sizes are not same at both ends: logs mention invalid AJP message and browser receive 400 error code.
I have fixed the situation with both packetSize on AJP connector and ProxyIOBufferSize in Apache2 configuration.
In Tomcat server.xml:
<Connector protocol="AJP/1.3" port="8009"
connectionTimeout="20000"
packetSize="65536"
proxyName="yourproxy.domain.ltd" proxyPort="80"
/>
In Apache2 mod_proxy_ajp configuration, add the statement ProxyIOBufferSize 65536.
It was found that one of the internal processes was calling that port and sending http requests causing the "Invalid message.." error. So I ended up adding an additional http Connector for those internal processes
There are no requests sent to the web or tomcat server and it still throws that error. Access logs in tomcat and apache show that no request is coming in. What is causing the invalid message error?
Just some hint for other people because I forgot the same in one of my configs by accident: The mentioned Connector in server.xml is listening globally, because only port is specified, without any address. The latter is defined to listen globally by default:
By default, this port will be used on all IP addresses associated with the server.
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
So without any additional firewall or such it might be that bad clients are simply testing for open ports using various protocols, which might or might not be HTTP and therefore resulting in error messages with different signatures. Without very good reasons, there shouldn't be any need to make AJP globally available, especially not in case of a proxy-setup like used by the thread starter.
<Connector address="localhost" port="port"
protocol="org.apache.coyote.ajp.AjpNioProtocol"
connectionTimeout="20000"
acceptorThreadCount="2"
maxThreads="1600"
redirectPort="8443" />
I got a similar message today:
Nov 18, 2016 4:25:00 PM org.apache.coyote.ajp.AjpMessage processHeader
SEVERE: Invalid message received with signature 65524
The root cause of my problem was that selinux wasn't letting apache connect to tomcat. I'm a little confused as to how this error was a result - I'd expect that there would be no connection, period. Best guess, i probably attempted to manually connect to that port with telnet. Doing that certainly gives a similar message.
Regardless, perhaps this selinux reminder will be helpful to someone else who ends up here.

Restrict Access to Apache Tomcat

Anyone know how to restrict access to Apache Tomcat 6.0 except the followings :
1) allow access from web server (apache httpd) thru AJP ports
<Connector port="1010" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="1443" maxSavePostSize="-1"/>
2) allow access from localhost thru normal http connector port
<Connector port="1010" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="1443" maxSavePostSize="-1"/>
3) allow user to connect to web application via web server (apache httpd)
I have tried to restrict access by changing the web context.xml (10.160.2.149 refers to the ip of web server - apache httpd) :
<?xml version='1.0' encoding='utf-8'?>
<Context debug="4"
displayName="MYAPPS"
docBase="C:\Frontend"
path="/abc/devp/fe"
privileged="true"
reloadable="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127.0.0.1,10.160.2.149"/>
<Manager className="org.apache.catalina.session.PersistentManager"
entropy="org.apache.catalina.session.PersistentManager#1ac5f13"
maxActive="1"
maxInactiveInterval="1800"
saveOnRestart="false"
sessionCounter="1">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
</Context>
Here you can find instructions how to restrict access to Tomcat for specified IP addresses or how to request user authentication - Secure Tomcat Hosting: Restrict Access to Your Web Application

Prevent access to certain webapps in Tomcat6

I asked this on server fault but really havent had much luck, hoping that someone here would be able to offer some advice...
I have a Tomcat 6 server running just fine. I have external access working. I wanted to know how to prevent someone from seeing specific webapps, for example, I dont want external access to the ROOT tomcat page. How would I go about preventing some webapps while leaving other webapps visible to external users ?
Here's what I've tried:
This denies everything even 127.0.0.1 requests
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/examples" docBase="" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/>
</Context>
</Host>
This denies everything as well.
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/examples" docBase="" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="*"/>
</Context>
</Host>
Basically I am trying to prevent access to the ROOT default tomcat page and the example apps....
Any ideas?
You can't use a wild card for the allow attribute...on the other hand you can use one for the deny attribute.
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="*"/>
This is why I was getting a 403 with the above code.
Also another way I handled this was I created a jsp that redirected traffic to wherever I wanted.
take a look at the documentation.
http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html
What you have seems to be correct. it says "If this attribute is specified, the remote address MUST match for this request to be accepted."
One thing you might look at is to see whether 127.0.0.1 is really the correct IP. You might be actually using the actual IP of the box. try adding that IP address after the localhost one.
The value of the "allow" property must be defined using backslashes to escape the dots of the allowed IP address:
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1"/>
This could be an IPv6 issue. This is what my tomcat6/Catalina/myApp.xml looks like:
<!--<?xml version="1.0" encoding="UTF-8"?> -->
<Context path="/myApp" privileged="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1,0:0:0:0:0:0:0:1"/>
</Context>
This can be tested by the following which would yield 403 if you're denied access
wget --inet4-only http://localhost:8080/myApp

Apache 2 + Tomcat 6 + Mod_jk: How can I close the port 8080?

I'd setup Apache 2.2 with Mod_Jk so that all Tomcat 6 pages is piped through Apache, port 80. Everything work fine, all pages look good.
My question is: How can I close the port 8080 listened by Tomcat ? Since right now all pages are served from port 80 by Apache, the port 8080 from Tomcat should not be accessed by end-user. I don't have hardware or software firewall in the front to block port 8080.
In Tomcats' server.xml file, you are going to want to comment out the connector that references port 8080. Typically it would look something like:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Comment it out, restart and that should do it.
<!-- <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> -->
I don't know if you can disable it completely. But you can bind it to a specific address. I.E. 127.0.0.1, so it can only be accessed from localhost.
Here's how:
<Connector port="8080" address="127.0.0.1" maxHttpHeaderSize="8192"
maxThreads="15" minSpareThreads="2" maxSpareThreads="7"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
compression="on" compressionMinSize="0"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml" />

Resources