tag:blogger.com,1999:blog-38582604191100162152024-02-19T02:27:15.368-08:00All things JBossAnonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-3858260419110016215.post-44793576242177548912016-10-26T09:11:00.000-07:002016-10-26T09:11:23.516-07:00Monitoring Artemis on JBoss EAP 7 with HawtioIn case you want to use Hawtio on JBoss EAP 7 to monitor the Apache ActiveMQ Artemis message broker, you can follow these steps<br />
<br />
<br />
<ul>
<li>Download hawtio 1.4.66 from https://oss.sonatype.org/content/repositories/public/io/hawt/hawtio-no-slf4j/1.4.66/hawtio-no-slf4j-1.4.66.war</li>
<li>Copy hawtio-no-slf4j-1.4.66.war to JBOSS_HOME/standalone/deployments/hawtio.war </li>
<li>Build the Hawtio Artemis Plugin</li>
</ul>
<br />
<blockquote class="tr_bq">
git clone https://github.com/rh-messaging/artemis-hawtio/<br />cd artemis-hawtio<br />mvn clean install</blockquote>
<br />
<ul>
<li>Copy artemis/target/artemis-plugin-1.0.0-SNAPSHOT.war to JBOSS_HOME/standalone/deployments/artemis-plugin.war</li>
<li>Execute the following commands via the JBoss CLI</li>
</ul>
<br />
<blockquote class="tr_bq">
/subsystem=messaging-activemq/server=default:write-attribute(name=jmx-management-enabled, value=true)<br />/subsystem=messaging-activemq/server=default:write-attribute(name=statistics-enabled,value=true)</blockquote>
<br />
Now you navigate to http://<JBoss-Management-IP>:8080/hawtio and watch Hawtio in action.<br />
<br />
Below you can find example when pushing Artemis to it's limits, using a custom dashboard to show queue statistics:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTIL5vWF-rQUUoLEH_ArwcOoMhLf3A1HUfjkeQsgtLQWVwTBCQuPoHvSMdaWvr2xKl4I1msqLQVte3TfXqgoFqNFRpbhTxK_2I0o3UPJYy1aA2q_X9Xr2xFZeJSyDMG5SshVBrIzzn3gA/s1600/Hawtio_on_JBoss_EAP_7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="148" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTIL5vWF-rQUUoLEH_ArwcOoMhLf3A1HUfjkeQsgtLQWVwTBCQuPoHvSMdaWvr2xKl4I1msqLQVte3TfXqgoFqNFRpbhTxK_2I0o3UPJYy1aA2q_X9Xr2xFZeJSyDMG5SshVBrIzzn3gA/s320/Hawtio_on_JBoss_EAP_7.png" width="320" /></a></div>
Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-74657031130899937782015-06-29T00:16:00.000-07:002015-06-29T00:16:03.077-07:00Connecting jvisualvm to JBoss EAP 6.2 on WindowsIn case you want to use jvisualvm to connect up to JBoss EAP 6.2 on Windows, you can use the following script (which should be placed into <i>JBOSS_HOME/bin</i> as <i><b>jvisualvm.bat</b></i>): <br />
<blockquote class="tr_bq">
<span><span>@echo off </span></span><br /><span>rem ------------------------------------------------------------------------- </span><br /><span>rem jvisualvm script for Windows </span><br /><span>rem ------------------------------------------------------------------------- </span><br /><span>rem </span><br /><span>rem A script for running jvisualvm with the remoting-jmx libraries on the classpath. </span><br /><span> </span><br /><span>rem $Id$ </span><br /><span> </span><br /><span>@if not "%ECHO%" == "" echo %ECHO% </span><br /><span>@if "%OS%" == "Windows_NT" setlocal </span><br /><span> </span><br /><span>if "x%JAVA_HOME%" =="x" ( </span><br /><span> echo JAVA_HOME environment variable has not been set - please set and re-run! </span><br /><span> goto :EOF </span><br /><span>) </span><br /><span> </span><br /><span>if "%OS%" == "Windows_NT" ( </span><br /><span> set "DIRNAME=%~dp0%" </span><br /><span>) else ( </span><br /><span> set DIRNAME=.\ </span><br /><span>) </span><br /><span> </span><br /><span>pushd %DIRNAME%.. </span><br /><span>set "RESOLVED_JBOSS_HOME=%CD%" </span><br /><span>popd </span><br /><span> </span><br /><span>if "x%JBOSS_HOME%" == "x" ( </span><br /><span> set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%" </span><br /><span>) </span><br /><span> </span><br /><span>pushd "%JBOSS_HOME%" </span><br /><span>set "SANITIZED_JBOSS_HOME=%CD%" </span><br /><span>popd </span><br /><span> </span><br /><span>if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" ( </span><br /><span> echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur. </span><br /><span>) </span><br /><span> </span><br /><span>set DIRNAME= </span><br /><span> </span><br /><span>if "%OS%" == "Windows_NT" ( </span><br /><span> set "PROGNAME=%~nx0%" </span><br /><span>) else ( </span><br /><span> set "PROGNAME=jdr.bat" </span><br /><span>) </span><br /><span> </span><br /><span>rem Setup JBoss specific properties </span><br /><span>if "x%JAVA_HOME%" == "x" ( </span><br /><span> echo JAVA_HOME is not set. Unable to locate the jars needed to run jconsole. </span><br /><span> goto END </span><br /><span>) </span><br /><span> </span><br /><span>rem Find jboss-modules.jar, or we can't continue </span><br /><span>if exist "%JBOSS_HOME%\jboss-modules.jar" ( </span><br /><span> set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar" </span><br /><span>) else ( </span><br /><span> echo Could not locate "%JBOSS_HOME%\jboss-modules.jar". </span><br /><span> echo Please check that you are in the bin directory when running this script. </span><br /><span> goto END </span><br /><span>) </span><br /><span> </span><br /><span>rem Setup The Classpath </span><br /><span>set CLASSPATH=%JBOSS_HOME%\bin\client\jboss-cli-client.jar </span><br /><span> </span><br /><span> </span><br /><span>"%JAVA_HOME%\bin\jvisualvm.exe" "-cp:a" "%CLASSPATH%" </span><br /><span> </span><br /><span>:END </span><br /><span>goto :EOF </span><br /><span>:EOF </span></blockquote>
<br />
Now inside jvisualvm you can connect to JBoss EAP 6 using JMX and a URL of the form <i><b>service:jmx:remoting-jmx://<host>:<native-management-port></b></i> <br />
<br />
<span>See also "How to connect to JBoss EAP 6 using JConsole" (</span><a class="jive-link-external-small" href="https://access.redhat.com/solutions/149973" rel="nofollow" target="_blank">https://access.redhat.com/solutions/149973</a><span>)</span> Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-70656579731933359332015-04-09T00:03:00.000-07:002015-04-09T00:03:38.378-07:00Creating a JMS Bridge with XA on JBoss EAP 6.3In case you want to create a JMS Bridge supporting XA on JBoss EAP 6.3 here are some hints on how to achieve this. I'm using HornetQ and ActiveMQ (with resource-adapter version 5.11.1) througout the example with queue A and C residing on ActiveMQ and a queue B on HornetQ, messages will be bridged from queue A to B to C.<br />
<br />
In standalone configuration file add the following admin-object to the resource-adapter configuration for ActiveMQ:<br />
<blockquote class="tr_bq">
<admin-object class-name="org.apache.activemq.ActiveMQXAConnectionFactory" jndi-name="java:/AMQXAConnectionFactory" enabled="true" use-java-context="true" pool-name="AMQXAConnectionFactory"><br /> <config-property name="brokerURL"><br /> failover:(tcp://localhost:61616)?jms.rmIdFromConnectionId=true&amp;maxReconnectAttempts=0&amp;jms.xaAckMode=2&amp;jms.userName=admin&amp;jms.password=redhat<br /> </config-property><br /> </admin-object></blockquote>
You also need to do a modification to the ra.xml of the ActiveMQ resource-adapter consisting of adding the following:<br />
<br />
<adminobject><br /> <adminobject-interface>javax.jms.XAConnectionFactory</adminobject-interface><br /> <adminobject-class>org.apache.activemq.ActiveMQXAConnectionFactory</adminobject-class><br /> <config-property><br /> <config-property-name>brokerURL</config-property-name><br /> <config-property-type>java.lang.String</config-property-type><br /> </config-property><br /></adminobject><br />
<br />
In the messaging subsystem add the following after hornetq-server:<br />
<br />
<blockquote class="tr_bq">
<jms-bridge name="activemq-hornetq"><br /> <source><br /> <connection-factory name="AMQXAConnectionFactory"/><br /> <destination name="queue/queueA"/><br /> </source><br /> <target><br /> <connection-factory name="XAConnectionFactory"/><br /> <destination name="queue/queueB"/><br /> </target><br /> <quality-of-service>ONCE_AND_ONLY_ONCE</quality-of-service><br /> <failure-retry-interval>1000</failure-retry-interval><br /> <max-retries>-1</max-retries><br /> <max-batch-size>1</max-batch-size><br /> <max-batch-time>100</max-batch-time><br /></jms-bridge><br /><jms-bridge name="hornetq-activemq"><br /> <source><br /> <connection-factory name="XAConnectionFactory"/><br /> <destination name="queue/queueB"/><br /> </source><br /> <target><br /> <connection-factory name="AMQXAConnectionFactory"/><br /> <destination name="queue/queueC"/><br /> </target><br /> <quality-of-service>ONCE_AND_ONLY_ONCE</quality-of-service><br /> <failure-retry-interval>1000</failure-retry-interval><br /> <max-retries>-1</max-retries><br /> <max-batch-size>1</max-batch-size><max-batch-time>100</max-batch-time> </blockquote>
<blockquote>
</jms-bridge></blockquote>
<br />
Now your JMS bridge is ready to operate! Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-80179323148809072822014-12-02T05:05:00.000-08:002014-12-02T05:06:05.766-08:00Deploying Hawtio on JBoss EAP 6In this article I describe how to successfully deploy Hawtio on JBoss EAP.<br />
<br />
You would need<br />
<br />
<ul>
<li>JBoss EAP 6 (I have used JBoss EAP 6.2 which can be downloaded from <a href="https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=appplatform&version=6.2.0">here)</a> </li>
<li>Hawtio Web-Application (the version 1.4.37 can be obtained from <a href="https://oss.sonatype.org/content/repositories/public/io/hawt/hawtio-no-slf4j/1.4.37/hawtio-no-slf4j-1.4.37.war">here</a>)</li>
</ul>
<br />
Before actually deploying Hawtio you would need to do some small changes on <span style="font-family: "Courier New",Courier,monospace;">hawtio-no-slf4j-1.4.37.war</span>.<br />
<br />
<ul>
<li>To <span style="font-family: "Courier New",Courier,monospace;">WEB-INF/lib/guava-15.0.jar</span> add <span style="font-family: "Courier New",Courier,monospace;">META-INF/beans.xml</span> with the following content </li>
</ul>
<blockquote class="tr_bq">
<?xml version="1.0" encoding="UTF-8"?><br />
<beans xmlns="http://java.sun.com/xml/ns/javaee"<br />
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
xmlns:weld="http://jboss.org/schema/weld/beans"<br />
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd<br />
http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd"><br />
<weld:scan><br />
<weld:exclude name="com.google.**"/><br />
</weld:scan><br />
</beans> </blockquote>
as otherwise the application will not deploy successfully and will report the<br />
following error<br />
<blockquote class="tr_bq">
21:15:28,074 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: hawtio-no-slf4j-1.4.37.war<br />
21:15:28,091 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment hawtio-no-slf4j-1.4.37.war<br />
21:15:29,659 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."hawtio-no-slf4j-1.4.37.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."hawtio-no-slf4j-1.4.37.war".WeldStartService: Failed to start service<br />
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]<br />
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]<br />
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]<br />
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_55]<br />
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[parameter 1] of [constructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]<br />
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:312)<br />
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)<br />
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:144)<br />
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)<br />
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:383)<br />
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:368)<br />
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)<br />
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)<br />
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]<br />
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]<br />
... 3 more<br />
<br />
21:15:29,877 ERROR [org.jboss.as.server] (HttpManagementService-threads - 3) JBAS015870: Deploy of deployment "hawtio-no-slf4j-1.4.37.war" was rolled back with the following failure message: <br />
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"hawtio-no-slf4j-1.4.37.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"hawtio-no-slf4j-1.4.37.war\".WeldStartService: Failed to start service<br />
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[parameter 1] of [constructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]"}}<br />
21:15:29,898 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016009: Stopping weld service for deployment hawtio-no-slf4j-1.4.37.war<br />
21:15:30,003 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment hawtio-no-slf4j-1.4.37.war (runtime-name: hawtio-no-slf4j-1.4.37.war) in 128ms</blockquote>
<ul>
<li>Add <span style="font-family: "Courier New",Courier,monospace;">WEB-INF/jboss-web.xml<span style="font-family: Arial,Helvetica,sans-serif;"> as follows</span></span></li>
</ul>
<blockquote class="tr_bq">
<jboss-web><br />
<context-root>/hawtio</context-root><br />
</jboss-web> </blockquote>
<ul>
<li> Add <span style="font-family: "Courier New",Courier,monospace;">WEB-INF/jboss-deployment-structure.xml<span style="font-family: Arial,Helvetica,sans-serif;"> as follows</span></span></li>
</ul>
<blockquote class="tr_bq">
<?xml version="1.0"?><br />
<jboss-deployment-structure><br />
<deployment><br />
<dependencies><br />
<module name="org.apache.log4j"/><br />
<module name="org.slf4j"/><br />
<module name="org.slf4j.impl"/><br />
</dependencies><br />
</deployment><br />
</jboss-deployment-structure></blockquote>
<br />
<ul>
<li>Remove <span style="font-family: "Courier New",Courier,monospace;">WEB-INF/classes/log4j.properties</span></li>
</ul>
Now you can deploy <span style="font-family: "Courier New",Courier,monospace;">hawtio-no-slf4j-1.4.37.war</span> to JBoss EAP 6 Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-71273045429408960742014-11-25T06:24:00.001-08:002014-11-27T06:52:26.725-08:00Using ELK's JMX Plugin to gather JBoss EAP metricsIn this short blog post I outline how to use the ELK (ElasticSearch/LogStash/Kibana) stack to gather data via JMX from JBoss EAP 6.<br />
<br />
Ingredients:<br />
<br />
- ElasticSearch 1.4.0<br />
- Logstash 1.4.2<br />
- Kibana 3.1.2<br />
- JBoss EAP 6.2<br />
<br />
After having gone throught the downloading and installation process first we need to extract some libs out of the modules for JBoss EAP 6.2 that are needed for getting remote JMX calls to work.<br />
<br />
In <span style="font-family: "Courier New",Courier,monospace;">elastic-search-1.4.0/vendor/bundle/jruby/1.9/gems/jmx4r-0.1.4<span style="font-family: Arial,Helvetica,sans-serif;">/<span style="font-family: "Courier New",Courier,monospace;">lib</span> create a file </span>jboss_remoting.rb</span><br />
<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">module JMX<br /> module JBoss<br /> java_import java.lang.System<br /><br /> class JBossRemoting<br /><br /> sep = System.get_property 'file.separator'<br /> home = System.get_property 'jboss.home'<br /><br /> if home != nil<br /> modulebase = [home, 'modules','system','layers','base','org','jboss'].join(sep)<br /><br /> libs = [<br /> ['remoting-jmx','main'],<br /> ['remoting3','main'],<br /> ['logging','main'],<br /> ['xnio','main'],<br /> ['xnio','nio','main'],<br /> ['sasl','main'],<br /> ['marshalling','main'],<br /> ['marshalling','river','main'],<br /> ['as','cli','main'],<br /> ['staxmapper','main'],<br /> ['as','protocol','main'],<br /> ['dmr','main'],<br /> ['as','controller-client','main'],<br /> ['threads','main']<br /> ]<br /><br /> for index in 0 ... libs.size<br /> Dir[modulebase + sep + libs[index].join(sep) + sep + "*.jar"].each {|file| require file }<br /> end<br /> end<br /> end<br /> end<br />end</span></blockquote>
<br />
In <span style="font-family: "Courier New",Courier,monospace;">elastic-search-1.4.0/vendor/bundle/jruby/1.9/gems/jmx4r-0.1.4/lib/jmx4r.rb</span> after<br />
<br />
<ul></ul>
<ul>
</ul>
<blockquote class="tr_bq">
require 'jruby'</blockquote>
<br />
add<br />
<blockquote class="tr_bq">
require 'jboss_remoting'</blockquote>
In <span style="font-family: "Courier New",Courier,monospace;">logstash-1.4.2/config/logstash.conf</span> I created the following configuration<br />
<br />
<blockquote class="tr_bq">
input {<br />
jmx{<br />
path => "logstash-1.4.2/jmx"<br />
polling_frequency => 30<br />
type => "jmx"<br />
nb_thread => 4<br />
}<br />
}<br />
<br />
output {<br />
elasticsearch { host => localhost }<br />
} </blockquote>
<br />
and in <span style="font-family: "Courier New",Courier,monospace;">logstash-1.4.2/jmx/jmx.conf</span> I configured<br />
<br />
<blockquote class="tr_bq">
{<br /> // JBoss Remoting JMX URL<br /> "url" : "service:jmx:remoting-jmx://localhost:9999",<br />
//username to connect to jmx<br /> "username" : "<your-user>",<br /> //password to connect to jmx<br /> "password": "<your-password>",<br /> "alias" : "jmx.instance1.elasticsearch",<br /> //List of JMX metrics to retrieve<br /> "queries" : [<br /> {<br /> "object_name" : "java.lang:type=Memory",<br /> "attributes" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ],<br /> "object_alias" : "Memory"<br /> }, {<br /> "object_name" : "java.lang:type=Runtime",<br /> "attributes" : [ "Uptime", "StartTime" ],<br /> "object_alias" : "Runtime"<br /> }, {<br /> "object_name" : "java.lang:type=Threading",<br /> "attributes" : [ "ThreadCount", "TotalStartedThreadCount", "DaemonThreadCount", "PeakThreadCount" ],<br /> "object_alias" : "Threading"<br /> }, {<br /> "object_name" : "java.lang:type=OperatingSystem",<br /> "attributes" : [ "OpenFileDescriptorCount", "FreePhysicalMemorySize", "CommittedVirtualMemorySize", "FreeSwapSpaceSize", "ProcessCpuLoad", "ProcessCpuTime", "SystemCpuLoad", "TotalPhysicalMemorySize", "TotalSwapSpaceSize", "SystemLoadAverage" ],<br /> "object_alias" : "OperatingSystem"<br /> } ]<br />}</blockquote>
<blockquote>
<br /></blockquote>
As the original JMX input plugin only supports configuration via host and port you need to apply the pull request 141 (https://github.com/elasticsearch/logstash-contrib/pull/141) to your local installation, i.e. by downloading <span style="font-family: "Courier New",Courier,monospace;">https://raw.githubusercontent.com/jcordes73/logstash-contrib/master/lib/logstash/inputs/jmx.rb</span> and save it to <span style="font-family: "Courier New",Courier,monospace;">logstash-1.4.2/lib/logstash/inputs</span><br />
<br />
Now you need to setup a JBoss <b>management</b> user via jboss-eap-6.2/bin/add-user.sh to reflect the username and password defined in jmx.conf above.<br />
<br />
Because of a change in behaviour in regards to security you need to add the following configuration to <b>elasticsearch-1.4.0/config/elasticsearch.yml</b><br />
<br />
<blockquote class="tr_bq">
http.cors.enabled: true<br />
http.cors.allow-origin: "*"</blockquote>
and also change <span style="font-family: "Courier New",Courier,monospace;">http.enabled</span> to <span style="font-family: "Courier New",Courier,monospace;">true</span>.<br />
<br />
We need to set some environment variables so that the JBoss Remoting libraries can be found from an existing JBoss EAP installation:<br />
<br />
<blockquote class="tr_bq">
JBOSS_HOME=/opt/jboss-eap-6.2<br />
export JBOSS_HOME<br />
JAVA_OPTS="-Djboss.home=$JBOSS_HOME"<br />
export JAVA_OPTS</blockquote>
Now you can start ElasticSearch via<span style="font-family: "Courier New",Courier,monospace;"> elasticsearch-1.4.0/bin/elasticsearch</span> and logstash via <span style="font-family: "Courier New",Courier,monospace;">logstash-1.4.2/bin/logstash -f </span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace;">logstash-1.4.2</span>/config/logstash.conf</span>.<br />
<br />
To finally see your JMX data via Kibana, open kibana-3.1.2/index.html with your favourite web-browser.Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-27928955120375515232014-11-11T12:20:00.001-08:002015-06-29T00:00:12.747-07:00Hawtio authentication with LDAP on JBoss Fuse<div id="jive_content_id_Security">
Finally here is the second part on Hawtio authentication with LDAP, this time on JBoss Fuse / A-MQ 6.1</div>
<div id="jive_content_id_Security">
<br /></div>
<ul>
<li>Download JBoss Fuse 6.1 from <a href="https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=jboss.fuse&version=6.1.0">https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=jboss.fuse&version=6.1.0 </a>and follow the installation instructions</li>
</ul>
<ul>
<li>Create a file named <b>ldap-auth.xml</b> and copy it into the deploy folder (you need to adjust the LDAP settings according to your structure)</li>
</ul>
<div class="dp-highlighter">
<blockquote>
<?xml version="1.0" encoding="UTF-8"?> <br />
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:jaas="http://karaf.apache.org/xmlns/jaas/v1.0.0" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"> <br />
<ext:property-placeholder placeholder-prefix="${" placeholder-suffix="}"/> <br />
<jaas:config name="karaf" rank="2"> <br />
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule" flags="required"> <br />
connection.url=ldap://<LDAP-IP>:389 <br />
connection.username=cn=Manager,dc=redhat,dc=com <br />
connection.password=redhat <br />
user.base.dn=ou=User,ou=ActiveMQ,dc=activemq,dc=redhat,dc=com <br />
user.filter=(uid=%u) <br />
user.search.subtree=true <br />
role.base.dn=ou=User,ou=ActiveMQ,dc=activemq,dc=redhat,dc=com <br />
role.filter=(uid=%u) <br />
role.name.attribute=uid <br />
role.search.subtree=true <br />
authentication=simple <br />
</jaas:module> <br />
</jaas:config> <br />
</blueprint> </blockquote>
(see also <a class="jive-link-external-small" href="https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_A-MQ/6.1/html-single/Security_Guide/index.html#JAASAuth-LDAPLoginModule" rel="nofollow" target="_blank">https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_A-MQ/6.1/html-single/Security_Guide/index.html#JAASAuth-LDAPLoginModule</a>)<br />
<br />
<ul>
<li> In <b>etc/system.properties</b> add</li>
</ul>
<blockquote>
hawtio.authenticationEnabled=true <br />
hawtio.realm=karaf <br />
hawtio.role=admin <br />
hawtio.rolePrincipalClasses=org.apache.karaf.jaas.boot.principal.RolePrincipal,org.apache.karaf.jaas.modules.RolePrincipal,org.apache.karaf.jaas.boot.principal.GroupPrincipal </blockquote>
<br />
(see <a class="jive-link-external-small" href="https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.1/html-single/Security_Guide/#WebConsole" rel="nofollow" target="_blank">https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.1/html-single/Security_Guide/#WebConsole</a>)) </div>
Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-14800858729260549372014-11-11T12:01:00.002-08:002014-11-11T12:02:27.396-08:00HornetQ-ActiveMQ BridgeIn case you need a messaging bridge between HornetQ on JBoss EAP and ActiveMQ on JBoss Fuse / A-MQ then the projects on Github at <a href="https://github.com/jcordes73/messaging-bridges">https://github.com/jcordes73/messaging-bridges</a> maybe what you are after.<br />
<br />
There I'm featuring<br />
<br />
<ul class="task-list">
<li>JBoss Fuse / A-MQ 6.1</li>
<li>JBoss EAP 6.x (at least 6.1.1 required)</li>
<li>ActiveMQ on JBoss Fuse / A-MQ</li>
<li>HornetQ on JBoss EAP 6</li>
<li>ActiveMQ RAR Adapter on JBoss EAP 6</li>
<li>SSL for JBoss Fuse / A-MQ <--> JBoss EAP communication</li>
<li>XA</li>
</ul>
The bridge comes in two flavours<br />
<br />
<ul>
<li>Running on JBoss EAP</li>
<li>Running on JBoss Fuse / A-MQ</li>
</ul>
Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-88494590671283913952014-07-28T02:41:00.000-07:002014-11-13T00:37:01.697-08:00How to configure local JMS transactions using Camel with WebSphere MQ on JBoss EAP 6.2<div class="tr_bq">
In this article I will show you how to configure local JMS transactions using WebSphere MQ with Camel on JBoss EAP 6.2:</div>
<br />
Your Spring context setup should include the following information:<br />
<blockquote class="tr_bq">
<span style="background-color: white;"><bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"><br /> <property name="jndiName" value="java:jboss/eis/MQCF" /><br /> <property name="lookupOnStartup" value="false" /><br /> <property name="cache" value="true" /><br /> <property name="proxyInterface" value="javax.jms.ConnectionFactory" /><br /> </bean><br /><br /> <bean id="jmsTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"><br /> <property name="transactionManagerName" value="java:/TransactionManager" /><br /> </bean><br /><br /> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"><br /> <property name="connectionFactory" ref="jmsConnectionFactory" /><br /> <property name="transacted" value="true" /><br /> <property name="transactionManager" ref="jmsTransactionManager" /><br /> </bean></span></blockquote>
The important stuff here is to use <b>JtaTransactionManager</b>. <br />
<br />
In the JBoss EAP 6.2 configuration the WebSphere resource-adapter should be configured like this:<br />
<br />
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1"><br />
<resource-adapters><br />
<resource-adapter id="wmq.jmsra.rar"><br />
<archive><br />
wmq.jmsra.rar<br />
</archive><br />
<transaction-support>LocalTransaction</transaction-support><br />
<connection-definitions><br />
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/eis/MQCF" enabled="true" use-java-context="true" pool-name="WMQConnectionFactoryPool" use-ccm="true"><br />
<config-property name="port"><br />
MQ.PORT<br />
</config-property><br />
<config-property name="channel"><br />
MQ.CHANNEL<br />
</config-property><br />
<config-property name="hostName"><br />
MQ.HOST<br />
</config-property><br />
<config-property name="transportType"><br />
CLIENT<br />
</config-property><br />
<config-property name="queueManager"><br />
MQ.QUEUEMANAGER<br />
</config-property><br />
<pool><br />
<min-pool-size>1</min-pool-size><br />
<max-pool-size>10</max-pool-size><br />
</pool><br />
</connection-definition><br />
</connection-definitions><br />
</resource-adapter><br />
</resource-adapters><br />
</subsystem><br />
<br />
In case you want to use the JBoss CLI to set things up you can use the following script:<br />
<br />
<blockquote>
if (outcome != success) of /subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar:read-resource()
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar:add(archive=wmq.jmsra.rar,transaction-support=XATransaction)
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=WMQConnectionFactoryPool:add(class-name=com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl, jndi-name="java:jboss/eis/MQCF", enabled=true, use-java-context=true, use-ccm=true,min-pool-size=1, max-pool-size=10)
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=WMQConnectionFactoryPool/config-properties=connectionNameList:add(value="${wmq.connectionNameList}")
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=WMQConnectionFactoryPool/config-properties=channel:add(value="${wmq.channel}")
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=WMQConnectionFactoryPool/config-properties=transportType:add(value="CLIENT")
/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=WMQConnectionFactoryPool/config-properties=queueManager:add(value="${wmq.queueManager}")
end-if</blockquote>
<br />
In this script I'm using system-variables that you could define in a property file and pass it on during JBoss EAP via the -P parameter.<br />
<br />
Finally to get everything working you should replace the MQ.* values with you actual settings and copy wmq.jmsra.rar to JBOSS_HOME/standalone/deployments.<br />
<br />
In case you are using an EAR to package your application and you don't want include WebSphere MQ libraries, you can add a jboss-deployment-structure.xml inside the META-INF directory of the EAR with the following content:<br />
<br />
<jboss-deployment-structure><br />
<deployment><br />
<dependencies><br />
<module name="deployment.wmq.jmsra.rar" export="true" /><br />
</dependencies><br />
</deployment><br />
</jboss-deployment-structure><br />
<br />
To declare a dependency of your EAR to wmq.jmsra.rar also in order of deployment add jboss-all.xml to the same META-INF directory:<br />
<br />
<jboss umlns="urn:jboss:1.0"><br />
<jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0"><br />
<dependency name="wmq.jmsra.rar" /><br />
</jboss-deployment-dependencies><br />
</jboss>Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com0tag:blogger.com,1999:blog-3858260419110016215.post-12261896358913557082014-03-08T04:05:00.002-08:002014-03-08T04:38:38.821-08:00Hawtio authentication with LDAP on Tomcat 7<div class="jive-rendered-content">
<h1>
<span style="font-size: 24pt;">Motivation</span></h1>
<div style="height: 8pt; min-height: 8pt; padding: 0px;">
<br /></div>
<span style="font-size: 14pt;">Larger
organizations usually do grant access to applications via directory
servers, i.e. Active Directory or OpenLDAP. For this purpose I have
created this document describing how this can be implemented when using
the Hawtio web-application.</span><br />
<span style="font-size: 14pt;"><br /></span>
<span style="font-size: 14pt;">This article is part I of three different scenarios:</span><br />
<ul>
<li><span style="font-size: 14pt;">Hawtio deployed on Tomcat 7</span></li>
<li><span style="font-size: 14pt;">Hawtio deployed on JBoss Fuse</span></li>
<li><span style="font-size: 14pt;">Hawtio deployed on JBoss EAP</span></li>
</ul>
<b><br /></b>
<br />
<h1>
<span style="font-size: 24pt;">Hawtio authentication with LDAP on Tomcat 7<b><br /></b></span></h1>
<span style="font-size: 24pt;"><b><br /></b></span>
<span style="font-size: 14pt;">This section will show you how to setup authentication for Hawtio on Tomcat. For this purpose we will</span><br />
<ul>
<li><span style="font-size: 14pt;">Install Tomcat 7 (part of EWS 2.0.1)</span></li>
<li><span style="font-size: 14pt;">Configure LDAP authentication on Tomcat 7</span></li>
<li><span style="font-size: 14pt;">Install Apache Directory Server</span></li>
<li><span style="font-size: 14pt;">Deploy Hawtio on Tomcat 7</span></li>
</ul>
<span style="font-size: 14pt;">The steps are described in more details in the following sub-sections.</span><br />
<span style="font-size: 18pt;"><br /></span>
<br />
<h2>
<span style="font-size: 18pt;">Install Tomcat 7</span></h2>
<ul>
<li><span style="font-size: 14pt;">Download <a class="jive-link-external-small" href="https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=23043">Red Hat JBoss Web Server 2.0.1-1 Application Servers for RHEL 6, x86_64</a></span></li>
<li><span style="font-size: 14pt;">Extract the archive</span></li>
</ul>
<span style="font-size: 14pt;"> </span><span style="font-family: courier new,courier; font-size: 10pt;">unzip jboss-ews-application-servers-2.0.1-1-RHEL6-x86_64.zip</span><br />
<ul>
<li><span style="font-size: 14pt;">Create jboss-ews-2.0/tomcat7/bin/setenv.sh with the following content</span></li>
</ul>
<span style="font-family: courier new,courier;">
JAVA_OPTS="${JAVA_OPTS}
-Djava.security.auth.login.config=${CATALINA_HOME}/conf/jaas.config
-Dhawtio.authenticationEnabled=true -Dhawtio.realm=hawtio
-Dhawtio.role=admins </span><br />
<span style="font-family: courier new,courier;"> -Dhawtio.rolePrincipalClasses=com.sun.security.auth.UserPrincipal"</span><br />
<div style="height: 8pt; min-height: 8pt; padding: 0px;">
<br /></div>
<h2>
Configure LDAP authentication on Tomcat 7</h2>
<ul>
<li><span style="font-size: 14pt;">Create jboss-ews-2.0/tomcat7/conf/jaas.config</span></li>
</ul>
<span style="font-family: courier new,courier;"> hawtio {</span><br />
<span style="font-family: courier new,courier;"> com.sun.security.auth.module.LdapLoginModule REQUIRED</span><br />
<span style="font-family: courier new,courier;"> userProvider="ldap://localhost:10389/ou=people,dc=example,dc=com"</span><br />
<span style="font-family: courier new,courier;"> bindPrincipal="uid=admin,ou=system"</span><br />
<span style="font-family: courier new,courier;"> bindCredentials="secret"</span><br />
<span style="font-family: courier new,courier;"> bindAuthenticationType="simple"</span><br />
<span style="font-family: courier new,courier;"> userFilter="(&(uid={USERNAME})(objectClass=inetOrgPerson))"</span><br />
<span style="font-family: courier new,courier;"> authzIdentity="{OU}"</span><br />
<span style="font-family: courier new,courier;"> useSSL=false</span><br />
<span style="font-family: courier new,courier;"> debug=true;</span><br />
<span style="font-family: courier new,courier;"> };</span><br />
<ul>
<li><span style="font-size: 14pt;">In jboss-ews-2.0/tomcat7/conf/server.xml insert into the Host section (after the Valve)</span></li>
</ul>
<span style="font-family: courier new,courier;"> <Context path="/hawtio-default-1.2.2" crossContext="true"></span><br />
<span style="font-family: courier new,courier;"> <Realm className="org.apache.catalina.realm.JAASRealm" appName="hawtio"/></span><br />
<span style="font-family: courier new,courier;"> </Context></span><br />
<span style="font-family: courier new,courier;"><br /></span>
<br />
<h2>
<span style="font-size: 14pt;">Install Apache Directory Server</span></h2>
<ul>
<li><span style="font-size: 14pt;">Install Apache Directory Studio in Eclipse (more info at <a class="jive-link-external-small" href="http://directory.apache.org/studio/">http://directory.apache.org/studio/</a>). I have used JBDS 7.1 for this purpose.</span><ul>
<li><span style="font-size: 14pt;">In Eclipse navigate to "Help / Install New Software" and add <a class="jive-link-external-small" href="http://directory.apache.org/studio/update/2.x/">http://directory.apache.org/studio/update/2.x/</a>.</span></li>
<li><span style="font-size: 14pt;">Choose version 2.0.0.v20130628, but omit "Apache Directory Studio RCP" as there was an issue with missing dependencies</span></li>
</ul>
</li>
<li><span style="font-size: 14pt;">Create a Apache DS instance</span><ul>
<li><span style="font-size: 14pt;">Open the LDAP perspective</span></li>
<li><span style="font-size: 14pt;">Create a new LDAP server of type "ApacheDS 2.0.0"</span></li>
<li><span style="font-size: 14pt;">Create a new Connection</span><ul>
<li><span style="font-size: 14pt;">Assign port <b>10389</b></span></li>
<li><span style="font-size: 14pt;">Specify bind user/password as <b>uid=admin,ou=system/secret</b></span></li>
</ul>
</li>
<li><span style="font-size: 14pt;">Import schema</span><ul>
<li><span style="font-size: 14pt;">Open the connection with the bind user/password uid=admin,ou=system/secret</span></li>
<li><span style="font-size: 14pt;">Do a right-click on "Root DSE" and choose Import / LDIF Import</span></li>
<li><span style="font-size: 14pt;">Import the example LDIF file you can download <a href="https://drive.google.com/file/d/0Bz5RssbSxyDKQWZlaFAyWVNfU1k/edit?usp=sharing">here</a> </span></li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>
<span style="font-size: 14pt;">Deploy Hawtio on Tomcat 7</span></h2>
<ul>
<li><span style="font-size: 14pt;">Download Hawtio </span><span style="font-size: 14pt;"><span style="font-size: 14pt;">hawtio-default-1.2.2.war</span> from <a href="https://oss.sonatype.org/content/repositories/public/io/hawt/hawtio-default/1.2.2/hawtio-default-1.2.2.war">here</a></span></li>
<li><span style="font-size: 14pt;">Copy hawtio-default-1.2.2.war to jboss-ews-2.0/tomcat7/webapps/</span></li>
<li><span style="font-size: 14pt;">Startup Tomcat by executing</span></li>
</ul>
<span style="font-family: courier new,courier; font-size: 10pt;"> jboss-ews-2.0/tomcat7/bin/startup.sh</span><br />
<ul>
<li><span style="font-size: 14pt;">In a browser enter the URL <a class="jive-link-external-small" href="http://localhost:8080/hawtio-default-1.2.2/">http://localhost:8080/hawtio-default-1.2.2/</a></span></li>
<li><span style="font-size: 14pt;">Observe catalina.out with</span></li>
</ul>
<span style="font-family: courier new,courier;"> tail -f jboss-ews-2.0/tomcat7/logs/catalina.out</span><span style="font-size: 14pt;"><br /></span><br />
<ul>
<li><span style="font-size: 14pt;">Login with admin/hawtorwhat. This should succeed and the following output is shown in catalina.out</span></li>
</ul>
<span style="font-family: courier new,courier;"> [LdapLoginModule] search-first mode; SSL disabled</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] user provider: ldap://localhost:10389/ou=people,dc=example,dc=com</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] searching for entry belonging to user: admin</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] found entry: uid=admin,ou=people,dc=example,dc=com</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] attempting to authenticate user: admin</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] authentication succeeded</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added LdapPrincipal "uid=admin,ou=people,dc=example,dc=com" to Subject</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added UserPrincipal "admin" to Subject</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added UserPrincipal "admins" to Subject<span style="font-size: 14pt;"><br /></span></span><br />
<ul>
<li><span style="font-size: 14pt;">Logout and try to login with johndoe/notsohawt. This should fail and this output appears in catalina.out</span></li>
</ul>
<span style="font-family: courier new,courier;"> [LdapLoginModule] search-first mode; SSL disabled</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] user provider: ldap://localhost:10389/ou=people,dc=example,dc=com </span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] searching for entry belonging to user: johndoe</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] found entry: uid=johndoe,ou=people,dc=example,dc=com</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] attempting to authenticate user: johndoe</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] authentication succeeded</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added LdapPrincipal "uid=johndoe,ou=people,dc=example,dc=com" to Subject</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added UserPrincipal "johndoe" to Subject</span><br />
<span style="font-family: courier new,courier;"> [LdapLoginModule] added UserPrincipal "programmers" to Subject</span></div>
Anonymoushttp://www.blogger.com/profile/17414687107446384193noreply@blogger.com2