History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: HJMS-126
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Colin Crist
Reporter: David Cole
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
HermesJMS

HornetQ Plugin

Created: 05/May/10 02:15 PM   Updated: 12/Jul/10 01:38 PM
Component/s: Plugins
Affects Version/s: 1.14
Fix Version/s: 1.14

File Attachments: None
Image Attachments:

1. HornetQPlugin_Properties.jpg
(184 kb)


 Description  « Hide
The HornetQ plug-in will accept either of 2 parameters: MBeanServerConnectionJndi or the jmxUrl. To use the Hermes plugin, it is necessary to add the Hermes/lib jars to the CLassPathGroup. Either one will do the job. It is possible to set both properties. If the jmxUrl is used, it will take precedence. I found this option convenient, as it does not require me to add additional application server specific jars to the ClassPathGroup.

 All   Comments   Change History      Sort Order:
David Cole [05/May/10 02:24 PM]
Well...I wanted to attach the source in a zip format, but there doesn't seem to be a way to attach code to the issue. Let me know what I need to do to get code uplaoded to you.

David Cole [05/May/10 05:45 PM]
Ok..I will just add a post to the 'New Featurs' section of the Hermes Forum with the information and new/modified files.


Colin Crist [06/May/10 10:28 AM]
Thanks for this, I am looking at it today and will get you a build to test - you've done all the work so many thanks.

Colin Crist [06/May/10 12:06 PM]
David - question:

Can you explain the "topic truncate" logic?

@Override
public int truncate(DestinationConfig dConfig) throws JMSException {
try {
String destination = getRealDestinationName(dConfig);

if (dConfig.getDomain() == Domain.QUEUE.getId()) {
JMSQueueControl queueControl = getQueueControl(destination);
return queueControl.removeMessages(null);
}
else {
TopicControl topicControl = getTopicControl(destination);
return topicControl.removeMessages(null);
}
}
catch (HermesException ex) {
throw ex;
}
catch (Exception e) {
log.error(e.getMessage(), e);
close();
throw new HermesException(e);
}
}

I don't think this works for truncating specific durable subscription "queues" - can we do this with HornetQ? Does this topic control code ignores the specific durable subscription? I am not clear what it is doing?

David Cole [07/May/10 12:25 PM]
You are right Colin.
I don't see any way to truncate specific durable subscriptions...and would we want to anyway...I doubt it.
I agree that it would be better to remove that section of code.

Here is a modifed version of that method, that simply throws an exception if you attempt to truncate a topic, which is common to other plugins like JBossMQ:

<code>
@Override
public int truncate(DestinationConfig dConfig) throws JMSException {
try {
String destination = getRealDestinationName(dConfig);

if (dConfig.getDomain() == Domain.QUEUE.getId()) {
JMSQueueControl queueControl = getQueueControl(destination);
return queueControl.removeMessages(null);
}
else
{
throw new HermesException("JBoss does not support truncating a durable subscription");
}
}
catch (HermesException ex) {
throw ex;
}
catch (Exception e) {
log.error(e.getMessage(), e);
close();
throw new HermesException(e);
}
}

</code>

Colin Crist [10/May/10 10:20 AM]

David - I am testing the plugin but when I try and connect to a standalone HornetQ server I am getting:

java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: jmxconnector
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at hermes.ext.hornetq.HornetQAdmin.getMBeanServerConnection(HornetQAdmin.java:99)
at hermes.ext.hornetq.HornetQAdmin.getQueueControl(HornetQAdmin.java:137)
at hermes.ext.hornetq.HornetQAdmin.truncate(HornetQAdmin.java:262)
at hermes.impl.HermesAdminAdapter.truncate(HermesAdminAdapter.java:129)
at hermes.impl.DefaultHermesImpl.truncate(DefaultHermesImpl.java:1363)
at hermes.browser.tasks.TruncateQueueTask.doTruncate(TruncateQueueTask.java:144)
at hermes.browser.tasks.TruncateQueueTask.invoke(TruncateQueueTask.java:85)
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:637)
Caused by: javax.naming.NameNotFoundException: jmxconnector
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
... 11 more

I modified run.sh to add the jmx properties to the VM:

java $JVM_ARGS -classpath $CLASSPATH -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1190 org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME

jconsole works fine.

Am I missing something obviously wrong with the JMX URL?

Thanks...

David Cole [21/May/10 11:06 AM]
Hi Colin,

Sorry to take so long to get back to you...it's been a crazy week at work.

Anyway, up to this point, I had only run HornetQ within JBoss, so I set up HornetQ to run as a standalone server with the same arguments you are using. Basically, you didn't provide the full jmxURL, but from looking at the error, the main reason your are not able to locate the connector is the connecor is bound under the name 'jmxrmi' instead of 'jmxconnector' when running HornetQ as a standalone server. I will attach a screen shot of all of the properties I have set for both the plugin and connection factory, but here is the summary:

Plugin:

Property Value
jmxURL service:jmx:rmi:///jndi/rmi://localhost:1190/jmxrmi

Note that it is bound to jmxrmi instead of jmxconnector.

ConnectionFactory
Class: hermes.JNDIConnectionFactory

Property Value
binding /ConnectionFactory
initialContextfactory org.jnp.interfaces.NamingContextFactory
providerURL jnp://localhost:1199
urlPkgPrefixes org.jboss.naming:org.jnp.interfaces

Give that a try and let me know if it's working for you.
Thanks,

Dave

David Cole [21/May/10 11:56 AM]
HornetQ Standalone server configuration.

Colin Crist [25/May/10 06:30 AM]

Thanks for this - doh, I should have tried jmxrmi as its a common binding.

Anyway, progress but I am getting this:

ava.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
at javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2327)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:279)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
at hermes.ext.hornetq.HornetQAdmin.getMBeanServerConnection(HornetQAdmin.java:99)
at hermes.ext.hornetq.HornetQAdmin.getQueueControl(HornetQAdmin.java:137)
at hermes.ext.hornetq.HornetQAdmin.truncate(HornetQAdmin.java:262)
at hermes.impl.HermesAdminAdapter.truncate(HermesAdminAdapter.java:129)
at hermes.impl.DefaultHermesImpl.truncate(DefaultHermesImpl.java:1363)
at hermes.browser.tasks.TruncateQueueTask.doTruncate(TruncateQueueTask.java:144)
at hermes.browser.tasks.TruncateQueueTask.invoke(TruncateQueueTask.java:85)
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:637)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1682)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.DataOutputStream.flush(DataOutputStream.java:106)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:211)
... 16 more


Again, here is how the server VM is started:

java $JVM_ARGS -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1190 -classpath $CLASSPATH org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME


Why the SSL error?

Colin.

David Cole [25/May/10 10:21 AM]
Hey Colin,

I ran into that same issue when trying to connect to the standalone HornetQ server.
I added the following JVM_ARG to turn off SSL. By default, SSL communication is turned on....which is backwards if you ask me:

-Dcom.sun.management.jmxremote.ssl=false

Give that a try and let me know how it works out.
P.S. Good to see you are human like the rest of us ;-)