0 Replies Latest reply on Jul 27, 2007 9:14 PM by christian revilla

    ERROR [[action]] Servlet.service() for servlet action threw

    christian revilla Newbie

      The problem is --->operacionesRHRemoto = (OperacionesRHRemoto) context.lookup("RHumanosEAR/"+OperacionesRH.RemoteJNDIName);
      session.setAttribute("operacion", operacionesRHRemoto);
      the problem is:
      -when i use a stateful bean that call a class DispatchAction it doesnt work,
      -when I use an ActionClass it doesnt work, it works fine,
      -when I call the stateful using a simple class it works too,
      Maybe I need to use a library, Idont know ... please help me.

      ************************
      package de.struts.action;

      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import javax.servlet.http.HttpSession;

      import org.apache.struts.action.Action;
      import org.apache.struts.action.ActionForm;
      import org.apache.struts.action.ActionForward;
      import org.apache.struts.action.ActionMapping;

      import op.facade.*;

      import java.util.Properties;
      import org.apache.struts.action.*;
      import org.apache.struts.actions.DispatchAction;
      import de.facade.*;
      import em.facade.*;
      import de.Common;
      import op.facade.*;

      /**
      * MyEclipse Struts Creation date: 03-15-2006
      *
      * XDoclet definition:
      *
      * @struts.action parameter="action"
      * @struts.action-forward name="success" path="/jsp/operacion.jsp"
      */

      public class ManejarOperacionAction extends DispatchAction {
      // --------------------------------------------------------- Instance
      // Variables

      // --------------------------------------------------------- Methods

      public ActionForward anadiraOperacion(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response) {
      HttpSession session = request.getSession();
      //ActionMessages actionMessages = new ActionMessages();
      ActionErrors actionMessages = new ActionErrors();
      System.out.println("Esta ingresando a anadiraOperacion");
      EmpBeanRemoto empBeanRemote;
      // first try to get an existing cart from the current session
      OperacionesRHRemoto operacionesRHRemoto = (OperacionesRHRemoto) session.getAttribute("operacion");
      // when there is no cart create a new one and save it in the session
      if (operacionesRHRemoto == null)
      { /*
      Properties properties = new Properties();
      properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
      properties.put("java.naming.provider.url","localhost:1099");
      */
      try
      {
      Context context = new InitialContext();
      operacionesRHRemoto = (OperacionesRHRemoto) context.lookup("RHumanosEAR/"+OperacionesRH.RemoteJNDIName);
      session.setAttribute("operacion", operacionesRHRemoto);
      } catch (NamingException e)
      {
      e.printStackTrace();
      throw new RuntimeException("Error de naming exception"+e.getMessage());
      }
      }
      String sId = request.getParameter("eid");
      System.out.println("manejaroperacion.anadiraoperacion--el empleado escogido es->:"+sId);
      if (sId == null)
      {
      actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
      new ActionMessage("error.param.noentry"));
      } else
      {
      Integer id = Integer.parseInt(sId);
      operacionesRHRemoto.asignarDepAEmp(id);
      //cartLocal.addBook(id);
      }
      if (!actionMessages.isEmpty())
      saveErrors(request, actionMessages);
      return mapping.findForward(Common.SELF);
      }

      }
      }
      ************its interfaces *********
      package op.facade;

      import java.util.Map;

      import de.facade.Departamento;
      import em.facade.Empleado;
      import javax.ejb.Remote;

      @Remote
      public interface OperacionesRHRemoto {
      public void asignarDepAEmp(Empleado empleado);
      public void asignarDepAEmp(Integer id);
      public void removerDeDep(Empleado empleado);
      public void removerDeDep(Integer id);
      public void eliminarOperaciones();
      public Map obtenerOperaciones();
      void revisar(Departamento departamento);
      public void retirardeDepartamento(Integer id);
      }

      *********
      package op.facade;
      import em.facade.Empleado;
      import de.facade.Departamento;
      import java.util.*;
      import javax.ejb.Local;
      @Local
      public interface OperacionesRHLocal {
      public void asignarDepAEmp(Empleado empleado);
      public void asignarDepAEmp(Integer id);
      public void removerDeDep(Empleado empleado);
      public void removerDeDep(Integer id);
      public void eliminarOperaciones();
      public Map obtenerOperaciones();
      void revisar(Departamento departamento);
      public void retirardeDepartamento(Integer id);
      }

      /************/

      +- RHumanosEAR (class: org.jnp.interfaces.NamingContext)
      | +- EmpBean (class: org.jnp.interfaces.NamingContext)
      | | +- local (proxy: $Proxy117 implements interface em.facade.EmpBeanLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      | | +- remote (proxy: $Proxy116 implements interface em.facade.EmpBeanRemoto,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
      | +- DepBean (class: org.jnp.interfaces.NamingContext)
      | | +- local (proxy: $Proxy121 implements interface de.facade.DepBeanLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      | | +- remote (proxy: $Proxy120 implements interface de.facade.DepBeanRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
      | +- OperacionesRH (class: org.jnp.interfaces.NamingContext)
      | | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
      | | +- local (class: java.lang.Object)
      | | +- remote (class: java.lang.Object)
      | | +- remoteStatefulProxyFactory (proxy: $Proxy102 implements interface org.jboss.ejb3.ProxyFactory)

      **************************************

      PLEASE HELP ME tell me if I nedd to do some thing more?