Hello,

I am new to apache-tomee and I'm getting an error when I try to get the
resource from Tomee. Maybe I am doing somthing wrong but I can't find what.
I've searched for a week and I didn't find anything similar. 

I want to make a simple JMS with a sender and a reciever. This is what i
have so far.

public class MsgSender extends HttpServlet {
        private static final long serialVersionUID = 1L;
          @Resource(lookup="myQueueConnectionFactory")
          private static QueueConnectionFactory cf;
          @Resource(lookup="myQueue")
          private static Queue q;  
          private static int n=3;
   
        protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
                
                try{
                          QueueConnection conn=cf.createQueueConnection();
                          QueueSession
session=conn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

                      MessageProducer producer=session.createProducer(q);  
                      TextMessage m=session.createTextMessage();
                      for(int i=0;i<n;i++){
                          m.setText(&quot;Hello &quot;+i);
                          producer.send(m);
                      }
                      producer.send(q,session.createMessage()); 
                      session.close();
                      System.out.println(&quot;Sender finished&quot;);
                    }
                    catch(Exception e){
                      //System.out.println(&quot;JMSException : 
&quot;+e.getMessage());
                      e.printStackTrace();
                    }
                    
                    response.setContentType(&quot;text/html&quot;);
                        
                        final java.io.Writer writer = response.getWriter();
                        writer.append(&quot;&lt;html>");
                        writer.append("<body>");
                        writer.append("
Sender Servlet
");
                        writer.append("</body>");
                        writer.append("</html>");
                  }
        }

The tomee.xml file is this:

 
          <Resource id="JMSAdapter" type="ActiveMQResourceAdapter">
                
BrokerXmlConfig=broker:(tcp://localhost:8080)?persistent=false 
                                ServerUrl=tcp://localhost:8080  
      </Resource>
                <Resource id="myQueueConnectionFactory"
type="javax.jms.ConnectionFactory">
                ResourceAdapter = JMSAdapter 
        </Resource>
        <Resource id="myTopicConnectionFactory"
type="javax.jms.ConnectionFactory">
                ResourceAdapter = JMSAdapter 
        </Resource>
        
        <Resource id="myQueue" type="javax.jms.Queue">
               
        </Resource>
        
        <Resource id="myTopic" type="javax.jms.Topic">
              
        </Resource>

I need to mention that I can't open tomee gui from http//localhost:8080/
even thow I've made all the setting at the  tomcat-users.xml. 
 



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/WARNING-Injection-data-not-found-in-JNDI-context-jndiName-tp4678527.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to