10 Replies Latest reply on Aug 4, 2005 9:34 AM by Scorpio

    EJB Create on MDB

    Scorpio Newbie

      I am trying to deploy an MDB that implements my JCA's interface. Its keep complaining about EJB Create Method.

      14:45:43,131 WARN [verifier] EJB spec violation:
      Bean : EchoXMLMDB
      Method : public void ejbCreate() throws CreateException
      Section: 15.7.3
      Warning: The ejbCreate() method must define no application exceptions.


      I have no application exception defined in my ejbCreate method, it doesn't work if I have or don't have throws createException in the method clause. Any Idea ?, any help would be greatly appreciated.

      Thanks

      Nandhu

        • 1. Re: EJB Create on MDB
          Darran Lofthouse Master

          The ejbCreate method of a message driven bean is not allowed to throw the CreateException.

          The error message you have posted is because you have deployed a message driven bean that is declared as throwing the CreateException from the ejbCreate method.

          What message is displayed if you deploy your message driven bean when the CreateException is removed?

          If it is the same message have you double checked that the jar is being recreated correctly?

          • 3. Re: EJB Create on MDB
            Scorpio Newbie

            I did change my method without throwing createException , still same result. Is there anything to do with Spec 2.1 ?

            • 4. Re: EJB Create on MDB
              Scorpio Newbie

              All
              Here is the code snippet


              package com.birch.mdb;

              import java.io.ByteArrayOutputStream;

              import javax.ejb.EJBException;
              import javax.ejb.MessageDrivenBean;
              import javax.ejb.MessageDrivenContext;
              import javax.jms.Message;
              import javax.jms.MessageListener;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;

              import org.jboss.logging.Logger;
              import org.w3c.dom.Document;

              import com.birch.adapters.file.XMLMessageListener;

              import javax.ejb.CreateException;


              public class EchoXMLMessageListener implements MessageDrivenBean,XMLMessageListener
              {


              private static final Logger log = Logger.getLogger(EchoXMLMessageListener.class);

              private MessageDrivenContext ctx;

              private Transformer transformer;

              public EchoXMLMessageListener()
              {


              }

              public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
              {
              this.ctx = ctx;

              }

              public void ejbRemove() throws EJBException
              {

              }

              public void processXML(Document document) throws Exception
              {
              TransformerFactory tf = TransformerFactory.newInstance();
              try
              {
              transformer = tf.newTransformer();
              } catch (Exception e)
              {
              log.error("Exception Occured in Create",e);
              throw e;
              }

              DOMSource source = new DOMSource(document);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              StreamResult result = new StreamResult(baos);
              transformer.transform(source, result);
              log.info(baos.toString());
              }

              /**
              * Default create method
              *
              */
              public void ejbCreate()
              {

              }

              }

              • 5. Re: EJB Create on MDB
                Ulf Schroeter Novice

                Post your ejbCreate() source code

                Regards
                Ulf

                • 6. Re: EJB Create on MDB
                  Ulf Schroeter Novice

                  Drop last post (realized posted source a little bit too late)

                  • 7. Re: EJB Create on MDB
                    jaikiran pai Master

                    Try out the following:

                    /**
                     *
                     * @throws EJBException
                     */
                     public void ejbCreate() throws EJBException {
                    
                     }


                    • 8. Re: EJB Create on MDB
                      Scorpio Newbie

                      Still the same problem...

                      • 9. Re: EJB Create on MDB
                        jaikiran pai Master

                        Hi,
                        I think the probelm may be because of some jar file present in the classpath, which contains your old .class file of the MDB. Delete the .class file of the MDB from your jar file and restart the jboss. If you get the same exception, then there is a wrong .class file in your classpath for this MDB.

                        • 10. Re: EJB Create on MDB
                          Scorpio Newbie

                          That worked , thanks a lot.