Hawtio cannot connect to Jolokia if Jolokia protection is enabled

Very new for Hawtio and Jolokia. I DO NOT use JBOSS or any other RedHat product, only Tomcat. I downloaded Hawtio-default.war (version 1.4.21) and Jolokia.war (version 1.2.2). I have two instances of Tomcat (7.0.39) on the local machine (localhost), running on ports 18080 and 38080 respectively.

Problem: if I did not enable security for Jolokia, I was fine to contact Hawtio (port 18080) with Jolokia (port 38080) without any problems. However, if I turned on security for Jolokia, I could not connect and always got below the error (both in FF and Chrome):

These are the details that I did:
 1. Deployed Hawtio.war on Tomcat running on port 18080.
 2. deployed Jolokia.war on Tomcat running on port 38080.
 3. Without security for Jolokia, I was able to connect from Hawtio (port 18080 ) without a proxy server to Jolokia (port 38080). Success.
 4. Then I tried to enable Jolokia protection by uncommenting the section in my web.xml so that it looked like this:

<login-config>
   <auth-method>BASIC</auth-method>
   <realm-name>UserDatabase</realm-name>
</login-config>

<security-constraint>
  <web-resource-collection>
     <web-resource-name>Jolokia-Agent Access</web-resource-name>
     <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
     <role-name>Jolokia</role-name>
  </auth-constraint>
</security-constraint>

<security-role>
   <role-name>Jolokia</role-name>
</security-role>

and in the tomcat / conf / user-tomat.xml file I added:

  <role rolename="Jolokia"/>
  <user username="admin" password="hawtorwhat" roles="Jolokia"/>
  1. Add username / password and role to tomcat-users.xml as:
  2. restarted both instances of Tomcat.
  3. Jolokia http://localhost:38080/jolokia, . , hawtorwhat, . , , OK Jolokia .
  4. http://localhost:18080/hawtio, "", ​​ 38080 ( ), . ( , , hawtio Chrome):

FireFox:

Cannot Connect: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost:18080/hawtio/app/app.js?6f7be3a9a9f2ffe8 :: .send :: line 8" data: no]

Chrome:

Cannot Connect: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:38080/jolokia-war-1.2.2/?maxDepth=2&maxCollectionSize=500&ignoreErrors=true&canonicalNaming=false'.

'use proxy', , , . :

java.net.UnknownHostException: http
    java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
    java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
    java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    java.net.Socket.connect(Socket.java:579)
    java.net.Socket.connect(Socket.java:528)
    java.net.Socket.<init>(Socket.java:425)
    java.net.Socket.<init>(Socket.java:208)
    io.hawt.web.OpenShiftProtocolSocketFactory.createSocket(OpenShiftProtocolSocketFactory.java:36)
    org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
    org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
    org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
    org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    io.hawt.web.ProxyServlet.executeProxyRequest(ProxyServlet.java:418)
    io.hawt.web.ProxyServlet.doPost(ProxyServlet.java:273)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    io.hawt.web.RedirectFilter.process(RedirectFilter.java:66)
    io.hawt.web.RedirectFilter.doFilter(RedirectFilter.java:38)

IE ( 9), , html5, ...

- Hawio, Jolokia, , . # 3 # 7 , Jolokia, , . ? - , ? . , ?

,

--- misterxy

+4

All Articles