/*
 * Copyright 1999 by dreamBean Software,
 * All rights reserved.
 */
package org.jboss.ejb3.test.exception;

import javax.annotation.Resource;
import javax.ejb.Remote;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.logging.Logger;

/**
 * @version <tt>$Revision: 1.3.2.4 $</tt>
 * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
 */
@Stateless
@Remote(Foo2.class)
public class FooBean2 implements Foo2
{
   private static final Logger log = Logger.getLogger(FooBean2.class);

   @Resource
   private SessionContext ctx;

   public void bar() throws FooException2
   {
      try
      {
         InitialContext jndiContext = new InitialContext();
         Foo3 foo3 = (Foo3) jndiContext.lookup(Foo3.class.getName());
         foo3.bar();
      } catch (NamingException e)
      {
         throw new FooException2(e.getMessage());
      } catch (FooException3 e)
      {
         throw new FooException2(e.getMessage());
      } 
   }
}