I'm trying to make my jms client work over ssl, but after configuring of jboss i have an exception
log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Mar 21, 2013 4:20:26 PM cz.bleble.DummyJMS main INFO: Attempting to acquire connection factory "jms/RemoteConnectionFactory" Mar 21, 2013 4:20:27 PM cz.bleble.DummyJMS main INFO: Found connection factory "jms/RemoteConnectionFactory" in JNDI Mar 21, 2013 4:20:27 PM cz.bleble.DummyJMS main INFO: Attempting to acquire destination "jms/queue/Online" Mar 21, 2013 4:20:27 PM cz.bleble.DummyJMS main INFO: Found destination "jms/queue/Online" in JNDI Mar 21, 2013 4:20:27 PM cz.bleble.DummyJMS main SEVERE: Failed to create session factory 15:20:27,908 INFO [org.jboss.as.naming] (Remoting "esekilx5066" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 12d4350a (inbound) of Remoting connection 5c0673b4 to /192.168.4.25:63316 Exception in thread "main" javax.jms.JMSException: Failed to create session factory at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605) at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119) at cz.bleble.DummyJMS.main(DummyJMS.java:94) Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.] at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:775) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601) ... 2 more
this is my client:
package cz.bleble;
import java.util.logging.Logger;
import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
public final class DummyJMS {
private static final Logger LOG = Logger.getLogger(DummyJMS.class.getName());
private static final String DEFAULT_MESSAGE = "Hello, World!";
private static final String DEFAULT_CONNECTION_FACTORY = "jms/RemoteConnectionFactory";
private static final String DEFAULT_DESTINATION = "jms/queue/Online";
private static final String DEFAULT_MESSAGE_COUNT = "1";
private static final String DEFAULT_USERNAME = "user";
private static final String DEFAULT_PASSWORD = "pass";
private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";
private static final String PROVIDER_URL = "remote://192.168.4.25:4447";
public static void main(final String[] args) throws Exception {
ConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
MessageProducer producer = null;
MessageConsumer consumer = null;
Destination destination = null;
TextMessage message = null;
Context context = null;
try {
// Set up the context for the JNDI lookup
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
env.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "true");
env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL));
env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", DEFAULT_USERNAME));
env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", DEFAULT_PASSWORD));
env.put("jboss.naming.client.ejb.context", true);
context = new InitialContext(env);
// Perform the JNDI lookups
String connectionFactoryString = System.getProperty("connection.factory", DEFAULT_CONNECTION_FACTORY);
LOG.info("Attempting to acquire connection factory \"" + connectionFactoryString + "\"");
connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString);
LOG.info("Found connection factory \"" + connectionFactoryString + "\" in JNDI");
String destinationString = System.getProperty("destination", DEFAULT_DESTINATION);
LOG.info("Attempting to acquire destination \"" + destinationString + "\"");
destination = (Destination) context.lookup(destinationString);
LOG.info("Found destination \"" + destinationString + "\" in JNDI");
// Create the JMS connection, session, producer, and consumer
connection = connectionFactory.createConnection(System.getProperty("username", DEFAULT_USERNAME), System.getProperty("password", DEFAULT_PASSWORD));
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
producer = session.createProducer(destination);
consumer = session.createConsumer(destination);
connection.start();
int count = Integer.parseInt(System.getProperty("message.count", DEFAULT_MESSAGE_COUNT));
String content = System.getProperty("message.content", DEFAULT_MESSAGE);
LOG.info("Sending " + count + " messages with content: " + content);
// Send the specified number of messages
for (int i = 0; i < count; i++) {
message = session.createTextMessage(content);
producer.send(message);
}
// Then receive the same number of messages that were sent
for (int i = 0; i < count; i++) {
message = (TextMessage) consumer.receive(5000);
LOG.info("Received message with content " + message.getText());
}
} catch (Exception e) {
LOG.severe(e.getMessage());
throw e;
} finally {
// closing the connection takes care of the session, producer, and consumer
if (connection != null) {
connection.close();
}
if (context != null) {
context.close();
}
}
}
}
and this are peaces of my standalone.xml from jboss
<server xmlns="urn:jboss:domain:1.3">
<extensions>
...
<extension module="org.jboss.as.messaging"/>
...
</extensions>
...
<profile>
...
<subsystem xmlns="urn:jboss:domain:messaging:1.2">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<security-enabled>true</security-enabled>
<journal-type>NIO</journal-type>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
<netty-connector name="netty" socket-binding="messaging">
<param key="ssl-enabled" value="true"/>
<param key="key-store-path" value="/keystore"/>
<param key="key-store-password" value="changeme"/>
</netty-connector>
</connectors>
<acceptors>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
<netty-acceptor name="netty" socket-binding="messaging">
<param key="ssl-enabled" value="true"/>
<param key="key-store-path" value="/keystore"/>
<param key="key-store-password" value="changeme"/>
<param key="trust-store-path" value="/truststore"/>
<param key="trust-store-password" value="changeme"/>
</netty-acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="user"/>
<permission type="consume" roles="user"/>
<permission type="createDurableQueue" roles="user"/>
<permission type="deleteDurableQueue" roles="user"/>
<permission type="createNonDurableQueue" roles="user"/>
<permission type="deleteNonDurableQueue" roles="user"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
<entry name="java:/XAConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="Online">
<entry name="java:jboss/exported/jms/queue/Online"/>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>
...
</profile>
...
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/>
<socket-binding name="messaging-throughput" port="5455"/>
<socket-binding name="osgi-http" interface="management" port="8090"/>
<socket-binding name="remoting" port="4447"/>
...
</socket-binding-group>
</server>
Does someone know what I'm doing wrong? I cannot find any working example of jms coonfiguration and client for jboss as7 over ssl...