Friday, June 10, 2011

Steps to Configure HermesJMS console to monitor Weblogic JMS resources

HermesJMS is a open-source tool developed by Colin Crist. It is used to interact with JMS providers making it easy to browse or search queues and topics, copy messages and delete them. This tool has ability to work with many JMS Providers like JBoss MQ, Active MQ, OpenJMS, Weblogic JMS, Tibco JMS, WebSphere MQ, WebMethods etc...

This post will demonstrate the detailed step-by-step "How to get HermesJMS installed and configured for use with WebLogic JMS". There is web-recording provided in HermesJMS Website to setup HermesJMS with Weblogic. Please click here to go through the web-recording.

Installation

1. Download and save the HermesJMS installer jar in a commonly used location.
2.  Open a command prompt and navigate to your directory where the installer jar is saved. Run "java -jar hermes-installer-1.13.jar" to begin the installation.
3. In the Installation wizard
    -- Click Next on Welcome Screen
    -- Click Next on Information Screen
    -- Accept the terms of License Agreement and  click Next
    -- Enter the appropriate Installation Path [for ex: C:\Program Files\HermesJMS]and click Next
    -- Select the packs to be installed [Default is HermesJMS] and click Next
    -- In Ready to Install, click Next
    -- In Pack Installation progress, once Finished with installation click Next
    -- In Setup Shortcuts screen, enter appropriate name for your Installation [Default is HermesJMS] and click Next
    -- Click Done
4. Please be sure to use the same JVM with HermesJMS as the WLS you want to connect to. You can approach this by adding the PATH and JAVA_HOME variable in <HERMES_HOME>/bin/hermes.bat or hermes.sh file at the beginning of the file right after the REM comments.
For example: I am trying to connect to Weblogic 9.2 domain with JDK 1.5 so i set as below.
set PATH=C:\oracle\Java\jdk1.5.0_22\jre\bin
set JAVA_HOME=C:\oracle\Java\jdk1.5.0_22\jre


Note: If you are trying to connect to Weblogic 10.3 domain with JDK 1.6 as your JVM to start HermesJMS please make sure that you add -Dsun.lang.ClassLoader.allowArraySyntax=true to the classpath in hermes.bat or hermes.sh. If you don't set this you shall come across below Error. Thanks to James Bayer for this information.

javax.jms.JMSException: Could not create InitialContext: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
    java.io.StreamCorruptedException: invalid type code: 31 

Steps to configure HermesJMS with Weblogic JMS

1. Launch the HermesJMS
    -- Windows: via <HERMES_HOME>\bin\hermes.bat or Start > Program Files > HermesJMS > Hermes
    -- Unix: via <HERMES_HOME>/bin/hermes.sh

2. Right click on Sessions to create a New session. jms > sessions > New > New session...
3.  On resulting prompt, goto the Providers tab [bottom] and right click to Add Group called "Weblogic" and right click on "Library" to Add JAR(s) and specify your path to <WEBLOGIC_HOME>\server\lib\weblogic.jar. Click "Don’t Scan" when prompted.
 
4. In the same windows, goto Sessions tab [bottom]. 
-- Enter a Session Name "TestSession"
-- In the Connection Factory > Loader section, select "Weblogic" from the drop-down (you may have to save and then edit the session to see the provider you just configured in the drop down for loader
-- In the Connection Factory > Class section, select "hermes.JNDIConnectionFactory". 
-- In the Plug In drop-down select "BEA Weblogic
-- In the Connection Factory add the properties as below. Click OK once done.
Property
Value
binding
javax/jms/QueueConnectionFactory
initialContextFactory
weblogic.jndi.WLInitialContextFactory
providerURL
t3://<managedServer>:<managedPort>
securityCredentials
<adminPassword>
securityPrincipal
<adminUsername>
5. Right click on newly created session TestSession to discover/find all of the available destinations. jms > sessions > TestSession > Discover. Once you click Discover you shall see a message "Getting message stores" at the bottom of the window and a Dialogue box stating Discovered # destinations. Click Yes.

 
6. Right click on one of the discovered Queue/Topic destination under jms > sessions > TestSession > [queueName/topicName] and select Browse to list the contents of the queue/topic on right hand pane as below.

 
Hermes can monitor multiple queues at once, auto-refresh, use selectors, delete messages, etc.. For more information check user guide at http://www.hermesjms.com.

You should be set now to monitor your queues/topics in your organization. 

14 comments:

Vijay Naik said...

Hi Sunil, Thanks a lot for the awesome solutions that you have been providing here. Howevere one question here. How do i use this for multiple domains that I have. Also for multiple envinrmonets like Dev, test and prod, do i need to have seprate instance of this installation?
Can I install this in one server and use it to monitor JMS in all the domains across all the envirnoments?

Sunil Nandargi said...

Yes it is possible. If the domains are of same Version of WLS then you just need to create different sessions only. If you have domains in diff version of WLS then create a copy of the HermesJMS.bat or HermesJMS.sh and make appropriate changes in it.

Anonymous said...

Hi Sunil,

Thanks for sharing this valuble information .---Vamshi

Anonymous said...

Hi Sunil,

Thanks for sharing this valuble information .---Vamshi

Anonymous said...

This was really helpful. Thanks a lot!

ypritzke said...

Hi Sunil,I am running weblogic 11g on windows 7. Set up a test as u suggested, weblogic server listening on port 8001. Getting the folowing exception: Connection refused, no initial router to the destination. Any ideas? Is that windows 7 security?

Unknown said...

Thank you Sunil.. YOur post helps me to setup Hermes with Weblogic and monitor the JMS messages.

Anonymous said...

Sunil,

Thank you for this helpful post.
You solved my problem. Thanks again.

Anonymous said...

Thanks a lot... works perfectly

Anonymous said...

Great post.. Worked perfectly.

Anonymous said...

Hi! I could have sworn I've been to this blog before but after checking through some of the post I realized it's new to me.
Nonetheless, I'm definitely delighted I found it and I'll be bookmarking and
checking back often!

My webpage ... musicos

Anonymous said...

Hi Sunil,
Thank you for the post. It was really helpful.

One question, after configuring, i am only able to monitor the queues. How will i be able to post messages into the queues? I dont see the option available in Hermes after i configured like mentioned by you.

Unknown said...

Hi,
I have performed all the steps as stated above when I say discover I still get the below error..
Trying to connect weblogic 10.3.6 with JDK 1.6
java.lang.NoClassDefFoundError: weblogic/security/subject/AbstractSubject
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at hermes.JNDIContextFactory.createContext(JNDIContextFactory.java:261)
at hermes.ext.weblogic.WebLogicJMSAdminFactory.createSession(WebLogicJMSAdminFactory.java:63)
at hermes.impl.HermesAdminAdapter.getAdmin(HermesAdminAdapter.java:64)
at hermes.impl.HermesAdminAdapter.discoverDestinationConfigs(HermesAdminAdapter.java:84)
at hermes.impl.DefaultHermesImpl.discoverDestinationConfigs(DefaultHermesImpl.java:1358)
at hermes.browser.tasks.DiscoverDestinationsTask.invoke(DiscoverDestinationsTask.java:76)
at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:175)
at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:170)
at java.lang.Thread.run(Thread.java:662)

Anonymous said...

Hi,

I Have performed all the steps above But facing issue after discovering the Queues, All the queue were identified as Unknown.
Queues were not identified either as topic or Queue.
Could you please help me out with this. please specify What need to be corrected to proceed further.