I'm having troubles with migration from old JBoss to Wildfly 14 (or some other latest version).
Currently I'm stuck with JMS configuration.
Here is the configuration:
- In
<subsystem xmlns="urn:jboss:domain:messaging-activemq:4.0">
I have added two queue definitions with the following code<jms-queue name="MyQueue" entries="java:/jms/queue/MyQueue"/> <jms-queue name="OtherQueue" entries="java:/jms/queue/OtherQueue"/>
- In mentioned above subsystem definition I've added the following connection factory definition
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm" />
- In my application initialization code I have code which instantiates these jms queues.
In my class I have the following fields
private static final String JMS_CONNECTION_FACTORY_JNDI_NAME = "java:/ConnectionFactory";
@Resource(mappedName=JMS_CONNECTION_FACTORY_JNDI_NAME)
ConnectionFactory factory;
and in this class I have the following method:
public void openJmsSession() {
try {
connection = factory.createConnection();
Context jndiContext = getInitialContext();
queue =(Queue) jndiContext.lookup(JMS_MAIL_QUEUE_NAME);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
} catch (NamingException e) {
logger.error("Naming exception during opening JMS session", e);
} catch (JMSException e) {
logger.error("JMS exception during opening JMS session", e);
}
}
Line connection = factory.createConnection();
throws NPE because factory is null.