SSL in HermesJMS

777 views Asked by At

I am trying to connect to a messaging provider over secure connection using a trust store but am unable to do so.

I can connect unsecurely and post messages without an issue, but the moment i am connecting over secure protocol it is not working.

I received an error retrieving JNDI

javax.jms.JMSException: Could not create InitialContext: JNDI setup failed on RNAME=nsps://server1.domain.internal:9001
at hermes.JNDIContextFactory.createContext(JNDIContextFactory.java:282)
at hermes.ext.HermesAdminSupport.discoverDestinationConfigs(HermesAdminSupport.java:441)
at hermes.impl.HermesAdminAdapter.discoverDestinationConfigs(HermesAdminAdapter.java:82)
at hermes.impl.DefaultHermesImpl.discoverDestinationConfigs(DefaultHermesImpl.java:1126)
at hermes.browser.tasks.DiscoverDestinationsTask.invoke(DiscoverDestinationsTask.java:77)
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:745)

It works via Jmeter using the same trust store and password so that is all valid and correct.

It seems that when initiating Hermes through hermes.bat it is not detecting parameters I have added to the start up and therefore it isn't using the truststore

I have updated the script and the line that starts the program is:

"C:\Program Files (x86)\Java\jdk1.7.0_75\bin\javaw" -XX:NewSize=256m -Xmx1024m -Dhermes.home="%HERMES_HOME%" %HERMES_OPTS% -Dlog4j.configuration="file:%HERMES_HOME%\bin\log4j.props" -Dsun.java2d.noddraw=true -Dhermes="%HERMES_CONFIG%\hermes-config.xml" -Dhermes.libs="%HERMES_LIBS%"\ext hermes.browser.HermesBrowser -Djavax.net.ssl.trustStore="file:%HERMES_LIBS%\alexTruststore.jks" -Djavax.net.ssl.trustStorePassword=manage

I have tried all sorts of combinations with the javax.net.ssl.trustStore(Password) parameters but none of them have worked

Thanks!

1

There are 1 answers

0
Talijanac On

It's kind of easy to miss; you need to pass truststore parameters before main class declaration. Essentialy you have invoked HermesBrowser class with two arguments passed to its main method.

What you wanted is invoke javaw.exe with proper jks arguments.

For example this should work:

"C:\Program Files (x86)\Java\jdk1.7.0_75\bin\javaw" ^
   -Djavax.net.ssl.trustStore="file:%HERMES_LIBS%\alexTruststore.jks" ^
   -Djavax.net.ssl.trustStorePassword=manage ^
   -XX:NewSize=256m ^
   -Xmx1024m ^
   -Dhermes.home="%HERMES_HOME%" ^
   %HERMES_OPTS% ^
   -Dlog4j.configuration="file:%HERMES_HOME%\bin\log4j.props" ^
   -Dsun.java2d.noddraw=true ^
   -Dhermes="%HERMES_CONFIG%\hermes-config.xml" ^
   -Dhermes.libs="%HERMES_LIBS%"\ext ^
   hermes.browser.HermesBrowser