activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esender <sender.e...@gmail.com>
Subject Credentials for ActiveMQ/Jolokia/HawtIO through Java
Date Fri, 01 Nov 2013 22:27:19 GMT
Hello,

I know the default password for 5.9.0's HawtIO/Jolokia is set in the \conf\
folder and is

admin/admin
system/manager
etc

However, none of those password are working when trying to execute the
restful commands through Java:

<code>
      CredentialsProvider credsProvider = new BasicCredentialsProvider();
      credsProvider.setCredentials(new AuthScope(null, -80), new
UsernamePasswordCredentials(
          "*system*", "*manager*"));
      CloseableHttpClient httpclient =
         
HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
      JSONObject jsonObj = new JSONObject();
      JSONArray arg = new JSONArray();
      jsonObj.put("type", "exec");
      jsonObj.put("mbean",
"org.apache.activemq:type=Broker,brokerName=localhost");
      jsonObj.put("operation", "removeQueue");
      arg.add("CLIENT.LCAKPCE00337714");
      jsonObj.put("arguments", arg);
      System.out.println(jsonObj.toString(3));
      StringEntity entityS = new StringEntity(jsonObj.toString());
      entityS.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json"));
      URI uri = URI.create("http://localhost:8161/hawtio/jolokia");
      HttpPost httppost = new HttpPost(uri);
      httppost.setEntity(entityS);
      HttpResponse response = httpclient.execute(httppost);
      System.out.println("Login form get: " + response.getStatusLine());
      for (Header h : response.getAllHeaders())
        System.out.println(h.getName() + "/" + h.getValue());
      HttpEntity entity = response.getEntity();

      InputStream is = entity.getContent();
      String resp = IOUtils.toString(is);
      System.out.println("Response: " + resp);
      IOUtils.closeQuietly(httpclient);
</code>

The following code just spits back a 403 Forbidden reply! I've tried many
combinations of username and passwords.

What works here?

I recall when running 5.8.0 that "admin/admin" worked, but I'd like to use
5.9.0 instead. It would be lame to back out of this version just because the
username and password changed.

Further, which \conf file dictates this password...?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Credentials-for-ActiveMQ-Jolokia-HawtIO-through-Java-tp4673651.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message