Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

middleware infrastructure destination configuration

Posted on 2013-05-19
5
Medium Priority
?
407 Views
Last Modified: 2013-06-05
Hi,

I started jboss server from eclipse. I went to destination-service.xml under folder C:\softwares\jboss-5.0.0.CR2\jboss-5.0.0.CR2\server\default\deploy\messaging

I copy pasted last entry and changed the name as below


   <mbean code="org.jboss.jms.server.destination.QueueService"
      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
      xmbean-dd="xmdesc/Queue-xmbean.xml">
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
      <depends>jboss.messaging:service=PostOffice</depends>
   </mbean>  

 <mbean code="org.jboss.jms.server.destination.QueueService"
      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue2"
      xmbean-dd="xmdesc/Queue-xmbean.xml">
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
      <depends>jboss.messaging:service=PostOffice</depends>
   </mbean>




I refreshed the destination page under jmx-console to see the new destination.


My question is configuring the destination is developer job or is it is job of administrator.

What info conncetion-factories.cml file consist of?

I randomly selected one entry
java:/ConnectionFactory
to create the web client and Message Driven Bean MDB.

My web client servlet code is as below



package com.gp;

import java.io.IOException;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.Context;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



/**
 * Servlet implementation class ClientServlet
 */
public class ClientServlet extends HttpServlet {
&#9;private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ClientServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

&#9;/**
&#9; * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
&#9; */
&#9;protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
&#9;&#9;// TODO Auto-generated method stub
&#9;&#9;
&#9;&#9;try {
&#9;&#9;&#9;Context context=new InitialContext();
&#9;&#9;&#9;
&#9;&#9;&#9;QueueConnectionFactory cf=(QueueConnectionFactory) context.lookup("java:/ConnectionFactory");
&#9;&#9;    Queue queue=(Queue) context.lookup("/queue/ExpiryQueue2");
&#9;&#9;    Connection conn=cf.createConnection();
&#9;&#9;    Session session=conn.createSession(false, 0);
&#9;&#9;    
&#9;&#9;    MessageProducer qs=session.createProducer(queue);
&#9;&#9;    
&#9;&#9;    TextMessage msg=session.createTextMessage("gpp");
&#9;&#9;    qs.send(msg);
&#9;&#9;    
&#9;&#9;} catch (NamingException e) {
&#9;&#9;&#9;// TODO Auto-generated catch block
&#9;&#9;&#9;e.printStackTrace();
&#9;&#9;} catch (JMSException e) {
&#9;&#9;&#9;// TODO Auto-generated catch block
&#9;&#9;&#9;e.printStackTrace();
&#9;&#9;}
&#9;}


}



my MDB MessageConsumer looks like below where i have overriden method onMessage
package com.gpp;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;

/**
 * Message-Driven Bean implementation class for: MsgConsumer
 *
 */
@MessageDriven(
&#9;&#9;activationConfig = { @ActivationConfigProperty(
&#9;&#9;&#9;&#9;propertyName = "destinationType", propertyValue = "javax.jms.Queue"
&#9;&#9;) }, 
&#9;&#9;mappedName = "/queue/ExpiryQueue2")
public class MsgConsumer implements MessageListener {

    /**
     * Default constructor. 
     */
    public MsgConsumer() {
        // TODO Auto-generated constructor stub
    }
&#9;
&#9;/**
     * @see MessageListener#onMessage(Message)
     */
    public void onMessage(Message message) {
        // TODO Auto-generated method stub
    &#9;System.out.println("msg came");
        
    }

}

Open in new window




I deployed and run on server both web application(named JMSClientWeb) and MDB project(named JMSClientEJB)


I do not see my message in output console. How do i run and make sure my message comes to the consumer.

Please advise. Any ideas, resources, sample code highly appreciated. thanks in advance
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
JMSClient5.jpg
JMSClient6.jpg
JMSClient7.jpg
JMSClient8.jpg
JMSClient9.jpg
JMSClient10.jpg
JMSClient11.jpg
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 39180926
Have a look here: http://blog.coffeebeans.at/?p=182 for a tutorial.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39189725
Under C:\softwares\jboss-5.0.0.CR2\jboss-5.0.0.CR2\server\default\deploy\jbossmq-destinations-services.xml

I added last mbean element as below for topic at the end of the file




view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
    <mbean code="org.jboss.jms.server.destination.TopicService"    
      name="jboss.messaging.destination:service=Topic,name=GpTopicc"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    



For configuring queue i added below mbean as last but one element

view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
 <mbean code="org.jboss.jms.server.destination.QueueService"    
      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue2"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    
   </mbean>    







view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<?xml version="1.0" encoding="UTF-8"?>    
   
<!--    
     Messaging Destinations deployment descriptor.    
   
     $Id: destinations-service.xml 72251 2008-04-16 00:38:50Z clebert.suconic@jboss.com $    
 -->    
   
<server>    
   
   <!--    
      The Default Dead Letter Queue. This destination is a dependency of an EJB MDB container.    
   -->    
   
   <mbean code="org.jboss.jms.server.destination.QueueService"    
      name="jboss.messaging.destination:service=Queue,name=DLQ"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    
   </mbean>    
       
   <!--    
      The Default Expiry Queue.    
   -->    
   
   <mbean code="org.jboss.jms.server.destination.QueueService"    
      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    
   </mbean>      
   
 <mbean code="org.jboss.jms.server.destination.QueueService"    
      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue2"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    
   </mbean>    
    <mbean code="org.jboss.jms.server.destination.TopicService"    
      name="jboss.messaging.destination:service=Topic,name=GpTopicc"    
      xmbean-dd="xmdesc/Queue-xmbean.xml">    
      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>          
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>    
      <depends>jboss.messaging:service=PostOffice</depends>    
   </mbean>    
</server>    





I was looking this link

http://grwebservice.blogspot.in/2009/06/message-driven-bean.html 

do I need to configure prop file as below.

EJBJNDI.prop
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.namingrg.jnp.interfaces
java.naming.provider.url=localhost:1099

I am not configuring property file as above. Is that is issue. Can you please advise.
0
 
LVL 35

Accepted Solution

by:
girionis earned 2000 total points
ID: 39198014
I am not configuring property file as above. Is that is issue. Can you please advise.

Yes you need. Otherwise you won't be able to obtain the instances you need via JNDI. But this might be a different problem. Do you get anything in the logs?
0
 
LVL 7

Author Comment

by:gudii9
ID: 39199859
what is the importance of JNDI int his context of MoM and Queue and Topic. what are administered objects. what is admin tool used to configure them to read through JNDI. Where the Application server comes into picture. Please advise
0
 
LVL 35

Expert Comment

by:girionis
ID: 39221399
Well, if you don't use JNDI how can you locate the queues and the topics? You deploy them in the server and then you have a name that points to them (this is the JNDI name). So you use this name to obtain access to your JMS components.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question