• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

looking for MDB

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi I want to do a sample project with message driven beans , can anyone send me a step by step guide ? If I can do the sample project then I will be able to add some complexes also .
 
prasanna pati
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have this : http://www.eclipse.org/webtools/community/tutorials/ejbtutorial/buildingejbs.html
but its all for session beans or so......what I am looking for a step by step of message driven bean .
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can try this: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/MDB.html

Thanks,
Mahesh

-----------
SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - In Progress
 
prasanna pati
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a sample program of Java messaging service . One is sending a message , another is receiving a message . I want to know I should run it using only Jdk or I have to do it using EJB compilation all those stuff . here are those 2:

messageSender.java


/*
* MessageSender.java
*
* Created on April 18, 2007, 9:44 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

/**
*
* @author 278085
*/


import javax.jms.*;
import javax.naming.*;


public class MessageSender {

public static void main(String[] args) {
QueueConnection queueConnection = null;

try {
Context context = new InitialContext();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory) context.lookup("QueueConnectionFactory");
String queueName = "MyQueue";
Queue queue = (Queue) context.lookup(queueName);
queueConnection =
queueConnectionFactory.createQueueConnection();
QueueSession queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = queueSession.createSender(queue);
TextMessage message = queueSession.createTextMessage();
message.setText("This is a TextMessage");
queueSender.send(message);
System.out.println("Message sent.");
}
catch (NamingException e) {
System.out.println("Naming Exception");
}
catch (JMSException e) {
System.out.println("JMS Exception");
}
finally {
if (queueConnection != null) {
try {
queueConnection.close();
}
catch (JMSException e) {}
}
}
}
}


MessageReceiver.java


/*
* MessageReceiver.java
*
* Created on April 18, 2007, 12:00 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

/**
*
* @author 278085
*/

import javax.jms.*;
import javax.naming.*;
public class MessageReceiver {
public static void main(String[] args) {
QueueConnection queueConnection = null;
try {
Context context = new InitialContext();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory) context.lookup("QueueConnectionFactory");
String queueName = "MyQueue";
Queue queue = (Queue) context.lookup(queueName);
queueConnection =
queueConnectionFactory.createQueueConnection();
QueueSession queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueReceiver queueReceiver = queueSession.createReceiver(queue);
queueConnection.start();
Message message = queueReceiver.receive(1);
if (message != null) {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
System.out.println(textMessage.getText());
}
}
}
catch (NamingException e) {
System.out.println("Naming Exception");
}
catch (JMSException e) {
System.out.println("JMS Exception");
}
finally {
if (queueConnection != null) {
try {
queueConnection.close();
}
catch (JMSException e) {}
}
}
}
}


i am getting Naming exception
 
author and cow tipper
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a collection of multimedia tutorials that deal with developing EJBs. Take a look at the tutorial on creating an MDB, and the section on setting up a message queue/topic.

Creating an MDB and a Session Bean to put a message on a queue.


 
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic