How to send message to MessageDrivenBean from Session bean in JDeveloper

HI I am trying to write a sample program using JDeveloper.
I am trying to do these steps
1) client class which gets Session bean and calls its method.
2) write Stateless Session bean with a method which gets MDB and sends message.
3) write Message Driven Bean ( which prints message recieved from Session bean )
Set up
=======
jms.xml
{JDevHome}\jdev\system9.0.5.2.1618\oc4j-config\jms.xml : changed jms.xml file and included
     <topic name="Demo Topic" location="jms/theTopic">
          <description>A dummy topic</description>
     </topic>
     <topic-connection-factory name="Demo Topic Connection Factory" location="jms/theTopicConnectionFactory">
          <description>A dummy topic connection factory</description>
     </topic-connection-factory>
orion-ejb-jar.xml:
edited MDB entry to
<message-driven-deployment name="MessageLogger"
destination-location="jms/theTopic" connection-factory-location="jms/theTopicConnectionFactory">
</message-driven-deployment>
Implementation
===============
In client class:
I am getting session bean like
Properties props = System.getProperties();
props.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY , "com.evermind.server.rmi.RMIInitialContextFactory");
props.put( javax.naming.Context.SECURITY_PRINCIPAL , "admin" );
props.put( javax.naming.Context.SECURITY_CREDENTIALS,"welcome");
props.put( javax.naming.Context.PROVIDER_URL ,"ormi://localhost:23891/current-workspace-app");
Context ctx = new InitialContext(props);
MySessionHome home = (MySessionHome)
          javax.rmi.PortableRemoteObject.narrow(obj, MySessionHome.class);
This part works fine, and I am calling method on session bean created out of home.
In Session bean:
I want to get TopicConnectionFactory and tried these two ways:
a)
getting the context by setting new environemnt values like
Properties props = System.getProperties();
props.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY , "com.evermind.server.jms.EvermindConnectionFactory");
props.put( javax.naming.Context.SECURITY_PRINCIPAL , "admin" );
props.put( javax.naming.Context.SECURITY_CREDENTIALS,"welcome");
props.put( javax.naming.Context.PROVIDER_URL ,"ormi://localhost:9227/current-workspace-app");
Context ctx = new InitialContext( props);
When I try this,it is complaining that it cannot instantiate EvermindConnectionFactory.
I am not sure which factory class we have to use here.i tried all the Factory class in that package.but didn't worked.
next I used,
b)
tried to use default context in session bean to get MDB factory
String TOPIC_NAME="jms/theTopic";
String TOPIC_CONNECTION_FACTORY="jms/theTopicConnectionFactory";
TopicConnectionFactory connectionFactory = (TopicConnectionFactory)new InitialContext().lookup("java:comp/env/" + TOPIC_CONNECTION_FACTORY);
this gives
04/06/13 23:46:09 javax.naming.NameNotFoundException: jms/theTopicConnectionFactory not found in MySession
04/06/13 23:46:09      at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
this may be because JMS server runs on different port than other EJBs and have different namespaces.
Can any body give info,how we can make use of Message Driven bean from a Session Bean or from a JSP page or from a simple class inside JDeveloper.
Thanks in advance.
gopal

Hi,
There are some hints in this forum for how to do this.
I put together and make it working.
This example creates an MD Bean and have a simple message and a client class send messages to that bean.
Steps
=====
1)
a)in {JDev Home}\jdev\system9.0.5.2.1618\oc4j-config\jms.xml
     <topic name="Demo Topic" location="jms/demoTopic">
          <description>A dummy topic</description>
     </topic>
     <topic-connection-factory name="Demo Topic Connection Factory" location="jms/theTopicConnectionFactory">
          <description>A dummy topic connection factory</description>
     </topic-connection-factory>
b) in current project in orion-ejb-jar.xml
go to orion-ejb-jar properties and add these values there to MDB node
destination-location=jms/demoTopic
connection-factory-location=jms/theTopicConnectionFactory
2) create a dummy session bean and a dummy client for that session bean
This sets default configuration for the client application we write
doing so we do not need to set properties to get Initial context.It makes use of
{JDev Home}\jdev\system9.0.5.2.1618\oc4j-config\.client\jndi.properties
We can directly get Contexxt ctx = new InitialContext();
3) Create MDB and put this sample code in method
onMessage()
TextMessage tm = (TextMessage) msg;
try {
String text = tm.getText();
System.err.println("Received new message : " + text);
catch(JMSException e) {
e.printStackTrace();
4) go to properties for the MDB and set Destination to Topic
5) write Client code
Context ctx =new InitialContext();
// 1: Lookup ConnectionFactory via JNDI
TopicConnectionFactory factory =     
(TopicConnectionFactory) ctx.lookup("jms/theTopicConnectionFactory");
// 2: Use ConnectionFactory to create JMS connection
TopicConnection connection = factory.createTopicConnection();
// 3: Use Connection to create session
TopicSession session = connection.createTopicSession( false, Session.AUTO_ACKNOWLEDGE);
// 4: Lookup Desintation (topic) via JNDI
Topic topic = (Topic) ctx.lookup("jms/demoTopic");
// 5: Create a Message Producer
TopicPublisher publisher = session.createPublisher(topic);
// 6: Create a text message, and publish it
TextMessage msg = session.createTextMessage();
msg.setText("This is a test message from My Test Client!!! .");
publisher.publish(msg);
6) Run the server and run the client

