please help urgent! Exception occurred when a method of a r
wlwa4us Jun 23, 2004 6:17 PMHello,
Any help or suggestion is greatly appreciated.
I have a remote interface called UserControllerRemoteHome that contains a method named validateUserPassword that return a java Serializable object. The client is a Servlet that deployed in a standalone Tomcat version 4.1.30. The Tomcat is running in the same server as Jboss 3.2.1. The servlet accesses the remote ejb with the following code:
UserControllerRemoteHome homeObject; String remoteJndiName = "UserControllerBeanJNDI"; homeObject = (UserControllerRemoteHome) homesFactory.lookUpHome(remoteJndiName, UserControllerRemoteHome.class); // get the EJBObject, UserControllerRemote UserControllerRemote ejbObject = homeObject.create(); // Now problem so far up to this point, but an Exception occurred when // the validateUserPassword method returned a java serializable object BasicUserInformationDO, // however; when the validateUserPassword returned null then no exception occurred. // The log file producted by jboss server.log does not show any exception at all BasicUserInformationDO basicUserInfoDO = null; try { basicUserInfoDO = (BasicUserInformationDO) ejbObject.validateUserPassword( Integer.parseInt(userID), Short.parseShort(subID), password, sessionID); } catch (IOException ioEx) { request.getSession().getServletContext().log("IOException", new Throwable(ioEx.toString())); } catch (ServletException servletEx) { request.getSession().getServletContext().log("Servlet Exception", new Throwable(servletEx.toString())); } } catch (RemoteException remoteEx) { request.getSession().getServletContext().log("Remote Exception", new Throwable(remoteEx.toString())); } catch (CreateException createEx) { request.getSession().getServletContext().log("create Exception", new Throwable(createEx.toString())); } catch (IOException ioEx) { request.getSession().getServletContext().log("IOException", new Throwable(ioEx.toString())); } catch (Exception Ex) { request.getSession().getServletContext().log("Exception", new Throwable(Ex.toString())); }
****** Here is the method that returns the serializable object ********
public BasicUserInformationDO validateUserPassword(int userID, short subID, String password, String sessioID) { BasicUserInformationDO basicUserInfoDO = null; // To valid the password we need to access the UserBean (ejb-name). However, we also // to return the BasicUserInformationDO object, thus we need to access the // UserAccountBean (ejb-name). So we need toltal of two references to fulfill this // mission. // Get a UserBean's home object from the EJBLocalHomeFactory try { // get an instance of the UserEjbUtil UserEjbUtil userBeanUtil = UserEjbUtil.getInstance(); // get the EJBObject, UserLocal UserLocal userObject = userBeanUtil.getUser(StringUtilities.getPrimaryKey(userID, subID)); if (userObject != null) { // Now we check the password from the user input against the password from the database // get the EJBObject, UserAccountLocal UserAccountEjbUtil userAccountBeanUtil = UserAccountEjbUtil.getInstance(); UserAccountLocal userAccountObject = userAccountBeanUtil.getUserAccount( StringUtilities.getPrimaryKey(userID, subID)); if (userAccountObject != null) { // Now get the serviceTypesSubscribed and numberOfServicesSubscribed from the UserAccountBean basicUserInfoDO = new BasicUserInformationDO(userObject.getFirstName(), userObject.getLastName(), userObject.getMiddleName(), userID, subID, userAccountObject.getNumberOfServicesSubscribed(), userAccountObject.getServiceTypesSubscribed()); if (log.isDebugEnabled()) { log.debug(basicUserInfoDO.toString()); } }//End if userAccountObject }//End if }//End if userObject } catch (IOException ioEx) { log.debug("IOException" + ExPrintingUtilities.PrintStackTraceElements(ioEx.getStackTrace())); } catch (Exception Ex) { log.debug("Exception" + ExPrintingUtilities.PrintStackTraceElements(Ex.getStackTrace())); } catch (Throwable throwableEx) { log.debug("Throwable" + ExPrintingUtilities.PrintStackTraceElements(throwableEx.getStackTrace())); } if (log.isDebugEnabled()) { log.debug("End validateUserPassword"); } return basicUserInfoDO; } /* End validateUserPassword method */
Thank you in advance for your help.
Kam