title: Configuring/injecting a JMS connection factory and a topic in WildFly
body: <p>I'd like to do some experiments with JMS on jBoss WildFly 8.2.</p>
  
  <p>The default WildFly <code>standalone-full.xml</code> configuration file has the following fragments:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;hornetq-server&gt;
  
      &lt;connectors&gt;
          ...
          &lt;in-vm-connector name="in-vm" server-id="0"/&gt;
      &lt;/connectors&gt;
  
          ...
  
      &lt;jms-connection-factories&gt;
          &lt;connection-factory name="InVmConnectionFactory"&gt;
              &lt;connectors&gt;
                  &lt;connector-ref connector-name="in-vm"/&gt;
              &lt;/connectors&gt;
              &lt;entries&gt;
                  &lt;entry name="java:/ConnectionFactory"/&gt;
              &lt;/entries&gt;
          &lt;/connection-factory&gt;
          ...
      &lt;/jms-connection-factories&gt;
  
      &lt;jms-destinations&gt;
           &lt;!-- this destination I have added myself as I need a "topic", but 
                  the default configuration has only two preconfigured "queues". --&gt;
          &lt;jms-topic name="MyTestTopic"&gt;
              &lt;entry name="java:/jms/topic/MyTestTopic"/&gt;
          &lt;/jms-topic&gt;
      &lt;/jms-destinations&gt;
  
  &lt;/hornetq-server&gt;
  </code></pre>
  
  <p>I am trying to inject this connection factory and this topic into an EJB in the following way:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Stateless
  public class JmsPublisher {
  
      @Resource(mappedName = "java:/ConnectionFactory")
      ConnectionFactory jmsConnectionFactory;
  
      @Resource(mappedName = "java:/jms/topic/MyTestTopic")
      Topic topic;
  </code></pre>
  
  <p>But I get the following error message at deployment:</p>
  
  <pre><code>Operation ("deploy") failed ... Services with missing/unavailable dependencies" =&gt; ...
  
  ...JmsPublisher\".jmsConnectionFactory is missing [jboss.naming.context.java.ConnectionFactory]"
  ...JmsPublisher\".topic is missing [jboss.naming.context.java.jms.topic.MyTestTopic]"
  </code></pre>
  
  <p>What am I doing wrong?</p>