Similar Messages

  • How to send message to MDB from different clients.

    Hi,
    I want to know how to send message to a Message Driven Bean residing in EJB container from
    1. Web Component
    2. Application Client
    3. Another Entity Bean
    4. Non J2EE client.
    If you provide me any tutorial link on this it would be really helpful.
    Thanks for the time.

    Hi,
    refer to http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/MDB.html#74108
    Seetesh

  • How to call a EJB method from Session bean method

    Hi all,
    I'm new to J2EE programming. I have a simple doubt .
    I have already created a lookup method for EJB bean in Session bean .
    My question is how to call a method of an ENTITY bean (say insertRow) from SESSION bean method(Say invoke_insertRow) .
    Please provide me an example code .
    Thanks in advance.

    InitialContext ctx = new InitialContext();
         GeneralEditor editor = (GeneralEditor) ctx
                        .lookup("GeneralEditorBean/remote");
              GeneralService service = (GeneralService) ctx
                        .lookup("GeneralServiceBean/remote");
              LanMu lm = new LanMu();
              lm.setName("shdfkhsad");
              editor.add(lm);

  • How to send message/traffic accross VME bus from NI's VME MXI-2 card So I can monitor messages via vmetro card?

    Hi,
    How to send message/traffic accross VME bus backplane from NI's VME MXI-2 card?
    So that I can monitor messages via vmetro card/BusView?
    Thanks
    DBhagat

    Hi Dbhagat,
    The VME-MXI-2 card is a type of VME controller, which is used in conjunction with a PCI-MXI-2 card that will be in an external computer. This computer is then able to send and receive messages to other devices on the VME bus, as well as monitor the information on the bus.
    Hope this helps!
    john
    Applications Engineer

  • In solman 4.0 how to send message to SAP through service desk

    Dear all,
            I have configured service desk functionality, My requirement is from service desk how to send message to SAP.
    Regards,
    Pavan.

    Hi,
    Following the steps:
    &#131;Basic configuration - RFC Connections to SAP
    Check if the RFC Connectino SAPOSS is working properly
    Check if load distribution group is set to EWA
    The RFC Connections:
    - SAP-OSS (Send Message to SAP)
    - SAP-OSS-LIST-O01 (Update Message from SAP)
    will be created automatically by the system with a user which has been assigned
    previously.
    IMG Path: SAP Web Application Server | SAP Web Application Server | SAP Solution Manager| Basic Settings | SAP Solution Manager System | Connection to SAP | Assign user for forwarding Service Desk Message
    With transaction SM59 you can adjust the RFC connections.
    - For further information on SAP R/3 Front-end connections, see SAP Notes: 33135, 766505, 24177
    - To forward Service Desk notifications and Issues to SAP, you need to assign a user to the SAPNet R/3
    Front-end connection to SAP.
    Activities:
    - 1. From the SAP Solution Manager (transaction SOLUTION_MANAGER), choose (Edit-> Global Settings.
    - 2. Choose Display<->Change.
    - 3. For SAP Service Marketplace, specify http://service.sap.com as the URL.
    - 4. In the Connection to SAP tab, specify SAPOSS as the RFC destination. Note that the entry is casesensitive.
    - 5. For User forwading messages, enter a valid user and a password. This user will require all the authorizations for SAPNet R/3 Front-end for your customer number.
    - 6. Save your changes.
    The system automatically generates the following RFC destinations and assigns the S-User and password you specified: SAP-OSS, SAP-OSS-LIST-O01
    Good Lucky!

  • How to  send messages via shareobject in FMS

    How to send messages via shareobject in FMS
    I need some codes.
    I want to send some string messages via shareobject, the
    string messages can be retrieve in client.
    Can you give me some codes? Thank you for your help..
    /

    Thanks for your comment.
    en....I want to do something..I will maintenance a users list
    in charroom.
    I write a function in main.asc file , client can get users
    list via call the function.
    I write some codes in application.onConnect
    when a user connect, it will add users list.
    In application.onDisconnect, when a user disconnect, it will
    remove from users list.
    My hope when a user disconnect, I send a message to
    shareobject. the shareobject is called in other clients.
    Other client can retrieve the remove user message, they will
    call the function to get new users list.
    It is my idea. Can you give me some codes for my idea?
    Thank you very much.

  • How to send sms to mobile from tomcatserver using java code?

    Hi,
    Could you please let me know that,
    How to send sms to mobile from tomcatserver using java code? Please provide the code snippet.
    Thanks in advance.

    Yes, but something needs to send that message. You can't just take an arbitrary computer and send an SMS, it does not have the hardware to do that.
    So either you have a mobile through which you do that or more likely - you use some sort of online service to do it. Whatever choice you make will determine what code you will have to write to get it done. Nobody is going to deliver the code to you, that's your job. It is also your job to figure out what service you are going to use.

  • How to send Itune gift card from UK to Malaysia?

    How to send Itune gift card from UK to Malaysia? Would like to send it as a gift to my Malaysia friend, However, store officials said that itune card bought in UK are only for UK account. Is that true?

    They're correct. If desired, send the money with an international cheque instead of through iTunes.
    (126705)

  • How to send messages in iChat in plain text? (no html)

    How to send messages in iChat in plain text? I don't need any formatting nor hiding links in achor tags.

    HI,
    In the View Menu once you have a Chat window open is the Messages item which allows you to change the style of the IM.
    However this still sends a HTML like packet for dispalyiing the info at the other end.
    This does not work to ICQ users.
    Chax, an iChat Add-on, works in iChat 5 and lower (although there are then different versions) and can strip out the HTML part for sending to ICQ users.
    However there is not yet a Lion/iChat 6 version.
    8:43 PM      Monday; December 12, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to send message to a multi-consumer queue using pl/sql

    How to send message to a multi-consumer queue using pl/sql ? Thanks.
    I tried following, but got an message: no receipient specified.
    DBMS_AQ.ENQUEUE(
    queue_name => 'aqadm.multi_queue',
    enqueue_options => queue_options,
    message_properties => message_properties,
    payload => my_message,
    msgid => message_id);
    COMMIT;
    END;
    /

    Here's two way to enqueue/publish new message into multi-consumer queue.
    (1) Use explicitly declared recipient list
    - Specify "Recipients" by setting recipient_list to messge_properties, before ENQUEUE().
    DECLARE
    recipients DBMS_AQ.aq$_recipient_list_t;
    BEGIN
    recipients(1) := sys.aq$_agent('RECIPIENTNAME',NULL,NULL);
    message_properties.recipient_list := recipients ;
    (2)Or, declare subscriber list permanently. Then you need not to specify recipient list each time you call ENQUEUE().
    begin
    dbms_aqadm.add_subscriber(
    queue_name=>'YOURQUEUE',
    subscriber=> sys.aq$_agent('RECIPIENTNAME', null, null)
    end;
    You can add 1024 local subscriber include maximum 32 remote-queue-consumer to one queue.

  • Can anybody tell me how to send/receive  the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    Which jsms? Google finds several.
    Try the website where you downloaded it.

  • Can any body tell me, how to send/receive the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    The best place to ask your question is at the JSMS website, forum or mailing list since this is no error that directly comes from a class belonging to the core Java classes.

  • I don't know how to send message to my friends via message

    I downloaded mountain lion yesterday but I don't know how to send message to the imessage on ipad or iphone. The account of my friend's seems doesn't work and I have no access to sending message to that account.

    Welcome to Apple Communities
    Press the + button to select a contact. Then, write whatever you want in the white box and press Enter key. You can use it with contacts with iPhone, iPod touch, iPad or Mac with Mountain Lion

  • TS2755 Can't send messages via iMessage from iPad after iOS6 update.  What steps can I take to begin sending messages again?

    Can't send messages via iMessage from iPad after iOS6 update.  What steps can I take to begin sending messages again?

    HI,
    So you have updated past this point ?
    http://support.apple.com/kb/TS5419
    There also seems to be no issues listed here.
    http://www.apple.com/support/systemstatus/
    8:44 pm      Friday; April 25, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Cannot send messages to groups from OVI

    Hi, unless anyone has found a way, I cannot send messages to groups from OVI. So, nice one can define a group - but pretty useless....
    Solved!
    Go to Solution.

    Hi,
    You can send with the coming version of Nokia Ovi Suite 3.1
    You can get this now from http://betalabs.nokia.com/
    Br
    Mahayv

Maybe you are looking for

  • QR Code reader for 5230 ?

    Hi, Where can I find a QR code reader for my Nokia 5230 that I can install via OVI suite (so a .sis file I can download)? regards, Wim

  • E71: Can you fit more app. shortcuts on the home s...

    I love my E71's features (apart from the missing 3.5mm jack) and have got my widgets nicely installed, but am starting to get a little frustrated with some of the ignorant functionality decisions by Nokia. I'm not a heavy widget user, but 6 app short

  • Time Capsule Security Setup

    I've just had my time capsule for a couple of days now, and ignoring problems with the fan being on constantly which I am tackling seperately, I have a questions about security and how I wish to use the shared HD. I wish to have the drive set up so t

  • Contribute CS3 embeds the contents of SSI Includes into page after Edit and Publish

    I have tried every possible way to figure this out but it seems as though no one has this problem or a solution... My Dreamweaver CS3 Template based files that have SSI Includes placed in a "non-editable region" of a template and/or nested templates

  • Changing y-axis in chart stack plot

    I am using LABVIEW 5.0.1f1: I plot 8 values in a chart as stack plot by bundeling the values. During running programm I want to change the y-axis of the 5th value (changing maximum). But if a use attribute node of this char and select "active plot"=5