Sender FileContentConversion - Message tranformation bean - documentOffset

Hi am using a sender SOAP adapter with 'Servlet (Axis)' as transport protocol and 'Axis' as message protocol.
I am using the MessageTransformBean to do my file content conversion.
There is a header line in the file which contains column names.
Sample file:
BOX ID (FI, SOS or COM),Doc Type,Company, Date,Post Key, Number
FI,SA,US,200505311,40,5001000
FI,SA,US,200505332,40,5001000
FI,SA,US,200505333,40,5001000
I am using SimplePlain2XML and I want to ignore the first line of the file and pick up only from 2nd line.
I tried using xml.documentOffset and xml.documentSkipFirstRows parameters to achive this. but both are not working.
I can use StructPlain2XML and handle this whole situation. But i will have to look for keys and all. But can i do this somehow with SimplePlain2XML?
Thanks,
Shobha

Hi Shobha,
The alternate way is to remove the first line and generate the output from second line onwards in message mapping.
Here is the UDF(Context level) to suppress the first line.
Item --- > UDF(removeFirstLine)---->Item
for(int i=0;i<a.length;i++)
if(i==0){
result.addValue(ResultList.SUPPRESS);
else
result.addValue(a[i]);

Similar Messages

  • JMS Exception while trying to send a message on Login

    I am getting the following exception while trying to send a JMS message after the login.
    2012-06-01 12:09:30,688 ERROR [nucleusNamespace.com.tesco.events.manager.ILActivityManager] JMSException Occured
    javax.jms.JMSException: A transaction-related exception occurred while trying to obtain a JMS Session from provider "Login": javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncwhenaborted] Can't register synchronization because the transaction is in aborted state
         at atg.dms.patchbay.SessionManager.getSession(SessionManager.java:190)
         at atg.dms.patchbay.Provider.getQueueSession(Provider.java:632)
         at atg.dms.patchbay.OutputDestination.getPooledSession(OutputDestination.java:268)
         at atg.dms.patchbay.OutputPort.getPooledSession(OutputPort.java:156)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:848)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:546)
         at atg.dms.patchbay.ElementManager.createTextMessage(ElementManager.java:557)
         at com.tesco.events.manager.ILActivityManager.sendLogMessage(ILActivityManager.java:81)
         at com.tesco.events.manager.ILActivityManager.logActivity(ILActivityManager.java:69)
         at com.tesco.events.listener.ATGLogEventListenerImpl.logActivity(ATGLogEventListenerImpl.java:46)
         at com.tesco.events.source.ATGLogEventSource.logActivity(ATGLogEventSource.java:61)
         at com.tesco.ecom.userprofiling.ProfileFormHandler.postLoginUser(ProfileFormHandler.java:2022)
         at com.tesco.ecom.userprofiling.ProfileFormHandler.handleLogin(ProfileFormHandler.java:1191)
         at sun.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at atg.droplet.EventSender.sendEvent(EventSender.java:582)
         at atg.droplet.FormTag.doSendEvents(FormTag.java:791)
         at atg.droplet.FormTag.sendEvents(FormTag.java:640)
         at atg.droplet.DropletEventServlet.sendEvents(DropletEventServlet.java:523)
         at atg.droplet.DropletEventServlet.service(DropletEventServlet.java:550)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.AssignCookieServlet.service(AssignCookieServlet.java:139)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2442)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.commerce.order.CommerceCommandServlet.service(CommerceCommandServlet.java:128)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java:191)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.spindrift.sitebuilder.request.AuthServlet.service(AuthServlet.java:74)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.LoginControlServlet.service(LoginControlServlet.java:61)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.ecom.userprofiling.AccessControlServlet.processExpiredSession(AccessControlServlet.java:645)
         at com.tesco.ecom.userprofiling.AccessControlServlet.service(AccessControlServlet.java:392)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.bns.droplets.AddingRecentlyViewedDroplet.service(AddingRecentlyViewedDroplet.java:235)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:169)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:477)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at atg.search.servlet.SearchClickThroughServlet.service(SearchClickThroughServlet.java:396)
         at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:135)
         at com.tesco.servlet.pipeline.LogOutputFilterServlet.logWithMdc(LogOutputFilterServlet.java:68)
    Edited by: 915252 on Jun 4, 2012 2:39 AM

    Hi,
    you may be interested in a solution I tracked down at http://support.bea.com/application?namespace=askbea&origin=ask_bea.jsp&event=button.search_ask_bea&askbea_display=relevancy&askbea_max_number_returned=50&question=weblogic.jms.common.JMSException%3A+Connection+not+found&all_bea_products=all_bea_products&ES=ES#
    Basically : you need to have your Weblogic servers, JMS servers and JMS stores
    on each domain named uniquely !!!
    "Joe Mooney" <[email protected]> wrote:
    >
    Any news on this one ?
    "B Liu" <[email protected]> wrote:
    Can u tell me how you supplied the required security credentials?
    Thanks,
    -Ben
    "Andy" <[email protected]> wrote:
    Hi.
    I have a situation where I am sending an JMS message to external queue
    on Weblogic
    Server which is not part of cluster. This happens in a session bean,which
    is wrapped
    in a container transaction. I have supplied the required security credentials
    like user, password etc.
    I get an error while tryign to send the message through bean. The stack
    trace
    is :
    weblogic.jms.common.JMSException: Connection not found
    at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:136)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:596)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:153)
    at weblogic.jms.client.JMSConnection.createSessionInternal(JMSConnection.java:400)
    at weblogic.jms.client.JMSConnection.createQueueSession(JMSConnection.java:347)
    also one thing interesting is that if I call the same server and queue
    outside
    of the session bean,it works fine.
    Any ideas what might be causing the issue?
    Thanks
    Andy

  • Error using Message Transform Bean in SimplePlain2XML in file sender

    Hi guys.
    Im using  Message Transform Bean to convert from file to xml in file sender.
    My structure look like this:
    ROW (1..n)
    >TRANSPORTES (1)
    >ENTREGAS (1..n)
    And I have configured the module like this:
    AF_Modules/MessageTransformBean - transform
    transform - Transform.Class - com.sap.aii.messaging.adapter.Conversion
    transform - xml.ENTREGAS.endSeparator - 'nl'
    transform - xml.ENTREGAS.fieldFixedLengths - 1,30
    transform - xml.ENTREGAS.fieldNames - TIPO,NUM_ENTREGA
    transform - xml.ENTREGAS.keyFieldValue - E
    transform - xml.TRANSPORTES.endSeparator - 'nl'
    transform - xml.TRANSPORTES.fieldFixedLengths - 1,30
    transform - xml.TRANSPORTES.fieldNames - TIPO,NUM_TRANSPORTE
    transform - xml.TRANSPORTES.keyFieldValue - T
    transform - xml.conversionType - SimplePlain2XML
    transform - xml.documentName - MPrueba_Zip
    transform - xml.documentNamespace - http:/XXXXXX.es/XXXX/sap/prueba
    transform - xml.keyFieldName - TIPO
    transform - xml.processFieldNames - fromConfiguration
    transform - xml.recordsetName - row
    transform - xml.recordsetStructure - TRANSPORTES,1,ENTREGAS,*
    Im getting this error and I don´t know why:
    Error: com.sap.aii.messaging.adapter.trans.TransformException: Transformer Conversion3.0.5227 Error initializing Class: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: (4408) Parameter 'xml.fieldFixedLengths' or 'xml.fieldSeparator' is missing (4409) Parameter 'xml.fieldNames' is missing (4403) ; nested exception caused by: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: (4408) Parameter 'xml.fieldFixedLengths' or 'xml.fieldSeparator' is missing (4409) Parameter 'xml.fieldNames' is missing (4403)
    Why am i doing wrong?????
    Thanks a lot!!!

    Hi
    For Complex conversion you have to use xml.conversionType as "StructPlain2XML"
    http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm
    Regards
    Ramg

  • Session Bean trying to send a message to Websphere MQ5.3

    Hello all,
    I use WSAD5.1 and Websphere MQ 5.3. Websphere MQ is installed on a
    Solaris box with a Queue Manager configured and several queues created on it.
    The WSAD, is running on a different machine. I have written a session bean with a method, putMessage( ).
    Inside this putMessage( ), I'm supposed to send a message to one of the
    queues configured in Websphere MQ running on the solaris box. How should I code in my putMessage( ) method, so that I'm able to send a message to the queue.
    My major doubt is I need to look up for the QueueConnectionFactory and also the queue inside the session bean. I doubt if this is possible using JNDI.
    I'm coding as per EJB2.0 specs.
    Can someone guide me what is the right approach so that I'm able to send a message from sessionbean to a queue.
    If someone could point to some kind of example code, that would be great.
    P.S. I know, how to code if I create the queue and QueueConnectionFactory, in WSAD, i.e., in the Server configuration.
    But what I don't know is, how to code if I'm using MQ Series running
    elsewhere.
    Thanks in advance,
    Pandit.
    Please get back to me if you need any clarifications.

    try this : (you need some mq libraries (search for ma88 in google ( MQSeries classes for Java and MQSeries classes for Java))
    import com.ibm.mq.*; // Include the WebSphere MQ classes for Java package
    public class SendMessageToMQ
    private String qManager = "AIXD004"; // define name of queue // manager to connect to.
    private MQQueueManager qMgr; // define a queue manager
    // object
    public static void main(String args[]) {
    new SendMessageToMQ();
    public SendMessageToMQ() {
        // Set up WebSphere MQ environment
    MQEnvironment.hostname = "192.168.19.41";
    MQEnvironment.port=1415;
    // hostname & channel
    //MQEnvironment.channel = "S_ibcn_c029"; // string directly here!
    //MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);//Connection
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
    MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
       try {
          // Create a connection to the queue manager
          qMgr = new MQQueueManager(qManager);
          // Set up the options on the queue we wish to open...
          // Note. All WebSphere MQ Options are prefixed with MQC in Java.
          int openOptions = MQC.MQOO_INPUT_AS_Q_DEF |
          MQC.MQOO_OUTPUT ;
          // Now specify the queue that we wish to open,
          // and the open options...
          MQQueue system_default_local_queue =
          //qMgr.accessQueue("ENTEST1.HOST.ASYNC.RECEPCION",
          qMgr.accessQueue("QNO.0002.AIXD004.L",
          openOptions);
          // Define a simple WebSphere MQ message, and write some text in UTF format..
          MQMessage hello_world = new MQMessage();
          hello_world.writeUTF("Hello World!");
          // specify the message options...
          MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the // defaults,
          // same as MQPMO_DEFAULT
          // put the message on the queue
          system_default_local_queue.put(hello_world,pmo);
          // get the message back again...
          // First define a WebSphere MQ message buffer to receive the message into..
          MQMessage retrievedMessage = new MQMessage();
          // Set the get message options...
          MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults
          // same as MQGMO_DEFAULT
          // get the message off the queue...
          system_default_local_queue.get(retrievedMessage, gmo);
          // And prove we have the message by displaying the UTF message text
          //String msgText = retrievedMessage.readUTF();
          String msgText = retrievedMessage.readUTF();
          System.out.println("The message is: " + msgText);
          // Close the queue...
          system_default_local_queue.close();
          // Disconnect from the queue manager
          qMgr.disconnect();
      // If an error has occurred in the above, try to identify what went wrong
      // Was it a WebSphere MQ error?
      catch (MQException ex)
      System.out.println("A WebSphere MQ error occurred : Completion code " +
      ex.completionCode + " Reason code " + ex.reasonCode);
      // Was it a Java buffer space error?
      catch (java.io.IOException ex)
      System.out.println("An error occurred whilst writing to the message buffer: " + ex);
    } // end of sample

  • Message Driven Beans: how to receive and send in a single session?

    Hello
    How to receive and send JMS messages in a message driven bean using a single session?
    Thanks.

    Are you referring to writing code within the onMessage method itself to receive JMS messages?
    If so, that is not a pattern that is recommended, especially not in the case of a blocking JMS
    receieve. If you must write an explicit JMS receive within an EJB component it's best to use
    a "check the queue" approach where you give a very small timeout for the receive. That way
    if the message is there it will be returned but if not the call will not block.
    You'll also need to take the transactional settings of the onMessage method into account.
    If your are sending a message and then waiting for a response, those two actions can
    not be done within the same global transaction. For that, you'll need to either use
    BMT and perform each in its own transaction or just not use global transactions at all,
    in which case each send and receive operation will be atomic.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Sending jms message from bc4j session bean

    Hi,
    i need to send some message from my bc4j (deployed as session bean).
    i have successfully deployed my mdb to listen for these message via Queue. I try to send some message from test client it works well, this the code snippet :
    String connectionFactoryName = "java:comp/env/jms/QueueConnectionFactory";
    String queueName = "java:comp/env/jms/demoQueue";
    JMSSender sender = new JMSSender(connectionFactoryName,queueName);
    sender.send("test");
    sender.close();
    when i move this code to my bc4j(session bean), message is sent, but my mdb doesn't receive it !( onMessage procedure doesn't come out )
    Really appreciate for help,
    Ricky H.P.

    sorry, this is JMSSender class source code:
    public class JMSSender{
    Context jndiContext;
    QueueConnectionFactory connectionFactory;
    QueueConnection connection;
    QueueSession session;
    TextMessage message;
    QueueSender queueSender;
    Queue queue;
    public JMSSender(String connectionFactoryName,String queueName){
    init(connectionFactoryName,queueName);
    void init(String connectionFactoryName,String queueName){
    * Create a JNDI InitialContext object.
    try {
    jndiContext = new InitialContext();
    } catch (NamingException e) {
    e.printStackTrace();
    * Look up connection factory and queue. If either does
    * not exist, exit.
    try {       
    //connectionFactory = (QueueConnectionFactory)jndiContext.lookup("java:comp/env/jms/QueueConnectionFactory");
    //queue = (Queue)jndiContext.lookup("java:comp/env/jms/demoQueue");
    connectionFactory = (QueueConnectionFactory)jndiContext.lookup(connectionFactoryName);
    queue = (Queue)jndiContext.lookup(queueName);
    }catch (Exception e) {
    e.printStackTrace();
    public void send(String strMessage){
    try {
    connection = connectionFactory.createQueueConnection();
    session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    String correlationId = Long.toString(System.currentTimeMillis());
    message = session.createTextMessage();
    message.setText(strMessage);
    queueSender = session.createSender(queue);
    queueSender.send(message);
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    System.out.println("message sent success !!!");
    public void close(){
    try {
    queueSender.close();
    session.close();
    connection.close();
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    public static void main(String args[]){
    new JMSSender("java:comp/env/jms/QueueConnectionFactory","java:comp/env/jms/trgBctQueue");
    }

  • Send message from JSP page to Java message driven bean

    Hi all
    I'm using Jdev903.
    I need to send a message from JSP page (Web Application) to Java Message Driven Bean.
    * I created Message Driven Bean that named: MyMessageDrivenEJBBean
    * I have configed jms.xml:
    <topic-connection-factory name="ChatTopicConnectionFactory" location="jms/theTopicConnectionFactory"/>
    <topic name="ChatTopic" location="jms/theTopic"/>
    * In JSP page, my code is:
    final Context ctx = new InitialContext();
    // 1: Lookup ConnectionFactory via JNDI
    TopicConnectionFactory factory =(TopicConnectionFactory)ctx.lookup("jms/theTopicConnectionFactory");
    But trouble occurs is:
    javax.naming.NameNotFoundException: jms/theTopicConnectionFactory not found
    please help me!
    thank a lot.

    Welcome to the Sun forums.
    1. Please post your code using code tags, this formats it so that it is easier for people to read and understand it. Click on 'CODE' above the text area when posting.
    2. As far as possible, please post an SSCCE
    What have learnt about JSPs and servlets till now? Because reading the values submitted in a form is pretty much the base of all operations. I suggest you Google for [servlet tutorials|http://www.google.com/search?q=servlet+tutorial] and [JSP tutorials|http://www.google.com/search?q=jsp+tutorial] and go through them thoroughly. After you understand what is to be done and what options are available to you, if you still face problems, please feel free to post your queries here. But this isn't exactly a site for tutorials, especially since there are so many good ones already out there, that explain all this stuff in detail. There's no point in re-inventing the wheel.
    Hints: [ServletRequest#getParameter()|http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getParameter(java.lang.String)] and [RequestDispatcher#forward|http://java.sun.com/javaee/5/docs/api/javax/servlet/RequestDispatcher.html]

  • How to send message from Message Driven Bean  to JMS client?

    In my project I have JMS client, two QueueConnectionFactory and Message Driven Bean. Client send message to MDB through the first QueueConnectionFactory , in one's turn MDB send message to client through the second Queue Connection Factory . I already config my Sun AppServer for sending message in one way, and sending message from MDB to the second QueueConnectionFactory. But on my Client there is an error : �JNDI lookup failed: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MyQueue2� (jms/MyQueue2 � this is the name of my Queue). So it couldn't get this message.
    P.S.
    Thank you for help!!!

    What is the name of the second queue?is the connection factory on the local?Yes the connection factory is on the local. The name of my first queue is jms/MYQueue and the name of another one is jms/MyQueue2.

  • Error while deploying a message driven bean

    I am deployeing a MDB which is done successfully but the message is not retrieved(No message in teh queue). The following description is given in the log file.
    #1.5#0016E6197593004B0000000B000013040004288DE20D6CD8#1170489754872#com.sap.security.core.policy.PolicyInfoManagerImpl##com.sap.security.core.policy.PolicyInfoManagerImpl.copyApplicationConfiguration#Administrator#523####e5dbec01b35c11db90e70016e6197593#SAPEngine_Application_Thread[impl:3]_39##0#0#Error#1#/System/Security/WS/SecurityProtocol#Java###An error occured while copying configurations for application . Reason: #3#sap.com/MessageEAR#com.sap.engine.frame.core.configuration.NameNotFoundException#A configuration with the path "webservices/services/sap.com/MessageEAR" does not exist.#
    Can you please tell where to look for it and what to do?

    the session bean is ::
    public class SenderBean implements SessionBean {
      public static final boolean DEBUG = false;
      private SessionContext ctx;
      private TopicConnectionFactory factory;
      private TopicConnection connection;
      private Topic topic;
      public SenderBean() {
         log("constructor");
      public void ejbCreateSender() throws CreateException {
         log("ejbCreate");
                try {
                   InitialContext naming = new InitialContext();
                   factory = (TopicConnectionFactory)naming.lookup("jmsfactory/default/ExceptionTopicFactory");
                   topic = (Topic)naming.lookup("jmstopics/default/ExceptionTopic");
                   log("factory: " + factory);
                   allocateResources();
                } catch (Exception exc) {
                   log("exception occured during ejbCreate().");
                   throw new CreateException("Unexpected exception in ejbCreate().");
      public void ejbCreate() throws CreateException {
      public void ejbActivate() {
         log("ejbActivate");
         try {
           allocateResources();
         } catch (Exception exc) {
           exc.printStackTrace();
      public void ejbPassivate() {
         log("ejbPassivate");
         try {
           releaseResources();
         } catch (Exception exc) {
           exc.printStackTrace();
      public void ejbRemove() {
         log("ejbRemove");
      public void setSessionContext(SessionContext _ctx) {
         log("setSessionContext");
         ctx = _ctx;
      public void sendMessage(String text) throws MessageNotSentException {
         log("sendMessage");
         log("text = " + text);
         TopicSession session = null;
         try {
           session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
           log("topic = " + topic);
           TopicPublisher publisher = session.createPublisher(topic);
           TextMessage textMessage = session.createTextMessage();
           textMessage.setText(text);
           publisher.publish(textMessage);
           System.out.println("Message Sent");
           log("message sent");
         } catch (JMSException jmse) {
           jmse.printStackTrace();
           throw new MessageNotSentException(jmse.toString());
         } finally {
           try {
              if (session != null) {
                session.close();
           } catch (Exception exc) {
      private void releaseResources() throws JMSException {
         connection.close();
         connection = null;
      private void allocateResources() throws JMSException {
         connection = factory.createTopicConnection();
         log("connection = " + connection);
         connection.start();
         log("connection started");
      private void log(String message) {
         if (DEBUG) {
           System.out.println("SenderBean: " + message);
    the mdb is::
    public class MessageDisplayBean implements MessageDrivenBean, MessageListener {
           public static final boolean DEBUG = false;
           private MessageDrivenContext ctx;
           private QueueConnectionFactory factory;
           private QueueConnection connection;
           private Queue queue;
           public MessageDisplayBean() {
              System.out.println("In constructor");
              log("constructor");
           public void onMessage(Message message) {
              TextMessage textMessage = (TextMessage)message;
              try {
                String text = textMessage.getText();
                log("message received. Text follows:\n\n  " + text + "\n\n");
                connection = factory.createQueueConnection();
                connection.start();
                QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                TextMessage confirmation = session.createTextMessage();
                confirmation.setText("Message \""+ textMessage.getText() + "\" received.");
                //queue = session.createQueue("ConfirmationQueue");
                QueueSender sender = session.createSender(queue);
                sender.send(confirmation);
                session.close();
                connection.close();
                System.out.println("Message received");
              } catch (javax.jms.JMSException jmse) {
           public void ejbRemove() {
              log("ejbRemove()");
           public void setMessageDrivenContext(MessageDrivenContext _ctx) {
              log("setMessageDrivenContext()");
              ctx = _ctx;
              System.out.println("In context");
           public void ejbCreate() {
              try {
                   System.out.println("In ejbcreate");
                InitialContext naming = new InitialContext();
                factory = (QueueConnectionFactory)naming.lookup("jmsfactory/default/ExceptionQueueFactory");
                queue = (Queue)naming.lookup("jmsqueues/default/ExceptionQueue");
                log("factory: " + factory);
              } catch (Exception exc) {
                log("exception occured during ejbCreate().");
              log("ejbCreate()");
           private void log(String str) {
              if (DEBUG) {
                System.out.println("MessageDisplayBean: " + str);
    th ejb-j2ee-engine.xml is::
    <ejb-j2ee-engine>
         <enterprise-beans>
              <enterprise-bean>
                   <ejb-name>MessageDisplayBean</ejb-name>
                   <jndi-name>MessageDisplayBean</jndi-name>
                   <message-props>
                        <destination-name>ExceptionTopic</destination-name>
                        <connection-factory-name>ExceptionTopicFactory</connection-factory-name>
                   </message-props>
              </enterprise-bean>
              <enterprise-bean>
                   <ejb-name>MessageSender</ejb-name>
                   <jndi-name>MessageSender</jndi-name>
                   <session-props/>
              </enterprise-bean>
                   </enterprise-beans>
    </ejb-j2ee-engine>
    the ejb-jar.xml is::
                 <ejb-jar>
        <display-name>        Message Driver Bean Example      </display-name>
        <enterprise-beans>
            <session>
                <display-name>            MessageSender          </display-name>
                <ejb-name>MessageSender</ejb-name>
                <home>com.sap.message.sender.SenderHome</home>
                <remote>com.sap.message.sender.Sender</remote>
                <local-home>com.sap.message.sender.SenderLocalHome</local-home>
                <local>com.sap.message.sender.SenderLocal</local>
                <ejb-class>com.sap.message.sender.SenderBean</ejb-class>
                <session-type>Stateful</session-type>
                <transaction-type>Container</transaction-type>
                <ejb-local-ref>
                    <ejb-ref-name>ejb/SenderBean</ejb-ref-name>
                    <ejb-ref-type>Session</ejb-ref-type>
                    <local-home>com.sap.message.sender.SenderLocalHome</local-home>
                    <local>com.sap.message.sender.SenderLocal</local>
                    <ejb-link>MyEJB.jar#MessageSender</ejb-link>
                </ejb-local-ref>
                <resource-ref>
                    <res-ref-name>ExceptionTopicFactory</res-ref-name>
                    <res-type>javax.jms.TopicConnectionFactory</res-type>
                    <res-auth> Container</res-auth>
                </resource-ref>
                <resource-env-ref>
                    <resource-env-ref-name>ExceptionTopic        </resource-env-ref-name>
                    <resource-env-ref-type>   javax.jms.Topic        </resource-env-ref-type>
                </resource-env-ref>
            </session>
            <message-driven>
                <ejb-name>MessageDisplayBean</ejb-name>
                <ejb-class>com.sap.message.mdb.MessageDisplayBean</ejb-class>
                <transaction-type>Container</transaction-type>
                <message-driven-destination>
                    <destination-type>javax.jms.Topic</destination-type>
                </message-driven-destination>
                <resource-ref>
                    <res-ref-name>   ExceptionQueueFactory            </res-ref-name>
                    <res-type>              javax.jms.QueueConnectionFactory            </res-type>
                    <res-auth>              Container            </res-auth>
                </resource-ref>
                <resource-env-ref>
                    <resource-env-ref-name>        ExceptionQueue        </resource-env-ref-name>
                    <resource-env-ref-type>          javax.jms.Queue        </resource-env-ref-type>
                </resource-env-ref>
            </message-driven>
               </enterprise-beans>
        <assembly-descriptor>
            <container-transaction>
                <method>
                    <ejb-name>MessageDisplayBean</ejb-name>
                    <method-name>onMessage</method-name>
                </method>
                          <trans-attribute>           NotSupported         </trans-attribute>
            </container-transaction>
        </assembly-descriptor>
    </ejb-jar>

  • How to transaction in the message driven bean?

              hello
              i write a message driven bean,that monitor the weblogic message queue,when a "Order"
              object is witten to the queue,the mdb get it and write it to a entity bean "Orderinfo".all
              of above logic is within the "onMessage" method of the mdb.
              i want to encapsulate the flow in a transaction,see my code snippet of the onMessage
              method:
              ObjectMessage objMsg = (ObjectMessage) msg;
              OrderVO orderVO = (OrderVO) objMsg.getObject();
              System.out.println(orderVO.booklist);
              OrderinfoHome orderinfoHome = (OrderinfoHome) ctx.lookup(
              "java:/comp/env/orderinfo");
              Orderinfo orderinfo = orderinfoHome.create(orderVO.orderID);
              orderinfo.setAddress(orderVO.address);
              orderinfo.setCustname(orderVO.custName);
              orderinfo.setEmail(orderVO.email);
              orderinfo.setBooklist(orderVO.booklist);
              orderinfo.setPrice(new BigDecimal(orderVO.price));
              and deploy descriptor snippet(ejb-jar.xml):
              <assembly-descriptor>
              <container-transaction>
              <method>
              <ejb-name>orderMDB</ejb-name>
              <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
              </container-transaction>
              </assembly-descriptor>
              i think during this transaction,there are two action:geting the object from the
              queue and saving it to entity bean.in order to test the transaction,i modify the
              jndi name of entity bean in the code to a WRONG one.redeploy my program,and send
              a message to the queue,the mdb is activated,then the exception is thrown because
              of the wrong jndi name.after that,i check the message queue,find that it is empty.why?i
              think if the second action of the transaction is fail,the transaction should roll
              back,the message should be send BACK to the queue.
              i also ty to use the "javax.transaction.UserTransaction" in the onMessage method,but
              the follwing exception is thrown:
              javax.transaction.NotSupportedException: Another transaction is associated with
              this thread.................................
              who can help me,if any wrong with me,and how to use the transaction with the message
              driven bean?
              thank you.
              

    The transaction should rollback if the MDB throws an
              exception. Try changing your MDB code to
              call "setRollbackOnly()" on the EJB
              context (instead of throwing an exception) to see
              if that works. If calling "setRollbackOnly()" fixes
              the problem - then please contact customer support
              and report a bug.
              zbcong wrote:
              > hello
              >
              > i write a message driven bean,that monitor the weblogic message queue,when a "Order"
              > object is witten to the queue,the mdb get it and write it to a entity bean "Orderinfo".all
              > of above logic is within the "onMessage" method of the mdb.
              > i want to encapsulate the flow in a transaction,see my code snippet of the onMessage
              > method:
              >
              >
              > ObjectMessage objMsg = (ObjectMessage) msg;
              > OrderVO orderVO = (OrderVO) objMsg.getObject();
              > System.out.println(orderVO.booklist);
              > OrderinfoHome orderinfoHome = (OrderinfoHome) ctx.lookup(
              > "java:/comp/env/orderinfo");
              > Orderinfo orderinfo = orderinfoHome.create(orderVO.orderID);
              > orderinfo.setAddress(orderVO.address);
              > orderinfo.setCustname(orderVO.custName);
              > orderinfo.setEmail(orderVO.email);
              > orderinfo.setBooklist(orderVO.booklist);
              > orderinfo.setPrice(new BigDecimal(orderVO.price));
              >
              >
              > and deploy descriptor snippet(ejb-jar.xml):
              >
              >
              > <assembly-descriptor>
              > ............
              > ...........
              >
              > <container-transaction>
              > <method>
              > <ejb-name>orderMDB</ejb-name>
              > <method-name>*</method-name>
              > </method>
              > <trans-attribute>Required</trans-attribute>
              > </container-transaction>
              > </assembly-descriptor>
              >
              >
              > i think during this transaction,there are two action:geting the object from the
              > queue and saving it to entity bean.in order to test the transaction,i modify the
              > jndi name of entity bean in the code to a WRONG one.redeploy my program,and send
              > a message to the queue,the mdb is activated,then the exception is thrown because
              > of the wrong jndi name.after that,i check the message queue,find that it is empty.why?i
              > think if the second action of the transaction is fail,the transaction should roll
              > back,the message should be send BACK to the queue.
              >
              > i also ty to use the "javax.transaction.UserTransaction" in the onMessage method,but
              > the follwing exception is thrown:
              >
              > javax.transaction.NotSupportedException: Another transaction is associated with
              > this thread.................................
              >
              > who can help me,if any wrong with me,and how to use the transaction with the message
              > driven bean?
              >
              > thank you.
              >
              >
              

  • WebLogic 10 and EJB 3.0 for Message Driven Bean

    Hi,
    I am trying to deploy Message Driven Bean using EJB3.0 on weblogic 10. I am using annotations and don't want to use deployment descriptors.
    The Bean class:
    CalculatorBean.java
    import javax.ejb.*;
    import javax.jms.*;
    import java.sql.Timestamp;
    import java.util.StringTokenizer;
    @MessageDriven(activationConfig =
    @ActivationConfigProperty(propertyName="destinationType",
    propertyValue="javax.jms.Queue"),
    @ActivationConfigProperty(propertyName="destination",
    propertyValue="queue/mdb")
    public class CalculatorBean implements MessageListener {
    public void onMessage (Message msg) {
    TextMessage tmsg=null;
    try {
    if (msg instanceof TextMessage) {
    tmsg = (TextMessage) msg;
    System.out.println
    ("MESSAGE BEAN1: Message received: "
    + tmsg.getText());
    } else {
    System.out.println
    ("Message of wrong type1: "
    + msg.getClass().getName());
    catch (JMSException e) {
    e.printStackTrace();
    catch (Throwable te) {
    te.printStackTrace();
    My client:
    import javax.naming.*;
    import javax.naming.InitialContext;
    import java.text.*;
    import javax.jms.*;
    public class MsgClient {
    public static void main(String args[])
    QueueConnection cnn=null;
    QueueSender sender=null;
    QueueSession sess=null;
    Queue queue=null;
    try {
    java.util.Properties p = new java.util.Properties();
    p.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
    p.put("java.naming.provider.url","t3://10.6.74.79:7001");
    Context ctx=new InitialContext(p);
    //InitialContext ctx=new InitialContext(p);
    queue = (Queue)ctx.lookup("queue/mdb");
    QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
    cnn = factory.createQueueConnection();
    sess= cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
    sender = sess.createSender(queue);
    TextMessage message = sess.createTextMessage();
    message.setText("This is message by Gurumurthy" );
    System.out.println("Sending message: " +message.getText());
    sender.send(message);
    sess.close();
    catch (Exception e)
    e.printStackTrace();
    I am compiling and creating jar file for this class. Then I am creating a .ear file for this.
    The meta-inf/application.xml contains the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>MDBWorking1</display-name>
    <description>Application description</description>
    <module>
    <ejb>MDBWorking1.jar</ejb>
    </module>
    </application>
    I don't want to use deployment descriptor (ejb-jar.xml or weblogic-ejb-jar-xml), because I want to utilize the annotation feature of EJB3.0
    So, after creating the .ear file for this, and try to deploy on weblogic 10, I get the following error:
    An error occurred during activation of changes, please see the log for details.
    Exception preparing module: EJBModule(MDBWorking1.jar) Unable to deploy EJB: CalculatorBean from MDBWorking1.jar: [EJB:011113]Error: The Message Driven Bean 'CalculatorBean(Application: MDBWorking1, EJBComponent: MDBWorking1.jar)', does not have a message destination configured. The message destination must be set using a message-destination-link, destination-resource-link, destination-jndi-name or a resource-adapter-jndi-name.
    Substituted for missing class [EJB - 11113]Error: The Message Driven Bean 'CalculatorBean(Application: MDBWorking1, EJBComponent: MDBWorking1.jar)', does not have a message destination configured. The message destination must be set using a message-destination-link, destination-resource-link, destination-jndi-name or a resource-adapter-jndi-name.
    How to solve this?
    Note:
    I don't want to use Deployment Descriptor and all I want to use is EJB3.0's annotation feature.
    Thanks,
    Guru

    Dear gurubbc,
    I don't know if it still matters to you but you can use the javax.ejb.MessageDriven annotation to point your bean on your queue. I had the same issue like you but i could not solve it properly by switchihg to weblogic.ejb.MessageDriven.
    Use the following annotation and it should work out:
    @MessageDriven
    (mappedName = "queue/mdb",
    name = "CalculatorBean",
    activationConfig = {
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    Here you can see that the mappedName is the JNDI name of the queue you are trying to connect to. The name is the name for your Bean, and the only property passed is the destination type.
    Hope this helps.
    Cheers,
    Istvan

  • Seeburger SFTP - Message Transformation Bean Issue

    Using Seeburger SFTP adapter to read a tab delimited file. File is being successfully read; however, content conversion need to be performed to convert the file content to XML.  Thus, using Message Transformation Bean with the following module parameters.  
    Issue: It is reading the file as is u2013 there is not content conversion is being performed. 
    Processing Sequence:
    1      localejbs/Seeburger/solution/sftp                Local Enterprise Bean     solutionid
    2     localejbs/AF_Modules/MessageTransformBean          Local Enterprise Bean     mtb
    3     localejbs/CallSapAdapter                    Local Enterprise Bean     exit
    Module Configuration:
    mtb          Transform.Class                          com.sap.aii.messaging.adapter.Conversion
    mtb           Transform.ContentType               text/xml;charset=utf-8
    mtb          xml.conversionType               SimplePlain2XML
    mtb          xml.documentName               XXX_EXPENSES_mt
    mtb          xml.fieldContentFormatting     trim    
    mtb          xml.fieldNames                    FIELD1,FIELD2,FIELD3,FIELD4
    mtb          xml.fieldSeparator               '0x09'
    mtb          xml.processFieldNames               fromConfiguration
    mtb          xml.structureTitle               RECORD
    The following the noticeable details on CC:
    Error type: TASK_ERROR >> Error date: 12/5/10 12:42 PM >> Description: Polling finished with errors. 1 file initiated. 1 file not polled due to errors.
    Message initiated succesfully
    Error type: TASK_ERROR >> Error date:  >> Description: File <amex.dat> could not be polled  from directory </usr/sap/interfaces/FTP1/send> on host <sapdv1ci>; Reason: removeFile: File xxx.dat could not be removed. SftpStatusCode: SSH_FX_NO_SUCH_FILE; Reason: No such file
    Any help is greatly appreciated.
    Thanks

    Check the following...
    1. Make sure you don't have any scripts running at your target folder.
    Example: If you are reading your file from TEST folder make sure you don't have any scripts running here.
    2. In File Setting section make sure you uncheck Delete file checkbok.
    Regards
    Srikanth Baki

  • Standard Adapter Module "Message Transform Bean" in Seeburger AS2 Adapter

    Hi,
        I am calling standard adapter module "Message Transform Bean" in seeburger AS2 Sender adapter where I am getting the following error :
    ClassNotFoundException:com.sap.aii.messaging.adapter.Conversion . Can anybody help me on this. Appreciate for your respoinse.
    Thank you,
    Mallikarjuna Rao M

    Hi,
    Thank you for your replies I manage to get NWA dump for this issue.. Here is the log
    Could not call backend system: Error in ???-module:Transform: failed to set up the transformer for channel 6857fd15f84d3e23a7b0f51ca1851b20; modkey TXT2XML; caused by java.lang.ClassNotFoundException: com.sap.aii.messaging.adapter.Conversion
    Loader Info -
    ClassLoader name: [sap.com/com.sap.aii.af.mod.trans.app]
    Living status: alive
    Direct parent loaders:
       [system:Frame]
       [service:servlet_jsp]
       [service:ejb]
       [library:engine.j2ee14.facade]
       [library:com.sap.base.technology.facade]
       [library:com.sap.aii.af.lib]
       [library:com.sap.aii.af.sdk.lib]
       [service:com.sap.aii.af.cpa.svc]
       [service:com.sap.aii.af.svc]
       [service:com.sap.aii.adapter.xi.svc]
       [library:com.sap.aii.adapter.lib]
    Resources:
       D:\usr\sap\BWD\DVEBMGS00\j2ee\cluster\apps\sap.com\com.sap.aii.af.mod.trans.app\EJBContainer\applicationjars\com.sap.aii.af.mod.trans.ejb.jar
    [LOC: com.seeburger.as2.impl.SHCInitiatorProcessor.initiateToBackend] Caused by: Error in ???-module:Transform: failed to set up the transformer for channel 6857fd15f84d3e23a7b0f51ca1851b20; modkey TXT2XML; caused by java.lang.ClassNotFoundException: com.sap.aii.messaging.adapter.Conversion
    Loader Info -
    ClassLoader name: [sap.com/com.sap.aii.af.mod.trans.app]
    Living status: alive
    Direct parent loaders:
       [system:Frame]
       [service:servlet_jsp]
       [service:ejb]
       [library:engine.j2ee14.facade]
       [library:com.sap.base.technology.facade]
       [library:com.sap.aii.af.lib]
       [library:com.sap.aii.af.sdk.lib]
       [service:com.sap.aii.af.cpa.svc]
       [service:com.sap.aii.af.svc]
       [service:com.sap.aii.adapter.xi.svc]
       [library:com.sap.aii.adapter.lib]
    Resources:
       D:\usr\sap\BWD\DVEBMGS00\j2ee\cluster\apps\sap.com\com.sap.aii.af.mod.trans.app\EJBContainer\applicationjars\com.sap.aii.af.mod.trans.ejb.jar
    at com.seeburger.xi.api.module.impl.nw71.SeeModuleProcessorLocal71.process(SeeModuleProcessorLocal71.java:55)
    at com.seeburger.xi.connector.fw.InitiationThread.run(InitiationThread.java:101)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)
    Caused by: java.lang.ClassNotFoundException: com.sap.aii.messaging.adapter.Conversion
    Loader Info -
    ClassLoader name: [sap.com/com.sap.aii.af.mod.trans.app]
    Living status: alive
    Direct parent loaders:
       [system:Frame]
       [service:servlet_jsp]
       [service:ejb]
       [library:engine.j2ee14.facade]
       [library:com.sap.base.technology.facade]
       [library:com.sap.aii.af.lib]
       [library:com.sap.aii.af.sdk.lib]
       [service:com.sap.aii.af.cpa.svc]
       [service:com.sap.aii.af.svc]
       [service:com.sap.aii.adapter.xi.svc]
       [library:com.sap.aii.adapter.lib]
    Resources:
       D:\usr\sap\BWD\DVEBMGS00\j2ee\cluster\apps\sap.com\com.sap.aii.af.mod.trans.app\EJBContainer\applicationjars\com.sap.aii.af.mod.trans.ejb.jar
    at com.sap.engine.boot.loader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:259)
    at com.sap.engine.boot.loader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:228)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:353)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at com.sap.aii.af.modules.trans.MessageTransformBean.loadClass(MessageTransformBean.java:121)
    at com.sap.aii.af.modules.trans.MessageTransformBean.setup(MessageTransformBean.java:178)
    at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:346)
    at sun.reflect.GeneratedMethodAccessor484_10002.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
    at $Proxy2674_10002.process(Unknown Source)
    at com.sap.aii.af.app.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:249)
    at sun.reflect.GeneratedMethodAccessor311_10002.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
    at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
    at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
    at $Proxy102_10002.process(Unknown Source)
    at com.seeburger.xi.api.module.impl.nw71.SeeModuleProcessorLocal71.process(SeeModuleProcessorLocal71.java:43)
    Waiting for your valuable inputs on this.
    Thank you,
    Mallikarjuna Rao M

  • Message Driven Beans replying to messages

    Hi
    I'm trying to send a reply message from an MDB. What I have in mind is this:
    1) in the onMessage() method of the bean, analyze the message and get the replyTo property of the message.
    2) Set up the reply message and send the message back to the original sender.
    I've done this using regular client-server apps, but not with MDB's. What I want to know is must I do the JNDI lookups to get the Connection factories etc in the MDB itself? Or is there some way I can get a session that already exists in the Bean Container (I'm using JBoss 3.0.2), to create the reply?
    Thanks
    Daniel

    There is no J2EE way to get hold of the session that was used, you have to do a lookup of a Connection Factory.
    Thanks
    Alasdair

  • Problem deploying message driven bean using Log4j

    Hello all.
    Using JDeveloper 11.1.1.0.2, I'm having a problem with a message driven bean I've created and associated with a JMS queue.
    I've created an EJB Module project in my application (in which some other projects exist), and created the bean. A simple test of the bean, sending a message through the jms queue and printing it on system.out in the mdb onMessage() worked just fine.
    However, when I add apache commons logging to my mdb, things start to go wrong. Running the project on the integrated weblogic 10.3 server just fails during deployment, due to a NoClassDefFoundError on org/apache/log4j/Logger.
    In project properties -> libraries and classpath, I've added a log4j library (Log4j-1.2.14.jar) next to Commons Logging 1.0.4 but it doesn't seem to matter anything.
    The code of my message bean:
    @MessageDriven(mappedName = "weblogic.wsee.DefaultQueue")
    public class MyMessageBean implements MessageListener {
        // logger
        private static Log sLog = LogFactory.getLog(MyMessageBean.class);
        public void ejbCreate() {
        public void ejbRemove() {
        public void onMessage(Message message) {
            MapMessage mapmsg = null;
            try {
                if (message instanceof MapMessage) {
                    mapmsg = (MapMessage)message;
                    boolean msgRedelivered = mapmsg.getJMSRedelivered();
                    String msgId = mapmsg.getJMSMessageID();
                    if (!msgRedelivered) {
                        sLog.debug("****** Successfully received message " + msgId);
                    } else {
                        sLog.debug("****** Successfully received redelivered message " + msgId);
                    // Haal de inhoud op:
                    int testInt = mapmsg.getInt("TestInt");
                    sLog.debug("TestInt:" + testInt);
                } else {
                    sLog.debug("Message of wrong type: " +
                                       message.getClass().getName());
            } catch (Exception e) {
                sLog.error("Fout in verwerken",e);           
    }Does anybody have any clue as to what I might be doing wrong or missing out here?
    The complete stacktrace:
    5-aug-2009 12:54:44 oracle.adf.share.config.ADFConfigFactory cleanUpApplicationState
    INFO: Cleaning up application state
    java.lang.ExceptionInInitializerError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:247)
         at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processWLSAnnotations(EjbAnnotationProcessor.java:1705)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processWLSAnnotations(EjbDescriptorReaderImpl.java:346)
         at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:192)
         at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
         at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1198)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:380)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
         at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@51b296 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@51b296 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger))
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at nl.justid.dolores.mdb.MyMessageBean.<clinit>(MyMessageBean.java:19)
         ... 32 more
    Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@51b296 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Logger)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         ... 36 more
    Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
         at java.lang.Class.getConstructor0(Class.java:2699)
         at java.lang.Class.getConstructor(Class.java:1657)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
         ... 37 more
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         ... 42 more
    <5-aug-2009 12:54:44 uur CEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1249469684085' for task '14'. Error is: 'weblogic.application.ModuleException: Exception preparing module: EJBModule(Dolores-MessageBeans-ejb)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    null.'
    weblogic.application.ModuleException: Exception preparing module: EJBModule(Dolores-MessageBeans-ejb)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    null.
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: org.apache.log4j.Logger
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         Truncated. see log file for complete stacktrace
    >
    5-aug-2009 12:54:44 oracle.adf.share.config.ADFConfigFactory cleanUpApplicationState
    INFO: Cleaning up application state
    <5-aug-2009 12:54:44 uur CEST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'Dolores'.>
    <5-aug-2009 12:54:44 uur CEST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    weblogic.application.ModuleException: Exception preparing module: EJBModule(Dolores-MessageBeans-ejb)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    null.
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
         Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: org.apache.log4j.Logger
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         Truncated. see log file for complete stacktrace
    >
    [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application Dolores on DefaultServer.: Exception preparing module: EJBModule(Dolores-MessageBeans-ejb)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    null..
    weblogic.application.ModuleException: Exception preparing module: EJBModule(Dolores-MessageBeans-ejb)
    [EJB:011023]An error occurred while reading the deployment descriptor. The error was:
    null.
    ####  Deployment incomplete.  ####    Aug 5, 2009 12:54:44 PM
    oracle.jdeveloper.deploy.DeployException
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:247)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.deployImpl(Jsr88RemoteDeployer.java:157)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
         at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
         at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:436)
         at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
         at oracle.jdevimpl.runner.adrs.AdrsStarter$5$1.run(AdrsStarter.java:1365)
    Caused by: oracle.jdeveloper.deploy.DeployException
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.deployApplication(Jsr88DeploymentHelper.java:413)
         at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.doDeploymentAction(Jsr88RemoteDeployer.java:238)
         ... 11 more
    Caused by: oracle.jdeveloper.deploy.DeployException: Deployment Failed
         at oracle.jdevimpl.deploy.common.Jsr88DeploymentHelper.deployApplication(Jsr88DeploymentHelper.java:395)
         ... 12 more
    #### Cannot run application Dolores due to error deploying to DefaultServer.
    [Application Dolores stopped and undeployed from Server Instance DefaultServer]Thanks in advance!
    Greetings,
    Eelse
    Edited by: Eelse on Aug 5, 2009 1:57 PM
    Edited by: Eelse on Aug 5, 2009 5:39 PM

    Creating a new deployment profile (EAR) and including the original deployment (JAR) and the needed libraries (in a lib-directory) solved the problem.

Maybe you are looking for