activemq-classichawtio

Hawtio 2.10.0 is duplicating the URL for jolokia


I have ActiveMQ 5.15.13 running in my localhost with jolokia without any problem:

# wget --user admin --password admin --header "Origin: http://localhost" --auth-no-challenge http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost
--2020-06-22 14:49:15--  http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8161... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘org.apache.activemq:type=Broker,brokerName=localhost.2’

org.apache.activemq:type=Broker,brokerName=localhost.2                  [ <=>                                                                                                                                                               ]   2,24K  --.-KB/s    in 0s      

2020-06-22 14:49:15 (175 MB/s) - ‘org.apache.activemq:type=Broker,brokerName=localhost.2’ saved [2291]

Hawtio 2.10.0 looks like it's ok, but when I try to connect to ActiveMQ I receive this message:

This Jolokia endpoint is unreachable. Please check the connection details and try again.

I checked network inspector and I guess that's the problem:

Request URL: http://localhost:8161/hawtio/proxy/http/localhost/8161/api/jolokia/

After some changes in the URL I noticed that there's a hardcode part of the URL:

http://localhost:8161/hawtio/proxy/

That part is always there, no matter what I do and the other part:

http/localhost/8161/api/jolokia/

Change always I change the settings, but for some reason it's became a query strings instead of be the expected URL: http://localhost:8161/api/jolokia/

That's are the options I'm using:

ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Dhawtio.disableProxy=true -Dhawtio.realm=activemq -Dhawtio.role=admins -Dhawtio.rolePrincipalClasses=org.apache.activemq.jaas.GroupPrincipal -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"

How can I fix this issue?

Thanks in advance.


Solution

  • After review a lot of "the same" procedure to install Hawtio with ActiveMQ, questions everywhere I could find it and review the documentation for both ActiveMQ and Hawtio, I could finally found some information, from 6 years ago, that suggested an "extra step" when use Hawtio with ActiveMQ which fixed my issue.

    I may be wrong, but from my point of view Hawtio have a highlander bug that use the HOST URL as base, instead of the SETUP CONNECTION URL that is created, to fix that problem, just need to add the following lines into <ACTIVEMQ PATH>/conf/jetty.xml:

    <bean class="org.eclipse.jetty.webapp.WebAppContext">
        <property name="contextPath" value="/hawtio" />
        <property name="resourceBase" value="${activemq.home}/webapps/hawtio" />
        <property name="logUrlOnStart" value="true" />
    </bean>
    

    That's should be inside of:

    <bean id="secHandlerCollection" class="org.eclipse.jetty.server.handler.HandlerCollection">
                    <property name="handlers">
                            <list>
                        <ref bean="rewriteHandler"/>