1 Reply Latest reply on Mar 12, 2002 4:11 PM by k_khan

    BMP remove nullpointerexception in Proxy

    k_khan

      Hi,

      I am getting a pretty weird problem using BMP and remove. The bean interfaces with Tamino XML database via a DAO, but don't think this is the problem it seems more to be to do with JBoss. Basically, the problem is I've got a client calling a session facade that in turn calls remove() on a BMP entity bean. The remove itself works fine, but I get a NullPointerException somewhere in the "Proxy" that wraps the facade when it is returning to the client. I really cannot see what might be wrong.

      My bean is called MasterGroupBean and its remove method is as follows:

      /** Removes the document corresponding to this entity from the database
      */
      public void ejbRemove()
      {
      LOGCAT.debug("ejbRemove()");

      try
      {
      MasterGroupDAO dao = getDAO();
      MasterGroupValue masterGroup = new MasterGroupValue(m_xmlDocument);
      masterGroup.setDateDeleted();
      //As you might notice I'm not actually deleting the record from the database,
      // just marking it as deleted and doing an update

      dao.store( masterGroup.getDocument() );
      cleanup(); //This closes any open connections to the database
      }
      catch(DAOSysException e)
      {
      throw new EJBException( e.getMessage());
      }
      LOGCAT.debug("ejbRemove() - END");
      }


      The client calls this bean via a session facade, called ManageProductFacadeBean, the code in question is:

      /** Removes a document from the database
      * @param adminLoginInfo The AdminLoginID of the logged-in administrator who owns the document
      * @param lMasterGroupID The id of the master group we want to delete
      * @throws InvalidPermissionException If the AdminLogin does not have sufficient permissions to
      * manage MasterGroups, or the MasterGroup does not belong to the AdminLogin
      */
      public void deleteMasterGroup( AdminLoginInfo adminLoginInfo, long lMasterGroupID) throws InvalidPermissionException
      {
      try
      {
      //+ Check that the adminLoginInfo can maintain master groups!

      MasterGroupLocalHome masterGroupHome = EJBUtil.getMasterGroupLocalHome();

      //Attempt to update an existing entity
      MasterGroupLocal masterGroup = masterGroupHome.findByPrimaryKey( new MasterGroupPK( lMasterGroupID ) );

      //Check that the Document belongs to the adminLoginCompany
      if ( masterGroup.getAdminCompanyID() != adminLoginInfo.getAdminCompanyID() )
      {
      String sErr = "The MasterGroup " + lMasterGroupID + " does not belong to the AdminCompany " + adminLoginInfo.getAdminCompanyID();
      LOGCAT.warn( sErr );
      throw new InvalidPermissionException( sErr );
      }

      LOGCAT.debug("Remove");
      masterGroup.remove();
      masterGroup = null; //I get the same error without setting this to null
      LOGCAT.debug("removed");
      }
      catch(FinderException e)
      {
      //Couldn't find the MasterGroup we want to remove, which is fine
      }
      catch(javax.ejb.RemoveException e)
      {
      throw new EJBException(e.getMessage());
      }
      catch(javax.naming.NamingException e)
      {
      throw new EJBException(e.getMessage());
      }
      }

      The client code (ManageProductsAction) is as follows:

      ManageProductFacadeHome manProductFacadeHome = EJBUtil.getManageProductFacadeHome();
      ManageProductFacade manProductFacade = manProductFacadeHome.create();
      LOGCAT.debug("Calling remove");
      manProductFacade.deleteMasterGroup( adminLoginInfo, lMasterGroupID);
      LOGCAT.debug("Called remove");

      The output of my log is as follows:
      [DEBUG,ManageProductsAction] deleteMasterGroup
      [DEBUG,ManageProductsAction] Calling remove
      [DEBUG,ManageProductFacadeBean] Remove
      [DEBUG,MasterGroupBean] ejbStore()
      [DEBUG,MasterGroupBean] ejbStore() - END
      [DEBUG,MasterGroupBean] ejbRemove()
      [DEBUG,MasterGroupBean] ejbRemove() - END
      [DEBUG,ManageProductFacadeBean] removed
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] ENTER: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [DEBUG,Log4jLogger] LEAVE: com.softwareag.common.instrumentation.logging.Log4jLogger:readLogStatus
      [ERROR,ManageProductsAction] class java.lang.NullPointerException:null
      java.lang.NullPointerException
      at $Proxy258.deleteMasterGroup(Unknown Source)
      at com.exhibitormanual.web.product.ManageProductsAction.deleteMasterGroup(Unknown Source)
      at com.exhibitormanual.web.product.ManageProductsAction.perform(Unknown Source)
      at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      :
      :
      [DEBUG,ManageProductsAction] saveMasterGroup() - returning:ActionForward[error]