throw new EJBException("User registration failed (got exception: " +e+")<br>");
throw new RemoteException("User registration failed (got exception: " +e+")<br>");
  public String createUser(String firstname, String lastname, String nickname, String email, String password, String regionName)  {    String html = "";    UserHome uHome;    User user;    RegionHome regionHome;    int regionId;    int userId;    String creationDate;      try       {        // Connecting to  region Home thru JNDI        regionHome = (RegionHome)PortableRemoteObject.narrow(initialContext.lookup("java:comp/env/ejb/Region"), RegionHome.class);      }       catch (Exception e)      {        throw new EJBException("Cannot lookup Region: " +e+"<br>\n");      }      try      {        Region region = regionHome.findByName(regionName);        regionId = region.getId().intValue();      }      catch (Exception e)      {        throw new EJBException(" Region "+regionName+" does not exist in the database!<br>(got exception: " +e+")<br>\n");      }          try       {        uHome = (UserHome)PortableRemoteObject.narrow(initialContext.lookup("java:comp/env/ejb/User"),                                                      UserHome.class);      }       catch (Exception e)      {        throw new EJBException("Cannot lookup User: " +e+"<br>");      }      utx = sessionContext.getUserTransaction();      try      {        user = uHome.findByNickName(nickname);        /* If an exception has not be thrown at this point, it means that           the nickname already exists. */        html = "The nickname you have choosen is already taken by someone else. Please choose a new nickname.<br>";        return html;      }      catch (Exception fe)      {        try        {          utx.begin();          user = uHome.create(firstname, lastname, nickname, email, password, new Integer(regionId));          user = uHome.findByNickName(nickname);          userId = user.getId().intValue();          creationDate = user.getCreationDate();          utx.commit();          html = "User id       :"+userId+"<br>\n";          html = html.concat("Creation date :"+creationDate+"<br>\n");          html = html.concat("Rating        :"+user.getRating()+"<br>\n");          html = html.concat("Balance       :"+user.getBalance()+"<br>\n");        }        catch (Exception e)        {          try          {            utx.rollback();            throw new EJBException("User registration failed (got exception: " +e+")<br>");          }          catch (Exception se)           {            throw new EJBException("Transaction rollback failed: " + e +"<br>");          }        }        return html;      }  }