-
1. Re: EJB Create on MDB
darranl Aug 3, 2005 4:17 PM (in response to nandhu)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? -
2. Re: EJB Create on MDB
adrian.brock Aug 3, 2005 4:27 PM (in response to nandhu)I've sort of added this question to the FAQ:
http://wiki.jboss.org/wiki/Wiki.jsp?page=WhyDoesntCreateExceptionRollbackTheTransaction -
3. Re: EJB Create on MDB
nandhu Aug 3, 2005 4:39 PM (in response to nandhu)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
nandhu Aug 3, 2005 4:44 PM (in response to nandhu)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
schrouf Aug 4, 2005 2:15 AM (in response to nandhu)Post your ejbCreate() source code
Regards
Ulf -
6. Re: EJB Create on MDB
schrouf Aug 4, 2005 2:21 AM (in response to nandhu)Drop last post (realized posted source a little bit too late)
-
7. Re: EJB Create on MDB
jaikiran Aug 4, 2005 2:51 AM (in response to nandhu)Try out the following:
/** * * @throws EJBException */ public void ejbCreate() throws EJBException { }
-
8. Re: EJB Create on MDB
nandhu Aug 4, 2005 7:55 AM (in response to nandhu)Still the same problem...
-
9. Re: EJB Create on MDB
jaikiran Aug 4, 2005 8:21 AM (in response to nandhu)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
nandhu Aug 4, 2005 9:34 AM (in response to nandhu)That worked , thanks a lot.