How to handle errors during ejbCreate - Weblogic

This is a discussion on How to handle errors during ejbCreate - Weblogic ; I have a message bean that could not get a reference to another bean in the ejbCreate and it was throwing an error. Weblogic 8.0 kept trying to initialize the bean over and over again. At the end it generated ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How to handle errors during ejbCreate

  1. How to handle errors during ejbCreate


    I have a message bean that could not get a reference to another bean in the ejbCreate
    and it was throwing an error.
    Weblogic 8.0 kept trying to initialize the bean over and over again. At the end
    it generated tons of logs and crashed our cluster.

    What is the right way to handle exceptions and to let the application server know
    that an error has occured ?

    Here is the current code that I have :

    public void ejbCreate()
    {
    log.debug("Creating new bean");

    sourceSelect = new SourceSelector();
    InitialContext ctx = null;

    try {
    ctx = new InitialContext ();
    PricingFeedHome home = (PricingFeedHome) ctx.lookup("cps.ejb.PricingFeed");
    pricingBean = home.create();
    log.debug("pricingFeedBean was created successfully");
    }
    catch (Exception e)
    {
    log.error("Error while creating the PricingService:" +e); e.printStackTrace();
    throw new EJBException(e);
    }
    finally { if (ctx!= null) {try {ctx.close();} catch(Exception e){;} }}




    Thanks a lot for the help

  2. Re: How to handle errors during ejbCreate

    I would suggest configuring a redelivery limit as well as an error queue
    on your JMS destination.

    Finally, I'd recommend that you use ejb-links. That would have allowed
    WLS to detect this at deploy-time (or even when you ran appc) rather
    than waiting until runtime.

    -- Rob

    Farez Alibay wrote:
    > I have a message bean that could not get a reference to another bean in the ejbCreate
    > and it was throwing an error.
    > Weblogic 8.0 kept trying to initialize the bean over and over again. At the end
    > it generated tons of logs and crashed our cluster.
    >
    > What is the right way to handle exceptions and to let the application server know
    > that an error has occured ?
    >
    > Here is the current code that I have :
    >
    > public void ejbCreate()
    > {
    > log.debug("Creating new bean");
    >
    > sourceSelect = new SourceSelector();
    > InitialContext ctx = null;
    >
    > try {
    > ctx = new InitialContext ();
    > PricingFeedHome home = (PricingFeedHome) ctx.lookup("cps.ejb.PricingFeed");
    > pricingBean = home.create();
    > log.debug("pricingFeedBean was created successfully");
    > }
    > catch (Exception e)
    > {
    > log.error("Error while creating the PricingService:" +e); e.printStackTrace();
    > throw new EJBException(e);
    > }
    > finally { if (ctx!= null) {try {ctx.close();} catch(Exception e){;} }}
    >
    >
    >
    >
    > Thanks a lot for the help



+ Reply to Thread