Jetty inside ActiveMQ: Web console URL - jetty

I have an ubuntu machine, on which
a) a web application (Tomcat, on URL http://myapp.com ) and
b) a message queue broker (ActiveMQ)
are running.
ActiveMQ has a web console, which normally runs on port 8161 (i. e. at http://AAA.BBB.CCC.DDD:8161/admin , where AAA.BBB.CCC.DDD is the IP address of the machine).
Due to firewall restrictions in my office, I cannot access the web console, if it runs on port 8161, 8080 doesn't work, either.
I can, however, access the web console, if I use port 80 (http).
But then I get another problem: When I try to access
http://myapp.com
I am directed to the web console of ActiveMQ.
Question: How can I configure ActiveMQ's so that
a) ActiveMQ web console is available via port 80 on URL like http://AAA.BBB.CCC.DDD/activemq and
b) my web application works as usual on http://myapp.com
?

To change the contextPath/port, just modify the /activemq/conf/jetty.xml file, like this...
<bean class="org.eclipse.jetty.webapp.WebAppContext">
<property name="contextPath" value="/activemq" />
...
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="80" />
</bean>
That being said, it sounds like you have a Tomcat app running on port 80 already. In this case, you'll need to embed the AMQ web console in Tomcat (as a separate app) instead of running it separately via the broker/Jetty. See this page for more information on doing this...

Related

Any potential security risk when exposing ActiveMQ web console in AWS?

I was unable to access the ActiveMQ web console in 5.16 version.
I opened the required ports in AWS security group and I checked which ports are configured for console and the broker URL, yet the browser said "Page Not Found" so I looked into the jetty.xml and noticed this line:
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
<property name="host" value="127.0.0.1"/>
<property name="port" value="8161"/>
</bean>
I changed the host to 0.0.0.0:
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
<property name="host" value="0.0.0.0"/>
<property name="port" value="8161"/>
</bean>
Now I am able to access the web console. However does this give any security risk?
There is always inherently more risk when exposing additional points of entry into a system (e.g. a management console).
The ActiveMQ web console is a powerful tool which can be used to delete messages, remove destinations, stop the broker, etc. If a user gains unauthorized access to the web console then they can make a real mess. If you expose the web console to external users then be sure to secure it according to the documentation.

access mule http endpoint deployed in tomcat

I have developed a SOAP webservice in mule, which has the endpoint configured as say
for e.g.
http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:7001/helloService"
doc:name="HTTP"
It is deployed as a WAR file in tomcat server. Am able to access the wsdl from my local desktop like this - endpoint?wsdl and works perfectly fine.
How can I access this when deployed in a remote server? What endpoint should it be given? Can it contain localhost and port as it is?
Do I need to refer the context path of the web app? Its a little bit confusing...Can someone help pls?
You're binding to localhost so it'll only work on the machine it's running. You can bind to all interfaces using 0.0.0.0 and the access it remotely using the machine's IP address or domain name.

Howto setup Apache Web Server for clustering a Web Service on two Tomcats

I'm trying to setup an Apache Web Server, so that it balances requests of a client on two Tomcat servers. For the Web Service I uses Axis2. It is deployed on two Tomcats. When I invoke the Web Service, there is always only one Server answering, although the cluster is established. I used this tutorial, Axis2 1.6.1, Tomcat 7, Apache Web Server 2.2 and I am running it on a Windows 32 bit system.
How is it possible to balance the client requests on both Tomcats?
It might have something to do with the proxy configuration of the Web Server, but its just a thought.
If you need screenshots or else, please let me know. And sorry for my german accent :)
Usually with load-balancing (clustering) one server will be answering first - which one will be decided by load-balancer (proxy) in it's configuration. Load-balancer (proxy) usually queries all clustered servers until it finds one that is less busy. In order to tests clustered environment you have to simulate (or create) high load or you can "slow down" (or stop completely) one of the servers.
Ok it works now. It was a configuration problem in the axis2.xml file, where I had the wrong IP. now I have the following configuration on every instance:
<!-- The host name or IP address of this member -->
<parameter name="localMemberHost">127.0.0.1</parameter>
Also important is the server.xml file of the Tomcat instances. Here the Shutdown port must be different for each instance:
Instance 1:
<Server port="8005" shutdown="SHUTDOWN">
Instance 2:
<Server port="8015" shutdown="SHUTDOWN">
The connector port must be different, too:
Instance 1:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Instance 2:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
Then I just set these adjustments in the httpd.conf file of the Apache Webserver like this:
BalancerMember ajp://127.0.0.1:8009 min=1 max=1 route=node1 loadfactor=1
BalancerMember ajp://127.0.0.1:8010 min=1 max=1 route=node2 loadfactor=1
and now my cluster works fine. Sometimes you have to go back some steps to understand whats wrong.

ActiveMQ Web Console only listens on localhost

I've got ActiveMQ installed as I want it. However, the Web Console only listens on localhost - how do I make it listen on all interfaces? I'm sure it's a "host"="0.0.0.0" somewhere but where?
For the latest versions of ActiveMQ (e.g. 5.5), you can configure within the <activemq>/conf/jetty.xml file by adding a host property setting to the SelectChannelConnector bean.
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
**<property name="host" value="0.0.0.0"/>**
<property name="port" value="8161" />
</bean>
Looking at the SelectChannelConnector code, if the host property is not set (i.e. null) then it will use the default for InetSocketAddress, which is supposed to be the "wildcard address" per the JavaDoc, so I'm surprised its not automatically binding to all addresses on your server by default.
Hope that helps,
Scott
FuseSource

Can GlassFish 2 be configured to make a webservice accessible **only** from some specific port?

Currently we serve some web applications in a domain on port 80. This port is accessible from the internet.
Now there should be deployed some EJB wich expose some of their methods as webservices using the #WebMethod annotation. These should not be accessibe from the (public) port 80, but only from port 8000, which can be accessed only from the internal network.
I set up a new virtual server named "internal" which uses a http-listener that listens on port 8000:
<virtual-server hosts="${com.sun.aas.hostName}" http-listeners="http-listener-3" id="internal" log-file="${com.sun.aas.instanceRoot}/logs/server.log" state="on">
<property name="sso-enabled" value="false"/>
<property name="docroot" value="${com.sun.aas.instanceRoot}/docroot"/>
<property name="accesslog" value="${com.sun.aas.instanceRoot}/logs/access"/>
</virtual-server>
<http-listener acceptor-threads="1" address="0.0.0.0" blocking-enabled="false" default-virtual-server="internal" enabled="true" family="inet" id="http-listener-3" port="8000" security-enabled="false" server-name="" xpowered-by="false">
<property name="proxiedProtocols" value="ws/tcp"/>
</http-listener>
Then I assigned this virtual server to the enterprise application that hosts the service by setting the virtual-servers attribute.
<application-ref disable-timeout-in-minutes="30" enabled="true" lb-enabled="false" ref="myapp" virtual-servers="internal"/>
The webservices are available now both on port 80 and 8000, but what is needed is that they are available on port 8000 only, not from 80. Is there a way to achieve this in GlassFish 2 using a single domain? Or must a second domain be used?
You need to pull your webMethods out and place them into their own app. Then when you deploy the app you can manage (the target tab) which server / virtual servers they end up on.