Problems configuring https connection
TJ Greenier <[email protected]>
| Newsgroups | gmane.comp.java.openjms.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I am having trouble configuring my https connection. I have successfully
used the default RMI configuration and have also got the http connection
working. So I assume that I have the open jms servlet installed correctly.
Basically I am getting this error message when I attempt to publish a
message:
javax.jms.JMSException: Failed to process request createPublisher: session
not found
at org.exolab.jms.server.mipc.IpcJmsSessionConnection.notify(
IpcJmsSessionConnection.java:122)
at org.exolab.jms.server.mipc.IpcJmsReceiver.notify(IpcJmsReceiver.java:100)
at org.exolab.jms.server.mipc.IpcServerChannel.run(IpcServerChannel.java
:161)
I am running Tomcat 5.5 using Java 1.5. Here are some of my configuration
settings:
Tomcat server.xml file:
<!-- Define a SSL HTTP/1.1 Connector on port 8443
-->
<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150"
minSpareThreads="25" maxSpareThreads="75" enableLookups="false"
disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
openjms.xml file (in its entirety):
<?xml version="1.0" ?>
- <!--
OpenJMS configuration:
. RMI connectors
. JDBM persistency
. embedded JNDI provider
. embedded RMI registry, running on port 1099
. preconfigured destinations
NOTES: this configuration shows all configuration elements relevant
when using an RMI connector.
-->
- <Configuration>
- <!-- Optional. This represents the default configuration
-->
<ServerConfiguration host="localhost" embeddedJNDI="true" />
- <!-- Required when using an RMI connector
-->
- <Connectors>
- <Connector scheme="rmi">
- <ConnectionFactories>
<QueueConnectionFactory name="JmsQueueConnectionFactory" />
<TopicConnectionFactory name="JmsTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
- <Connector scheme="http">
- <ConnectionFactories>
<QueueConnectionFactory name="HTTPQueueConnectionFactory" />
<TopicConnectionFactory name="HTTPTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
- <Connector scheme="tcp">
- <ConnectionFactories>
<QueueConnectionFactory name="TCPQueueConnectionFactory" />
<TopicConnectionFactory name="TCPTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
- <Connector scheme="https">
- <ConnectionFactories>
<QueueConnectionFactory name="HTTPSQueueConnectionFactory" />
<TopicConnectionFactory name="HTTPSTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
</Connectors>
- <!-- Define HTTP configuration properties
-->
<HttpConfiguration host="127.0.0.1 <http://127.0.0.1>" port="8080"
serverServlet="/openjms/OpenJMSServer" />
- <!-- Define HTTPS configuration properties
-->
<HttpsConfiguration host="localhost" port="8443"
serverServlet="/openjms/OpenJMSServer" />
- <!-- Required
-->
- <DatabaseConfiguration>
<JdbmDatabaseConfiguration name="openjms.db" />
</DatabaseConfiguration>
- <!-- Required
-->
<AdminConfiguration script="${openjms.home}\bin\startup.bat" />
- <!-- Optional. If not specified, no destinations will be created
-->
- <AdministeredDestinations>
- <AdministeredTopic name="topic1">
<Subscriber name="sub1" />
<Subscriber name="sub2" />
</AdministeredTopic>
<AdministeredQueue name="queue1" />
<AdministeredQueue name="queue2" />
<AdministeredQueue name="queue3" />
</AdministeredDestinations>
- <!-- Optional. If not specified, no users will be created
-->
- <Users>
<User name="admin" password="openjms" />
</Users>
</Configuration>
Here is how I am calling from my code:
Hashtable props = new Hashtable();
System.setProperty("javax.net.ssl.trustStore", "C:\\Documents and
Settings\\greeniet\\.keystore");
System.setProperty("javax.net.ssl.keyStore", "C:\\Documents and
Settings\\greeniet\\.keystore");
System.setProperty("javax.net.ssl.keyStoreType", "jks");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.http.SslHttpJndiInitialContextFactory");
props.put(Context.PROVIDER_URL, "https://localhost:8443/");
try {
Context context = new InitialContext(props);
factory = (TopicConnectionFactory) context.lookup
("HTTPSTopicConnectionFactory");
} catch (NamingException e) {
e.printStackTrace();
System.err.println("Connection Error Received, System Will Exit");
System.exit(0);
}
The above code execute successfully. I get my error when I try to publish a
message:
try{
TopicSession tmpSession = connection.createTopicSession(false,
Session.CLIENT_ACKNOWLEDGE);
connection.start();
Topic topic = tmpSession.createTopic(msg.getTopic());
TopicPublisher publisher = session.createPublisher(topic);
int delivery_mode = DeliveryMode.PERSISTENT;
// need to copy message else destination will change, and ack will fail.
ObjectMessage message = tmpSession.createObjectMessage(msg);
publisher.publish(message, delivery_mode, 1, 0);
tmpSession.close();
} catch (JMSException exception) {
success = false;
exception.printStackTrace();
System.err.println("Error Publishing Message.");
}
The red bold line is the one the error is thrown on.
Any suggestions or help is much appreciated. And thanks in advance.
All of the documentation on the site has been great and I have looked
through the mailing list archives, but I can't seem to solve this problem.
Thank you,
T.J. Greenier