Red Hat Application Migration Toolkit
package com.acme.anvil; import com.acme.anvil.service.ItemLookupLocal; import com.acme.anvil.service.ItemLookupLocalHome; import java.io.IOException; import javax.ejb.CreateException; import javax.ejb.EJBException; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; public class AnvilWebServlet extends HttpServlet { private static final Logger LOG = Logger.getLogger(AnvilWebServlet.class); protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { InitialContext ic = new InitialContext(); ItemLookupLocalHome lh = (ItemLookupLocalHome)ic.lookup("ejb/ItemLookupLocal"); ItemLookupLocal local = lh.create(); String itemId = req.getParameter("id"); if (StringUtils.isNotBlank(itemId)) { Long id = Long.parseLong(itemId); local.lookupItem(id.longValue()); } } catch (EJBException var8) { LOG.error("Exception creating EJB.", var8); } catch (CreateException var9) { LOG.error("Exception creating EJB.", var9); } catch (NamingException var10) { LOG.error("Exception looking up EJB LocalHome.", var10); } } }