1 Reply Latest reply on Aug 10, 2005 10:32 PM by Alan Ho

    Remote Access returns  java.lang.reflect.UndeclaredThrowable

    Alan Ho Newbie

      I am testing remote access with a JSP in one server and session/entity bean in another server. Before adding a record into database, the program perform a find. If it is a new record, the find returns null and the add record was successful. But if a record is already exist, find fails with exception error message "java.lang.reflect.UndeclaredThrowableException". The same program if deployed in the SAME server did not give such problems. Listed below are part of my program. Could the problem cause by the object being passed remotely from one server to the other server where the client program resides????

      AccountMaintenance account = null;
      InitialContext ctx = new InitialContext();
      account = (AccountMaintenance) ctx.lookup(AccountMaintenance.class.getName());

      if ((request.getParameter ("name") != null) && (request.getParameter ("type") != null) &&
      (request.getParameter ("balance") != null)) {
      command = request.getParameter ("action");
      name = request.getParameter ("name");
      type = request.getParameter ("type");
      balance = Double.parseDouble(request.getParameter ("balance"));
      if (command.equals("Add")) {
      try {
      // The find returns exception error if a record already exists
      Account myAccount = account.find(name);
      if (myAccount != null) {
      errormsg = "Account already exists";
      } else {
      account.add(name, type, balance);
      } catch (Exception e) {
      errormsg = e.toString();

      [Session Bean]
      public class AccountMaintenanceBean implements AccountMaintenance {
      private EntityManager manager;

      public void add(String actName, String actType, double actBalance) {
      try {
      Account account = new Account();
      account.add(actName, actType, actBalance);
      catch (Exception e) {

      public Account find(String actName) {
      return manager.find(Account.class, actName);

        • 1. Re: Remote Access returns  java.lang.reflect.UndeclaredThrow
          Alan Ho Newbie

          I have made further testing with changes to the find method in the session bean to return a value of 0 (for record not found) and 1 (for record found) instead of the Account class (null for record not found and not null for record found). The program now works with adding a new record if it is not found and returns an indicator of 1 if record is found. This testing reveals that if an object is returned by remote access from a session bean to a client program residing in another machine, an exception error is thrown. Does anybody encountered this problem before and have a soultion?

          Further more, we may need to retrieve a List Object[] or a collection of objects from a remote client.