Using java read message payloads

Dear experts,
I am looking to read using BAPI/RFC from java based on given date as input  , all messageid with respective payload texts.
Anybody had a probe on this earlier ?.I have setup JCO (sapjco3.jar),i  am also able to execute rfc on my XI box.
Now issue is to find the rfc or bapi which could do the required job
Pl help.

I worked on  SXMB_GET_MESSAGE_LIST,SXMB_GET_MESSAGE_DATA.All work well ,but they get me messageids.
With this i need to get payload.I need another RFC which will do the job.

Similar Messages

  • Difference in using java,xslt,message mapping

    hi friends,
              Can i know what difference does it make in using JAVA Mapping ,XSLT and Message Mapping?
              Where and when it is used?
              Which one is advantageous?
    thanks and regards,
    Prashanth

    Hi Prashant,
    Please go through the following links:
    Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/b78d406b305537e10000000a1550b0/frameset.htm
    For Java Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    For XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Error handling in XSLT Mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm
    You can also refer some How to guides:
    XI New Mapping Features article,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi 3.0 new mapping features article.evn
    Generic XSLT Mapping and Sample Code,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi code samples/generic xslt mapping and sample code.pdf
    How to use ABAP-MApping in XI3.0,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
    I hope it helps,
    Thanks & Regards,
    Varun Joshi

  • Run An OS Command Using Java?

    I want to write a java class that does some Unix system maintenance. In particular, I want to read some data out of a database and then do some calculations to figure out which files in particular can be tarred and zipped. The database part is already handled (in other words, I can identify the files I want to take action on) but I'm not sure how to run an operating system command (e.g. "tar cvzf myfile file1 file2 file3") using java.

    Read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    %

  • How to read Java Object message from JMS Queue using JMS Adapter .

    Dear All,
    In my scenario i have to read a java object message from JMS Queue . I tried by using the JMS Adaper ,but i am not getting any Payload . Can any one tell me is there any special settings for JMS Adapter to read the Java Object message .
    I am able to read the Message successfully thru JMS Adapter but in SXMB_MONI it is not showing any payload .
    I also went in Message monitoring but i am getting this type of message in Sender JMS Adapter  in Audit Log.
    JMS Message ID XXXXX Message Type Null unknown.Payload can not be read and will be empty.
    JMS Message ID XXXXX Payload Empty can not read.
    Please Help.
    Lateef

    Hi,
    As far as i know, JMS Object Messages is not supported by XI JMS adapter.
    you need to have the JMS provider to transform the message to bytes messages.
    (Refer to SAP note 856346)

  • How to dequeue Oracle queue(enqueue in Ora) in java using JMS text message

    I'm trying below java code but its giving me error:
    public class testq {
    public static void main(String[] args) throws Exception {
    testq q = new testq();
    AQSession aq_sess = createSession();
    q.runTest(aq_sess);
    public static AQSession createSession() {
    Connection db_conn;
    AQSession aq_sess = null;
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    /* Load the Oracle8i AQ driver: */
    Class.forName("oracle.AQ.AQOracleDriver");
    db_conn = DriverManager.getConnection("jdbc:oracle:thin:@10.10.10.10:1521:demo", "demo_app", "demo");
    System.out.println("JDBC Connection opened ");
    db_conn.setAutoCommit(false);
    /* Creating an AQ Session: */
    aq_sess = AQDriverManager.createAQSession(db_conn);
    System.out.println("Successfully created AQSession ");
    catch (Exception ex) {
    System.out.println("Exception: " + ex);
    ex.printStackTrace();
    return aq_sess;
    public void runTest(AQSession aq_sess) {
    //AQQueueTable q_table;
    AQQueue queue;
    AQMessage message;
    AQRawPayload raw_payload;
    AQDequeueOption deq_option;
    byte[] b_array;
    Connection db_conn;
    try {
    db_conn = ((AQOracleSession)aq_sess).getDBConnection();
    /* Get a handle to a queue - aq_queue4 in aquser schema: */
    queue = aq_sess.getQueue ("myadmin", "STREAM_QUEUE_DEMO");
    System.out.println("Successful getQueue");
    /* Creating a AQDequeueOption object with default options: */
    deq_option = new AQDequeueOption();
    deq_option.setDequeueMode(AQDequeueOption.DEQUEUE_REMOVE);
    /* Set wait time to 10 seconds: */
    deq_option.setWaitTime(10);
    /* Dequeue a message: */
    message = queue.dequeue(deq_option);
    System.out.println("Successful dequeue");
    /* Retrieve raw data from the message: */
    raw_payload = message.getRawPayload();
    b_array = raw_payload.getBytes();
    db_conn.commit();
    String value = new String(b_array);
    System.out.println("queue="+value);
    } catch(Exception e) {
    e.printStackTrace();
    The error says "oracle.AQ.AQException: JMS-174: Class must be specified for queues with object payloads
    Use dequeue(deq_option, payload_fact) or dequeue(deq_option, sql_data_cl)"
    Can any one tell me how to fix this error & how to get bulk dequeue messages?
    And i am using sys.AQ$_JMS_TEXT_MESSAGE payload type during enqueue.
    Can any one tell me how to fix this Java program to dequeue it?
    Thanks in advance...Please its urgent
    Thanks!

    the code is as bellow
    File fBlob = new File ("test.pdf");
    FileInputStream fIS = new FileInputStream(fBlob);
    pstUpdate= con.prepareStatement("UPDATE table set file = ? where id = ?");
    pstUpdate.setBinaryStream(1, fIS, (int) fBlob.length());
    pstUpdate.setString(2, rs.getString("id"));
    pstUpdate.execute();
    con.commit();

  • Enqueuing JMS_TEXT_MESSAGE with Java creates strange message payload

    Hello everybody,
    I'm trying to enqueue a JMS_TEXT_MESSAGE. There is no problem doing this with PL/SQL, but with Java the payload of the enqueued message seems to contain garbage. I tried a lot but actually I have no idea why this happens.
    Here are the different user_data values of the enqueued messages:
    Java: (((; ; 0); ; ; ; ; ; ((; 100; ; ; 27); (; 200; ; 1257325532555; 24); ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; )); 14; ; )
    PL/SQL: ((; ; ; ; ; 0; ); 14; This is a test; )
    As you can see there are a lot of differences. The length of the string (14) is correct with Java, too, but where do the other values come from ? And what happened to the message text ?
    Environment:
    - Oracle Database 10g Enterprise Edition 10.2.0.3.0
    - JDK 1.5.0_06
    - Used libraries
    -- $ORACLE_HOME/rdbms/jlib/jmscommon.jar
    -- $ORACLE_HOME/rdbms/jlib/aqapi13.jar
    -- $ORACLE_HOME/jdbc/lib/ojdb14.jar
    -- $ORACLE_HOME/jlib/jta.jar
    This is how created the user:
    CREATE USER strm_admin IDENTIFIED BY strm_admin;
    GRANT connect, resource, aq_administrator_role TO strm_admin;
    GRANT execute on dbms_aq TO strm_admin;
    Here is the test class that creates the strange payload:
    package test;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.QueueConnection;
    import javax.jms.QueueConnectionFactory;
    import javax.jms.TextMessage;
    import oracle.AQ.AQQueueTable;
    import oracle.AQ.AQQueueTableProperty;
    import oracle.jms.AQjmsDestination;
    import oracle.jms.AQjmsDestinationProperty;
    import oracle.jms.AQjmsFactory;
    import oracle.jms.AQjmsSession;
    public class AQTest
    public static void main(String[] args) throws Exception
    String url = "jdbc:oracle:thin:@server:port:sid";
    QueueConnectionFactory qcf = AQjmsFactory.getQueueConnectionFactory(url, null);
    QueueConnection connection = qcf.createQueueConnection("strm_admin", "strm_admin");
    AQjmsSession session = (AQjmsSession)connection.createQueueSession(true, 0);
    // create queuetable
    AQQueueTableProperty tableProperty = new AQQueueTableProperty("SYS.AQ$_JMS_TEXT_MESSAGE");
    session.createQueueTable("strm_admin", "testqueuetablejms", tableProperty);
    // create queue
    AQQueueTable queueTable = session.getQueueTable("strm_admin", "testqueuetablejms");
    Queue queue = session.createQueue(queueTable, "testqueuejms", new AQjmsDestinationProperty());
    ((AQjmsDestination)queue).start(session, true, true);
    // enqueue message
    TextMessage message = session.createTextMessage();
    message.setText("This is a test");
    MessageProducer producer = session.createProducer(queue);
    producer.send(message);
    producer.close();
    // close
    session.commit();
    session.close();
    connection.close();
    With this PL/SQL the message payload is correct:
    DECLARE
    v_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
    v_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
    v_message SYS.AQ$_JMS_TEXT_MESSAGE;
    v_message_id RAW(16);
    BEGIN
    v_message := SYS.AQ$_JMS_TEXT_MESSAGE.CONSTRUCT;
    v_message.set_text('This is a test');
    DBMS_AQ.ENQUEUE (
    queue_name => 'strm_admin.testqueuejms'
    ,enqueue_options => v_enqueue_options
    ,message_properties => v_message_properties
    ,payload => v_message
    ,msgid => v_message_id
    COMMIT;
    END;
    Can anyone help me, please ? Has anyone experienced the same problem ? Or can anyone reproduce it ?
    Any help is appreciated.
    Roland

    Finally I got it fixed !
    The library "orai18n.jar" hat to be included in class path. Very strange, that there was no exception or any hint to what was missing.

  • How to delete message from the fodler of  AOL account using Java mail

    Hello All,
    I am using Java MAil API in my application, i want to delete message from AOL account's folder,
    when i set the folder as "Recently Deleted" or "Trash" , i get an exception as "folder does not exist".
    when i tested , some times mail is moving into Recently Deleted folder, but not every time.
    this is happening in both the interface as AOl Interface or my application.
    when i use folder.close(true) after setting the flag of message as DELETED. it completely remove the message from the acount.
    but i want to let the message be remained in the Recently Deleted folder. what should i do.
    i dont want to remove the message completely from the account.I am using IMAP also.

    You'll need to figure out what the real name of the "Recently Deleted" folder is on the AOL IMAP server
    (assuming it's a real folder and not some sort of "virtual" folder), then copy the message into that folder.
    See the folderlist.java demo program as a way to explore the names of all the folders on the server.

  • I have Mac OSX 10.5.8 and get java "error" message when trying to use research tool on Morningstar Java referred me to Apple but they had no update.Any ideas? thanks.e

    I have a imac OSX 10.5.8 and get a java "error" message when trying to use a research tool on Morningstar.Java referred me to Apple but they had no updates. Any ideas? thanks.

    Well I solved my problem.
    What still doesn't make sense though is that dragging iTune audio files directly on to the iTunes application icon gave me the error message... which is why I originally discounted it as being a potential link problem. If I had been able to get files to open normally (i.e. without an error message) I would have known it was a simple link problem. Strange.
    Anyway... relinking my folder of audio files did the trick.
    If you don't already know how here are the steps...
    iTunes > Preferences > Advanced > click on the "Change" button and browse to the folder that contains all of your iTunes audio files... that's it.

  • Problem in sending messages using java mail api

    Hi All,
    I have a problem in sending messages via java mail api.
    MimeMessage message = new MimeMessage(session);
    String bodyContent = "ñSunJava";
    message.setText (bodyContent,"utf-8");using the above code its not possible for me to send the attachment. if i am using the below code means special characters like ñ gets removed or changed into some other characters.
    MimeBodyPart messagePart = new MimeBodyPart();
                messagePart.setText(bodyText);
                // Set the email attachment file
                MimeBodyPart attachmentPart = new MimeBodyPart();
                FileDataSource fileDataSource = new FileDataSource("C:/sunjava.txt") {
                    public String getContentType() {
                        return "application/octet-stream";
                attachmentPart.setDataHandler(new DataHandler(fileDataSource));
                attachmentPart.setFileName(filename);
                Multipart multipart = new MimeMultipart();
                multipart.addBodyPart(messagePart);
                multipart.addBodyPart(attachmentPart);
                message.setContent(multipart);
                Transport.send(message);is there any way to send the file attachment with the body message without using MultiPart java class.

    Taken pretty much straight out of the Javamail examples the following works for me (mail read using Thunderbird)        // Define message
            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress(from));
            // Set the 'to' address
            for (int i = 0; i < to.length; i++)
                message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    // Set the 'cc' address
    for (int i = 0; i < cc.length; i++)
    message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc[i]));
    // Set the 'bcc' address
    for (int i = 0; i < bcc.length; i++)
    message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc[i]));
    message.setSubject("JavaMail With Attachment");
    // Create the message part
    BodyPart messageBodyPart = new MimeBodyPart();
    // Fill the message
    messageBodyPart.setText("Here's the file ñSunJava");
    // Create a Multipart
    Multipart multipart = new MimeMultipart();
    // Add part one
    multipart.addBodyPart(messageBodyPart);
    // Part two is attachment
    for (int count = 0; count < 5; count++)
    String filename = "hello" + count + ".txt";
    String fileContent = " ñSunJava - Now is the time for all good men to come to the aid of the party " + count + " \n";
    // Create another body part
    BodyPart attachementBodyPart = new MimeBodyPart();
    // Get the attachment
    DataSource source = new StringDataSource(fileContent, filename);
    // Set the data handler to this attachment
    attachementBodyPart.setDataHandler(new DataHandler(source));
    // Set the filename
    attachementBodyPart.setFileName(filename);
    // Add this part
    multipart.addBodyPart(attachementBodyPart);
    // Put parts in message
    message.setContent(multipart);
    // Send the message
    Transport.send(message);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to extract payload data from SOA database schema using Java

    I am trying to extract the payload data and output as XML text files using Java. Seems that is stored in SOA table XML_DOCUMENT. I am trying the following Java code to get started and it's not working as I would expect. I only get a few actual lines of output and, when I do, I only get the *<?xml version ... ?>* line.
    I appreciate any advice to extract the payload data from the database. Ultimately I will want to include the composite instance ID in the SQL but for now I'm just using the code shown here:
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("soa_db_connection_string");
    ods.setUser("soa_db_user_id");
    ods.setPassword("soa_db_password");
    Connection conn = ods.getConnection();
    String sql = "select document from xml_document where rownum < 10";
    OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement(sql);
    DBBinXMLMetadataProvider dbrep = BinXMLMetadataProviderFactory.createDBMetadataProvider();
    dbrep.setConnectionPool(ods);
    dbrep.associateDataConnection(conn);
    OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
    XMLDOMImplementation domimpl = new XMLDOMImplementation();
    BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor(dbrep);
    while (rset.next()) {
         Blob blob = rset.getBlob("DOCUMENT");
         BinXMLStream inpbin = proc.createBinXMLStream(blob);
         BinXMLDecoder dec = inpbin.getDecoder();
         InfosetReader xmlreader = dec.getReader();
         XMLDocument doc = (XMLDocument)domimpl.createDocument(xmlreader);
         doc.print(System.out);
    }

    I found a method using a slight variation of the code I originally posted. Essentially you remove the DBBinXMLMetadataProvider dbrep portion. I believe, with this included, the XML being extracted is validated against the database (which is referenced as a "metadata provider"). Since the SOA schema doesn't seem to contain the information to validate the XML it returns as blank. If you don't include the dbrep portion then the XML is extracted as desired.
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("soa_db_connection_string");
    ods.setUser("soa_db_user_id");
    ods.setPassword("soa_db_password");
    Connection conn = ods.getConnection();
    String sql = "select document from xml_document where rownum < 10";
    OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement(sql);
    OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
    XMLDOMImplementation domimpl = new XMLDOMImplementation();
    BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor();
    while (rset.next()) {
         BLOB blob = rset.getBLOB("DOCUMENT");
         BinXMLStream inpbin = proc.createBinXMLStream(blob);
         BinXMLDecoder dec = inpbin.getDecoder();
         InfosetReader xmlreader = dec.getReader();
         XMLDocument doc = (XMLDocument)domimpl.createDocument(xmlreader);
         doc.print(System.out);
    }

  • Read message synchronously from JMS queue using OSB

    Hi,
    Is it possible to read message from the JMS queue using OSB based on the request invocation. I know messages can be read from the queue but it will be polling based.
    The requirement is to have an OSB proxy service (HTTP service ) an an interface to the client application. Client application invokes the proxy service and the proxy service need to read message from the JMS queue and provide the message as response to the client.
    Let me know if there are any pointers.
    Thanks
    Sandeep

    Hi,
    I spent some time trying to do this and apart from creating custom database tables etc. I was not able to achieve this.
    We wanted to use in memory JMS queues in our situation.
    In the end we developed a Java Web Service which preformed the on-demand read from the queue (using a particular message selector)
    This is working for us without a problem
    Robert

  • Reading msword using java

    I want to read msword file using java any one help me to do this
    thanks in advancce
    Message was edited by:
    [email protected]

    the msword section of poi is incomplete and has been inactive for several years.
    might be worth looking at word 2003 as this supports an published xml format for documents which you could access using any of the xml apis for java

  • Consuming messages using Java

    Hi,
    I am using BlazeDS running in Tomcat 6.0.16. The Flex client components are written using Flex 3. I have a messaging destination set up and the Flex producers and consumers are working fine. I am able to push messages from the server top the clients using the MessageBroker.routeMessageToService method.
    How can I read/consume messages using Java in the server? I haven't been able to find any documentation or examples on how to do this. Any help and advice is greatly appreciated ... Thanks!
    -- C

    <div class=Section1><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Alex:<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Thank you for your reply. I would prefer not to use JMS since in<br />order to receive messages asynchronously, I would have to use a J2EE message<br />driven bean.  I am trying to implement a listener that can run in Tomcat. <o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Is there a way of doing this without using JMS? Using the<br />message broker I can get a reference to the destination object. And from there<br />I presume it is a matter of registering a callback handler or such &#8230; but<br />I couldn&#8217;t find anything similar in the javadocs.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Cheers,<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Chamara<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><br /><br /><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span<br />style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Alex Glosband<br />[mailto:[email protected]] <br><br /><b>Sent:</b> Thursday, March 13, 2008 9:04 AM<br><br /><b>To:</b> [email protected]<br><br /><b>Subject:</b> Re: Consuming messages using Java<o:p></o:p></span></p><br /><br /></div><br /><br /><p class=MsoNormal><o:p> </o:p></p><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>A new message was posted by<br />Alex Glosband in <br><br /><br><br /><b>General Discussion</b> --<br><br />  Consuming messages using Java<br><br /><br><br />The easiest way to do this is to use the JMS messaging adapter in BlazeDS. This<br />adapter lets your Flex clients publish messages to and receive messages from<br />JMS destinations. You can also have Java JMS clients that send messages to and<br />receive messages from these same destinations. <br><br /><br><br />Take a look at the &quot;Configuring the JMS adapter&quot; section of BlazeDs<br />dev guide for more information about this. <br><br /><br><br /><a<br />href="http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=messaging_ config_3.html#256378">http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?conte nt=messaging_config_3.html#256378</a><br /><br><br /><br><br />-Alex <o:p></o:p></p><br /><br /><div class=MsoNormal><br /><br /><hr size=2 width=200 style='width:150.0pt' align=left><br /><br /></div><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>View/reply at <a<br />href="http://www.adobeforums.com/webx?13@@.59b4a54c/0">Consuming messages using<br />Java</a><br><br />Replies by email are OK.<br><br />Use the <a<br />href="http://www.adobeforums.com/webx?280@@.59b4a54c!folder=.3c061a83">unsubscribe</a>< br />form to cancel your email subscription.<o:p></o:p></p><br /><br /></div>

  • Unable to send messag to JMS Queue using Java

    Hi all,
    I am trying to send a string to the JMS queue using java. I am unable to send the message. It is getting failed at the look up for connection factory. I am using the below code for this purpose.
    public static void messageEnqueue(String payload) throws JMSException,
    NamingException,
    IOException {
    Session session = null;
    MessageProducer publisher = null;
    TextMessage message = null;
    Context context = new InitialContext();
    QueueConnectionFactory connectionFactory =
    (QueueConnectionFactory)context.lookup("*java:comp/env/XAConnectionFactoryJNDIName*");
    Connection connection = connectionFactory.createConnection();
    Queue Queue1 =
    (Queue)context.lookup("*java:comp/env/QueueName*");
    session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
    publisher = session.createProducer(Queue1);
    message = session.createTextMessage(Payload);
    connection.start();
    publisher.send(message);
    connection.stop();
    connection.close();
    kindly help on this.
    Thanks
    Edited by: 887737 on Jun 28, 2012 9:47 PM

    887737 wrote:
    Hi EJP,
    This is the Exception I got when I ran the java class directly from Jdeveloper. Can't I run the standalone class directly from Jdeveloper to insert the message into remote queue?
    Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at javamail.MessageEnqueue.messageEnqueue(MessageEnqueue.java:30)
         at javamail.MessageEnqueue.main(MessageEnqueue.java:51)Hmm. The stack trace doesn't involve any JMS code. Is javamail.MessageEnqueue.messageEnqueue your application? It seems to be doing a JNDI lookup, and you haven't configured JNDI properly. Exactly how to do this depends on what JNDI provider you are using. Earlier in the thread you mentioned you were using WebLogic, so the answer may lie in the WebLogic documentation.
    Nigel

  • Complete code to send an attachment with a text message using java mailapi

    complete code to send an attachment with a text message using java mailapi
    code should be free from error

    http://java.sun.com/products/javamail/FAQ.html#examples
    Was this code too hard to find?
    Was the FAQ too hard to find?

Maybe you are looking for