RemoteException   vs   EJBException

Hi
In EJB 2.0 specification, it is mentioned that the use of java.rmi.RemoteException was deprecated for container-invoked callbacks (like ejbCreate, ejbPassivate, ejbActivate) and must use javax.ejb.EJBException instead.
But when I create a new EJB 2.0 component with java.rmi.RemoteException, build and deployment was successful. Also with javax.ejb.EJBException, build and deployment was successful.
This means can we use either of these exceptions in EJB 2.0....?
Is it not necessary to replace java.rmi.RemoteException with javax.ejb.EJBException ....?
Thanks
Raghu

Maybe deprecation was only introduced in specification but not in implementation, otherwise compilation should have reported a deprecation warning.

Similar Messages

  • Remoteexception and  ejbexception

    I have a stateless session bean method:
    try{
    catch(){
    throw new EJBException()...// here
    I read some article says: either throw EJBException for local or throw RemoteException for remote.
    but my EJB suppose to be used by both local or remote client, how can I throw both EJBException or RemoteException?
    Thanks

    Your EJB should not directly throw RemoteException. First, you need to decide whether the
    condition you encounter is an application exception or a system exception. An application
    exception is a condition from which the client might be able to recover and is considered non-fatal
    by the container. When an application exception is thrown, the client will receive that exact
    exception. An application is a user-defined exception or any other existing exception that is a
    sublcass of java.lang.Exception (except java.rmi.RemoteException)
    With a system exception, the container destroys the bean instance that threw the exception
    and automatically rolls back the current transaction. The way to signify a system exception is by
    throwing EJBException or any runtime exception.
    The container will convert that exception to the appropriate client-side
    exception. In the case of a Local EJB client, the client will receive EJBException. If the client is
    an EJB 2.x Remote client, it will receive RemoteException. If the client is a 3.0 Remote client, it
    will receive EJBException.

  • RemoteException deprecation and EJBException

    Is throwing a RemoteException from remote interfaces a deprecated
    programming practice?
    I've read some articles and newsgroups which stated that.
    If true, since when exactly is this deprecated?
    Remote interfaces implement java.rmi.Remote so they must throw a
    RemoteException, don't they?
    Should I throw EJBException instead of RemoteException?
    Any remarks, explanations would be greatly helpful.

    Exactly.
    The container implementation of your remote interface will throw a
    RemoteException or javax.transaction.TransactionRolledBackException
    (which is an instance of RemoteException) if you throw an EJBException
    from your Bean implementation.
    If instead you use a Local interface, then you should either get the
    EJBException or javax.ejb.TransactionRolledBackLocalException (which is
    an instance of EJBException).
    It's a bit complicated and I might have been unclear myself for which I
    apologize.
    HTH,
    Dejan
    Yonatan Taub wrote:
    I don't quite follow.
    Do you mean that my remote interface class should declare that it throws a
    RemoteException while my bean implementation class
    should not state in its throws clause a RemoteException?
    "Deyan D. Bektchiev" <[email protected]> wrote in message
    news:[email protected]...
    EJB 1.1 Spec deprecates throwing RemoteExceptions from the Bean
    implementations.
    EJBs can still throw it and the container should behave in the same was
    as if an EJBException was thrown.
    The difference is when all this happens if your EJB has a Remote and
    Local interfaces. The local clients (those using the local interface)
    should get the EJB exception that might be wrapped in a
    TransactionRolledBackException to indicate that the current transaction
    was rolled back, while the remote clients should get the EJB exception
    (or any RuntimeException thrown from your EJB implementation) wrapped in
    a RemoteException.
    HTH,
    Dejan
    Yonatan Taub wrote:
    All of this is known to me.
    Since then I read some more material on the subject.
    It seems that throwing a RemoteException from a bean implementation
    class
    is deprecated.
    RemoteException indicates a system exception and the bean implementation
    class should throw an EJBException.
    The container specific implementation would catch this exception and
    throw a
    RemoteException.
    http://groups.google.com/groups?q=ejb+RemoteException+deprecated+ejbexcepti
    on&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=8i5b64%24bk8%241%40newsgroups.bea.com&rn
    um=4
    I would appreciate your thoughts on the subject.

  • Weblogic 6.1sp2 custom exceptions being transformed to remoteexceptions

    Hi,
    We've recently ported our application from weblogic 6.0sp2 to weblogic 6.1sp2.
    In our ejbs we throw custom exceptions in our business logic, but somehow, in
    weblogic6.1sp2, these are being transformed into ejbexception/remoteexceptions.
    Do you have any ideas what we may be doing wrong?
    Thanks

    Thanks,
    we were doing that, but our custom exceptions were inheriting from RuntimeException
    instead of Exception which was the cause of the problem because weblogic 6.1 is
    more strict than weblogic 6.0.
    Diana
    Matthew Shinn <[email protected]> wrote:
    Hi Diana,
    Make sure your custom exceptions are declared in the throws clause of
    the
    home\remote\localHome\local interface methods. If they are not declared
    in the
    throws clause of your interface methods, they will be wrapped in RemoteExceptions
    or EJBExceptions before being thrown to the client.
    - Matt
    Diana wrote:
    Hi,
    We've recently ported our application from weblogic 6.0sp2 to weblogic6.1sp2.
    In our ejbs we throw custom exceptions in our business logic, but somehow,in
    weblogic6.1sp2, these are being transformed into ejbexception/remoteexceptions.
    Do you have any ideas what we may be doing wrong?
    Thanks

  • RE: exception handling

    Wayne,
    When an exception occurs, Forte aborts the inner
    most compound statement, after executing the code
    of an exception handler if there is one. If the excep-
    tion is not handled, it still exists after the compound
    statement was aborted, so Forte now aborts the
    remaining inner most compound statement. This
    continues until Forte reaches the root compound
    statement of the tread (or "task" if you will). This
    one will also be aborted and that is the end of the
    thread (task). If you look at the debugger, you will
    see "RIP" in front of this thread. Sure, this thread
    was spawned by another thread. It was started
    by a "start task" call from within some compound
    statement in the parent thread, but this compound
    statement was probably long since closed. Forte
    can't pass the exception on to a higher level com-
    pound statement, because there is none. If the
    thread started with a method that had a return event
    and an exception event, and you started the task
    with "Completion = event" then Forte will post one
    of these events after the root compound statement
    was finished (in other words, the thread was stopped).
    From this event you can see, if the thread wasfinished succesfully or not.
    Of course, an event is not the same kind of thing
    as an exception. You can't raise events, or post
    exceptions.
    So, when an exception is not handled, only the thread
    where this exception occured is cancelled (including
    all it's child threads). The rest of the treads stay alive.
    -----Original Message-----
    From: Wayne Walker [SMTP:[email protected]]
    Sent: Wednesday 22 July 1998 13:49
    To: '[email protected]'
    Subject: exception handling
    I have a problem in handling exceptions detected in a task. I start a
    task
    which performs some function. I also have an event handler which
    recognizes the method_exception returned should an exception be
    detected.
    Once detected by the event handler I force the exception up to
    another
    process which displays the exception to the user. However, it appears
    that
    forte is intercepting the exception before my event handler can detect
    it
    and posts an exception message. Can anyone explain how this mechanism
    works and the best approach for handling exceptions myself vice Forte?
    Thanks,
    Wayne
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    My understanding is that if your client doesn't care (or cannot handle) the exception,
    you throw your exception WRARPPED with EJBException. This way, the container can
    roll back the transaction properly.
    If your client cares (or have the ability to recover) the exception, you should
    define your own exception. They should not be derived from RuntimeException or
    RemoteException or EJBException. If you want to make sure that the transactions
    are rolled back, you call setRollbackOnly() before you throw the exception.
    Charles
    soraya abbasi <[email protected]> wrote:
    I have tried to make my custom exception subclass RemoteException but
    that doesn't work.
    Does that mean to say you can't have custom exceptions thrown to a client?

  • Error during deployment writing deployemnt cache

    I get this error every time I try to deploy from JDeveloper to oc4j. Only shutdown and redeploy works.
    Error instantiating compiler: IO error writing cache: D:\oc4j\j2ee\home\applic
    ation-deployments\App\Appejb.jar\deployment.cache
    It might have something to do with EJB being in memory? Any better ideas on how to deal with this?
    Thank you,
    Mark Komosa

    Hi!
    I had the same problem too. But not using JDeveloper, but the deploy-tool/command line option. It is probably the same thing almos I guess. The problem is that oc4j doesn't really give you any information about what is really wrong during deployment. I too tried to just shut it down and do a restart. That seemed to help some times. The generation of wrapper classes and their compilation is nowhere near stable. I got a really interesting error because I had a variable named "dirty" in one of my beans. It seemed like oc4j generated a wrapper containing a variable with the same name (sic!) and this caused a compilation error when this variable was initialiazed in some point of their code... Renaming my variable "solved" the problem.
    Also try the auto-deploy mechanism. This might work better for you.
    If you are using local interfaces, be sure that your bean implementation does not have any methods which declare or use RemoteException. This might be stupid to point out, but I have used the same bean implementation for both remote and local interfaces in Jboss, forgetting to remove these declarations from the bean implementation (I never actually throw RemoteExceptions, just EJBExceptions), and their wrapper classes do not care about this. Of course the exceptions shouldn't be there but this caused errors for me and maybe someone else is suffering from this unknowingly.
    All in all, I can now deploy to 9.0.3 Developers' Preview with not very much hassle (just the deployment being awfully slow and memory consuming). Of course, now I have downloaded the 9.0.3 "Production" release and now I am getting new errors using the same ear-file which works fine in DR... it makes you a little bit irritated to say the least.
    Regards,
    Jonas Bergqvist

  • EJBException instead of RemoteException???

    Hi, everybody!
    Does someone knows wyh my 9ias on Unix throws, from remote calls on EJBs, a javax.EJBException instead of a RemoteException??
    The Specs says that the container will wrap the EJBException in a RemoteException.
    This happens on the stand alone OC4J installation, but not on the Enterprise Application Server (same 9.0.3 version, same ear deployed).
    Where am I wrong?
    Thanks

    Hi, everybody!
    Does someone knows wyh my 9ias on Unix throws, from remote calls on EJBs, a javax.EJBException instead of a RemoteException??
    The Specs says that the container will wrap the EJBException in a RemoteException.
    This happens on the stand alone OC4J installation, but not on the Enterprise Application Server (same 9.0.3 version, same ear deployed).
    Where am I wrong?
    Thanks

  • Javax.ejb.EJBException: nested exception is: java.rmi.RemoteException:

    package library.client;
    import javax.naming.InitialContext;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.reflect.Method;
    import java.sql.ResultSet;
    import javax.ejb.*;
    import javax.naming.*;
    import javax.swing.*;
    import library.common.*;
    @SuppressWarnings("serial")
    public class LibraryClient extends JFrame implements ActionListener {
      private static LibraryInterface li;
      private JTextField book_author = new JTextField(10);
      private JTextField book_title = new JTextField(10);
      private JTextField book_isbn = new JTextField(10);
      private JLabel author_label = new JLabel("Podaj autora:");
      private JLabel book_title_label = new JLabel("Podaj tytul ksiazki");
      private JLabel isbn_label = new JLabel("Podaj ISBN");
      private JTextArea display_books = new JTextArea(20,50);
      private JButton search = new JButton("Search");
      private ResultSet resultset;
      public LibraryClient() {
        this("DEFAULT_CONTEXT");
    private JPanel createPanel1(){
          JPanel panel = new JPanel();
          panel.add(author_label);
          panel.add(book_author);
          panel.add(book_title_label);
          panel.add(book_title);
          panel.add(isbn_label);
          panel.add(book_isbn);
          panel.add(search);
          ////search.setActionCommand("ISBN");
          search.addActionListener(this);
          return panel;
    private JPanel createPanel2(){
          JPanel panel = new JPanel();
          panel.add(display_books);
          return panel;
    private JPanel createPanels(){
         JPanel panel = new JPanel();
        //Use default FlowLayout.
        panel.setLayout(new BorderLayout());
        panel.add(createPanel1(), BorderLayout.NORTH);
        panel.add(createPanel2(), BorderLayout.SOUTH);
        return panel;
      public  LibraryClient(String appType) {
        init(appType);
        JFrame frame = new JFrame("Library");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //    /final Table table = new Table();
        frame.setContentPane(createPanels());
        frame.pack();
    //    /f.setLocationRelativeTo(null);
        frame.setVisible(true);
      public void actionPerformed(ActionEvent e) {
             try {
                  display_books.setText("");
                  display_books.setText("Wyszukane Ksiazki\n");
                  if(!book_author.getText().equals("")){
                       resultset=li.getBookByAuthor(book_author.getText());
                  }else if(!book_title.getText().equals("")){
                       resultset=li.getBookByName(book_title.getText());
                  }else if(!book_isbn.getText().equals("")){
                       resultset=li.getBookByISBN(book_isbn.getText());
                  }else {
                       System.out.println("Before->resultset=li.getAllBooks()");
                       resultset=li.getAllBooks();
                       System.out.println("After->resultset=li.getAllBooks()");
                  while(resultset.next()){
                       System.out.println("in while resultset.next()"); 
                       String name = resultset.getString("name");
                         String author =resultset.getString("author");
                         String isbn = resultset.getString("ISBN");
                         display_books.append("\n"+ name + " " + author +" "+ isbn);
             } catch(Exception exc) { exc.printStackTrace(); }
      private void init(String type) {
        if (type.equals("JAVA_APP")) li = new library.ejb.LibraryBean();
        else if (type.equals("JAVA_CLIENT")) {
          try {
            InitialContext ic = new InitialContext();
            li = (LibraryInterface) ic.lookup("library.common.LibraryInterface");
          } catch (NamingException e) {
            e.printStackTrace();
      public static void main(String[] args) {
        if (args.length >= 1) new LibraryClient(args[0]);
        else new LibraryClient();
    }it throws the exception when it gets to
    any of the functions
    resultset=li.getBookByAuthor(book_author.getText());
    resultset=li.getBookByName(book_title.getText());
    resultset=li.getBookByISBN(book_isbn.getText());
    resultset=li.getAllBooks();
    Please help
    Thank You

    Hi,
    I also get the same error.have you got the solution,fi so explain me how to rectify the error
    Regards
    SamyMohan

  • Throwing EJBException causing mulitple retries

    hi all,
    I have a strange problem with a entity beans that fail in a ejbStore.
    I have a session bean calling a BMP entity bean. On failure ( inserted value too large for column) the ejbStore throws a EJBException.
    public void ejbStore()
    throws RemoteException
    _logger.received( "ejbStore" );
    try
    ClientDAO dao = ClientDAOFactory.getDAO();
    dao.update( getRow(), getId() );
    _logger.debug( "ejbStore", getRow() );   
    catch( ClientDAOSysException e)
    _logger.error( "ejbStore", e );
    throw new EJBException( e.getMessage() );
    catch( ApplicationException e)
    _logger.error( "ejbStore", e );
    throw new EJBException( e.getMessage() );
    _logger.returned( "ejbStore", "complete" );
    What follows is very weird. From the logs it seems that a sessionBean.store() method is called another three times before finally an exception is thrown all the way back to the client.
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error preparing bean instance: com.evermind.transaction.MarshallingXAException; nested exception is:
    com.evermind.transaction.MarshallingXAException
    My code only calls the sessionBean.store() once.
    Why are 3 further attempts made? From my understanding the SessionBean should be managing the transaction and should be able either rollback or something else. This is not the case.
    any help is appreciated
    -lp

    Lucio,
    This question has been previously discussed on this forum.
    I don't remember all the details (and I'm too lazy to search
    the forum archives for you), but in a post from Jeffrey Schaefer
    (I'm not sure I'm spelling his name right), it states that
    there is a "max-tx-retries" attribute in the "orion-ejb-jar.xml"
    file whose default value is "3" -- and that's why your "ejbStore()"
    method is getting called three times (if I remember correctly).
    Please check the above information, as I am only going from
    memory.
    Good Luck,
    Avi.

  • BMP question : got javax.ejb.EJBException error Object state not saved

    Could anybody please help me? I could not figure out what i did wrong.
    I got the javax.ejb.EJBException error: Object state not saved
    when i test the getname() method for findByPrimaryKey() and findAll() methods.
    Here is my code:
    package org.school.idxc;
    import javax.sql.*;
    import javax.naming.*;
    import javax.ejb.*;
    import javax.sql.*;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Enumeration;
    import java.util.Vector;
    * Bean implementation class for Enterprise Bean: status
    public class statusBean implements javax.ejb.EntityBean {
         private javax.ejb.EntityContext myEntityCtx;
         private int id;
         private String name;
         private DataSource ds;
         private String dbname = "jdbc/idxc";
         private Connection con;
         * ejbActivate
    public void ejbActivate() {
         * ejbLoad
         public void ejbLoad() {
         System.out.println("Entering EJBLoad");
         try
         Integer primaryKey = (Integer) myEntityCtx.getPrimaryKey();
         String sqlstmt = "select id, name from from status where id =?";
         con = ds.getConnection();
         PreparedStatement stmt = con.prepareStatement(sqlstmt);
         stmt.setInt (1,primaryKey.intValue());
         ResultSet rs = stmt.executeQuery();
         if (rs.next())
              this.id = rs.getInt(1);
              this.name = rs.getString (2).trim();
              stmt.close();
         } // if
         else
              stmt.close();
              throw new NoSuchEntityException ("Invalid id " + id);
         }// else
              } // try
         catch (SQLException e)
         System.out.println("EJBLOad : " + e.getMessage());
              } // catch
         finally
         try
              if (con != null)
              con.close();
              }// try
         catch (SQLException e)
              System.out.println("EJBLOad finally" + e.getMessage());
              } // catch
              }// finally
         * ejbPassivate
         public void ejbPassivate() {
         * ejbRemove
         public void ejbRemove() throws javax.ejb.RemoveException {
         System.out.println ("Entering ejb Removed");
         try
         String sqlstmt = "delete from status where id=" + id;
         con = ds.getConnection();
         Statement stmt = con.createStatement();
         stmt.executeUpdate(sqlstmt);
         stmt.close();
         }// try
         catch (SQLException e)
         System.out.println("Ejb Remove" + e.getMessage());     
         } // catch
         finally
         try
              if (con!=null)
                   con.close();
         }// try
         catch (SQLException e)
              System.out.println ("EJBRemoved " + e.getMessage());
         } // catch
         } // finally
         * ejbStore
         public void ejbStore() {
         System.out.println("Entering the ejbStore");
         try
    String sqlstmt = "update status set id=" + id + ",name='" + name + "' where id=" + id;
         con = ds.getConnection();
         Statement stmt = con.createStatement();
         if (stmt.executeUpdate(sqlstmt) != 1)
              throw new EJBException ("Object state not saved");
    stmt.close();     
         } // try
         catch (SQLException e)
              System.out.println ("EJBStore : " + e.getMessage());
         }// catch
         finally
         try
              if (con != null)
              con.close();
         } // try
         catch(SQLException e)
              System.out.println ("EJBStore finally " + e.getMessage());
         } // catch
         } // finally
         * getEntityContext
         public javax.ejb.EntityContext getEntityContext() {
              return myEntityCtx;
         * setEntityContext
         public void setEntityContext(javax.ejb.EntityContext ctx) {
              myEntityCtx = ctx;
              try
              InitialContext initial = new InitialContext();
              ds = (DataSource)initial.lookup(dbname);
    } // try
              catch (NamingException e)
              throw new EJBException ("set Entity context : Invalid database");     
              }// catch
         * unsetEntityContext
         public void unsetEntityContext() {
              myEntityCtx = null;
         * ejbCreate
         public Integer ejbCreate(Integer key, String name) throws javax.ejb.CreateException {
    this.id = key.intValue();
    this.name = name;
              System.out.println ("Entering ejbCreated!!!");
              try
              String sqlstmt = "insert into status(id,name) values (" + id + ",'" + (name == null ? "" : name) + "')";
              con = ds.getConnection();
              Statement stmt = con.createStatement();
              stmt.executeUpdate(sqlstmt);
              stmt.close();
              }// try
              catch (SQLException e)
              System.out.println("EJBCreate : SQLEXception ");     
              }// catch
              finally
              try
              if (con!=null)
                   con.close();
              }// try
              catch (SQLException e)
              System.out.println ("EJB Created Finally : SQLException");
              e.getMessage();
              } // catch
              }// finally
              this.id = key.intValue();
              this.name = name;
              return key ;
         * ejbPostCreate
         public void ejbPostCreate(Integer id, String name) throws javax.ejb.CreateException {
         * ejbFindByPrimaryKey
         public Integer ejbFindByPrimaryKey(
              Integer key) throws javax.ejb.FinderException {
              try
              String sqlstmt = "select id from status where id=" + key.intValue();
              con = ds.getConnection();
              Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(sqlstmt);
              if (!rs.next())
              throw new ObjectNotFoundException();     
              } // if
              rs.close();
              stmt.close();
              } // try
              catch (SQLException e)
              System.out.println ("EJBFindBYPrimaryKey " + e.getMessage());     
              } // catch
              finally
              try
              if (con!=null)
                   con.close();
              }// try
              catch (SQLException e)
              System.out.println ("EJB Find by primary key" + e.getMessage());
              }// catch
              }// finally
              return key;
         * @return Returns the name.
         public String getName() {
              return this.name;
         * @return Returns id
         public int getId() {
              return this.id;
         * @param name The name to set.
         public void setName(String xname) {
              this.name = xname;
         * ejbFindByLastnameContaining
         public Enumeration ejbFindAllNamne () throws javax.ejb.FinderException
         try
         String sqlstmt = "select id from status order by id";
         con = ds.getConnection();
         Statement s = con.createStatement();
         ResultSet rs = s.executeQuery(sqlstmt);
         Vector keys = new Vector();
         while (rs.next())
              keys.add(new Integer(rs.getInt(1)));
         }// while
         rs.close();
         s.close();
         con.close();
         return keys.elements();
         } // try
         catch (SQLException e)
              throw new FinderException (e.toString());
         } // catch
    }

    Hi,
    if you look at your error message you will see the problem. In your code you've missed to implement
    public void ejbPassivate {}
    so your code looks like this
    import java.lang.Object;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import java.rmi.RemoteException;
    import java.lang.Math;
    import java.util.Random;
    import java.io.*;
    /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */
    public class DiceEJB implements SessionBean, Serializable
         public int[] Roll()
              Random rng = new Random();
              int[] diceArray = new int[5];
              for(int i =0; i < diceArray.length;i++)
                   diceArray[i] = (Math.abs (rng.nextInt()) % 6) +1;
              return diceArray;
         public DiceEJB(){}
         public void ejbCreate() {}
         public void ejbRemove() {}
         public void ejbActivate() {}
         public void ejbPassivate() {}
         public void setSessionContext (SessionContext sc)
         private void writeObject(ObjectOutputStream oos) throws IOException
              oos.defaultWriteObject();
         private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
              ois.defaultReadObject();
    bye

  • Good old EJBException question...

    I've trawled through this forum for a good explanation of EJBException versus RemoteException. I've not found anything I consider particularly intuitive. In fact, I've been amazed by some of the confusion that seems to exist about this, with some people responding with answers that are simply wrong.
    So, for my own enlightenment and hopefully the other people who've asked this question - could someone please give an explanation of when to throw an EJBException, when to throw a RemoteException (if ever) and when to throw another type of Exception?
    I'm also interested in what the client is guaranteed to receive in each of these cases and what effect this has on the bean that has thrown it.
    And just to keep things good and simple could they try to do it without mentioning "the specification"? I have read the specification but would like to know how it manifests itself in the real world and what is considered "good practice" in this matter.
    Many thanks in advance.

    hey kevin, you causing problems again!
    you've probably seen this article by now on EJBExcepitons at the serverside.com but here is the link anyway:
    http://www-106.ibm.com/developerworks/java/library/j-ejbexcept.html
    EJB exceptions are mine field but there are a couple solid guidelines that i follow when designing my beans with exceptions:
    1. Application Exceptions ( not descendants of RuntimeException or RemoteException ) are passed back to the client as is to give them the chance to take the appropriate recovery action. So before you leave your business method, you'd better make damned sure that you don't compromise data integrity. If you can't guarantee data integrity do the EJBContext.setRollbackOnly() thing. Which means that as a client you should get into the habit of doing UserTransaction.getStatus().
    2. Runtime Exceptions ( ignore EJBException for now ). I don't catch them but i'm not expecting them, and i don't know what to do with them. Thankfully, the container does (which is to log the exception, throw back RemoteExceptions to remote clients and EJBException to local clients, rollback the transaction and then take the bean instance out of service). So i delegate the handling of runtime exceptions to the container. i do not catch Throwable in my bean methods.
    3. System Exception ( EJBExceptions ). Where possible using EJB standard exceptions such as CreateException and FinderException. If my bean throws a checked exception, i need to gauge whether or not i can recover from it. I can't, i wrap it in an EJBException and throw it out for the container to do its stuff ( log, raise client exception, rollback and die ). Otherwise, i perform clean up in my bean to return my resources to the state they were before i started executing this method and raise the checked exception.
    In the article above the author's penultimate section talks about when to use an application exception over a system exception. Its always the client the determines which way your go. For example, what should you do during a create ejb you need to look up some data in the database and an SQLException is raised. Within the create method it is an application exception for sure because the system is not compromised, however, from the clients point of view, the bean cannot be created because key data was missing. Hence, the method should wrap the SQLException in an EJBException and throw it out to make sure the bean is not created. (If fact, the method retry something else and if nothing else works raise the EJBException).
    cleve

  • Status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException:

    Hi,
    I'm stuck on this problem since 10 days now. Please Please help.
    I'm using Jboss 4.0.5GA and ejb 2.0 While executing the last query after running the ejbStore() of the bean, it breaks,
    The error is below :
    Executing SQL: UPDATE arinpchg SET modified_date=?, doc_num=?, printing_status=? WHERE trx_num=?
    2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#modifiedDate] param: i=1, type=TIMESTAMP, value=2007-11-29 15:52:53.14
    2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#docNum] param: i=2, type=VARCHAR, value=INV297217
    2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#printingStatus] param: i=3, type=INTEGER, value=1
    2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#trxNum] param: i=4, type=VARCHAR, value=ARTRX395716
    2007-11-29 15:52:55,734 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract au.com.cams.cims.ar.data.PendingChargeResponse au.com.cams.cims.business.ejb.PendingChargeManager.processPendingCharges(au.com.cams.cims.ar.data.PendingChargeRequest,au.com.cams.cims.core.data.DUser) throws au.com.cams.cims.core.util.StoredProcedureFailedException,au.com.cams.cims.core.util.UpdateFailedException,java.rmi.RemoteException, causedBy:
    org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=MEL-LAP-XP-66/59, BranchQual=, localId=59] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6)
    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
         at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
         at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
         at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
         at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
         at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
         at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
         at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
         at org.jboss.ejb.Container.invoke(Container.java:954)
         at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
         at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
         at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
         at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
         at $Proxy508.processPendingCharges(Unknown Source)
         at au.com.cams.cims.ar.cmd.PendingChargeManagerCmdBean.doProcessPendingCharges(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at au.com.cams.cims.core.cmd.AbstractCmdBean.execute(Unknown Source)
         at au.com.cams.cims.core.sys.CIMSCommandBeanManager.doCommandBeanExecute(Unknown Source)
         at au.com.cams.cims.core.sys.CIMSCommandBeanManager.execute(Unknown Source)
         at au.com.singtech.saf.MainServlet.doPost(Unknown Source)
         at au.com.singtech.saf.MainServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6
         at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:169)
         at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:666)
         at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428)
         at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:273)
         at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:756)
         at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:149)
         at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:295)
         at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:345)
         at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
         at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
         at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
    My entityBean:
    * Copyright 2000 by Sing Technologies Pty. Ltd.,
    * Level 11, 269 Wickham Street, Fortitude Valley, Qld 4006, Australia
    * All rights reserved.
    * This software is the confidential and proprietary information
    * of Sing Technologies Pty. Ltd. ("Confidential Information"). You
    * shall not disclose such Confidential Information and shall use
    * it only in accordance with the terms of the license agreement
    * you entered into with Sing Technologies.
    package au.com.cams.cims.ar.ejb;
    import java.sql.*;
    import javax.ejb.*;
    import au.com.cams.cims.ar.data.*;
    import au.com.cams.cims.core.data.*;
    import au.com.cams.cims.core.util.*;
    import au.com.cams.cims.core.ejb.*;
    import au.com.cams.cims.core.app.*;
    import org.apache.log4j.*;
    import javax.naming.*;
    import javax.rmi.*;
    import java.util.*;
    import java.rmi.RemoteException;
    * @stereotype EntityBean
    * @persistence Container
    * @homeInterface au.com.cams.cims.ar.ejb.ChargeHome
    * @remoteInterface au.com.cams.cims.ar.ejb.Charge
    * @primaryKey au.com.cams.cims.ar.ejb.ChargePK
    public class ChargeBean implements EntityBean {
         static private Logger log = Logger.getLogger(ChargeBean.class.getName());
    private static final String datasource = "java:ds/cims";
    private static final String chargeLineRef = "java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineHome";
    // Used by the isModified extension
    private transient boolean isDirty;
    public boolean isModified() {
    return isDirty;
    /** @field Key VARCHAR(20) CIMSSchema.dbo.arinpchg.trx_num */
    public String trxNum;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.apply_to_num */
    public String applyToNum;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.terms_code */
    public String termsCode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.fin_chg_code */
    public String finChgCode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_code */
    public String shippingCode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.posting_code */
    public String postingCode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.tax_code */
    public String taxCode;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.aging_date */
    public Timestamp agingDate;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.due_date */
    public Timestamp dueDate;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.gross_amount */
    public Double grossAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_amount */
    public Double taxAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_included_amount */
    public Double taxIncludedAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.freight_amount */
    public Double freightAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_on_freight_amount */
    public Double taxOnFreightAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.net_amount */
    public Double netAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.paid_amount */
    public Double paidAmount;
    /** @field FLOAT(15) CIMSSchema.dbo.arinpchg.due_amount */
    public Double dueAmount;
    /** @field INTEGER(10) CIMSSchema.dbo.arinpchg.trx_type */
    public Integer trxType;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.doc_num */
    public String docNum;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.doc_date */
    public Timestamp docDate;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.apply_date */
    public Timestamp applyDate;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.debtor_num */
    public String debtorNum;
    /** @field INTEGER(10) CIMSSchema.dbo.arinppyt.trx_status */
    public Integer trxStatus;
    /** @field INTEGER(10) CIMSSchema.dbo.arinppyt.approval_status */
    public Integer approvalStatus;
    /** @field INTEGER(10) CIMSSchema.dbo.arinpchg.printing_status */
    public Integer printingStatus;
    /** @field INTEGER(10) CIMSSchema.dbo.arinpchg.posting_status */
    public Integer postingStatus;
    /** @field INTEGER(10) CIMSSchema.dbo.arinpchg.hold_status */
    public Integer holdStatus;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.hold_reason */
    public String holdReason;
    /** @field VARCHAR(2000) CIMSSchema.dbo.arinpchg.notes */
    public String notes;
    /** @field VARCHAR(200) CIMSSchema.dbo.arinpchg.message */
    public String message;
    /** @field INTEGER(10) CIMSSchema.dbo.arinpchg.next_sequence_id */
    public Integer nextSequenceId;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_addressee */
    public String billingAddressee;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_job_position */
    public String billingJobPosition;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr1 */
    public String billingAddr1;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr2 */
    public String billingAddr2;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr3 */
    public String billingAddr3;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_locality */
    public String billingLocality;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_state */
    public String billingState;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_postcode */
    public String billingPostcode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_country */
    public String billingCountry;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_home */
    public String billingPhoneHome;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_business */
    public String billingPhoneBusiness;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_mobile */
    public String billingPhoneMobile;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_car */
    public String billingPhoneCar;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_home */
    public String billingFaxHome;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_business */
    public String billingFaxBusiness;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email */
    public String billingEmail;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email2 */
    public String billingEmail2;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_website */
    public String billingWebsite;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_addressee */
    public String shippingAddressee;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_job_position */
    public String shippingJobPosition;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr1 */
    public String shippingAddr1;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr2 */
    public String shippingAddr2;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr3 */
    public String shippingAddr3;
    /** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_locality */
    public String shippingLocality;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_state */
    public String shippingState;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_postcode */
    public String shippingPostcode;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_country */
    public String shippingCountry;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_home */
    public String shippingPhoneHome;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_business */
    public String shippingPhoneBusiness;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_mobile */
    public String shippingPhoneMobile;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_car */
    public String shippingPhoneCar;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_home */
    public String shippingFaxHome;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_business */
    public String shippingFaxBusiness;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email */
    public String shippingEmail;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email2 */
    public String shippingEmail2;
    /** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_website */
    public String shippingWebsite;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.created_date */
    public Timestamp createdDate;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.created_by */
    public String createdBy;
    /** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.modified_date */
    public Timestamp modifiedDate;
    /** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.modified_by */
    public String modifiedBy;
    /** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.print_job_num *//*
    public String printJobNum;*/
    * The container assigned reference to the entity
    private EntityContext context;
    * Sets the context of the bean
    * @param ec
    public void setEntityContext(EntityContext ec) {
    context = ec;
    // to do: code goes here.
    * Clears the context of the bean
    public void unsetEntityContext() {
    this.context = null;
    // to do: code goes here.
    * This method is called when the container picks this entity object
    * and assigns it to a specific entity object. Insert code here to
    * acquire any additional resources that it needs when it is in the
    * ready state.
    public void ejbActivate() {
    * This method is called when the container diassociates the bean
    * from the entity object identity and puts the instance back into
    * the pool of available instances. Insert code to release any
    * resources that should not be held while the instance is in the
    * pool.
    public void ejbPassivate() {
    * The container invokes this method on the bean whenever it
    * becomes necessary to synchronize the bean's state with the
    * state in the database. This method is called after the container
    * has loaded the bean's state from the database.
    public void ejbLoad() {
              System.out.println("#### VJ: ChargeBean.ejbLoad()");
    * The container invokes this method on the bean whenever it
    * becomes necessary to synchronize the state in the database
    * with the state of the bean. This method is called before the
    * container extracts the fields and writes them into the database.
    public void ejbStore() {
              System.out.println("#### VJ: ChargeBean.ejbStore()");
    this.isDirty = false;
    updateTotals();
              System.out.println("#### VJ: ChargeBean.context.getPrimaryKey(): " + context.getPrimaryKey().toString());
              System.out.println("#### VJ: ChargeBean.trxNum: " + trxNum);
    * The container invokes this method in response to a client-invoked
    * remove request. Insert code to implement any actions before the
    * bean is removed from the database.
    public void ejbRemove() throws RemoveException {
    public ChargePK ejbCreate(DCharge charge, DUser user)
    throws CreateException {
         System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser)");
    Connection con = null;
    ChargePK key = new ChargePK();
    if (charge == null)
    throw new CreateException("charge cannot be null");
    if (user == null)
    throw new CreateException("user cannot be null");
    try {
    // set the pk
    con = DatabaseUtilities.getConnection(log, datasource);
    this.trxNum = AppJDBCHelper.getNextTrxNum(con);
    key.trxNum = this.trxNum;
    // set other attributes
    setAttributes(charge);
    // set mod history
    this.createdDate = new Timestamp(new java.util.Date().getTime());
    this.createdBy = user.getUsername();
    this.modifiedDate = new Timestamp(new java.util.Date().getTime());
    this.modifiedBy = user.getUsername();
    } catch (GetNextIdFailedException gnife) {
    log.error("ejbCreate", gnife);
    throw new CreateException(gnife.getMessage());
    } catch (NullPointerException ex1) {
    ex1.printStackTrace();
    log.warn("ejbCreate(): " + ex1);
    throw new CreateException("ejbCreate(): " + ex1);
    } finally {
    if (con != null) DatabaseUtilities.close(con, log, "ejbCreate()");
         //System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
         System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
         System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargePK) key.trxNum: " + key.trxNum);
         System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
    return (key);
    * The container invokes this method after invoking the ejbCreate
    * method with the same arguments.
    * @param charge
    * @param user
    public void ejbPostCreate(DCharge charge, DUser user) {
              System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser)");
    updateTotals();
    isDirty = false;
              System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
              System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
              System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
    * @exception ReadFailedException
    * @return
    public DCharge getDetails()
    throws ReadFailedException {
    DCharge charge = new DCharge();
    try {
    updateTotals();
    charge.setTrxNum(this.trxNum);
    getAttributes(charge);
    DModificationHistory history = new DModificationHistory();
    history.setCreatedDate(this.createdDate);
    history.setCreatedBy(this.createdBy);
    history.setModifiedDate(this.modifiedDate);
    history.setModifiedBy(this.modifiedBy);
    charge.setModificationHistory(history);
    } catch (InvalidDataException ex1) {
    log.warn("getDetails(): " + ex1);
    throw new ReadFailedException("getDetails(): " + ex1.toString());
    } catch (NullPointerException ex2) {
    log.warn("getDetails(): " + ex2);
    throw new ReadFailedException("getDetails(): " + ex2.toString());
    return (charge);
    * @exception ReadFailedException
    * @return
    public DCharge getAllDetails()
    throws ReadFailedException {
    DCharge charge = null;
    try {
    // get non dependant object data
    charge = getDetails();
    // declare and init search home ejbs
    Context ctx = new InitialContext();
    // used for searching
    ChargePK chargePK = new ChargePK();
    chargePK.trxNum = this.trxNum;
                   System.out.println("#### VJ: ChargeBean.getAllDetails() chargePK.trxNum(): " + chargePK.trxNum);
                   System.out.println("#### VJ: ChargeBean.getAllDetails() charge.getTrxNum(): " + charge.getTrxNum());
    // load the charge line items
    try {
    Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineSearchHome");
    ChargeLineSearchHome chargeLineSearchHome = (ChargeLineSearchHome) PortableRemoteObject.narrow(obj, ChargeLineSearchHome.class);
    ChargeLineSearch chargeLineSearch = chargeLineSearchHome.create();
    System.out.println("ChargePK: " + chargePK.trxNum);
    charge.setLineItems(chargeLineSearch.searchByCharge(chargePK));
    } catch (NamingException ne) {
    log.warn("getAllDetails(): couldn't lookup ChargeLineSearchHome " + ne.toString());
    } catch (InvalidDataException ide) {
    log.warn("getAllDetails(): couldn't set ChargeLineSearchHome " + ide.toString());
    } catch (SearchFailedException sfe) {
    log.warn("getAllDetails(): search failed " + sfe.toString());
    } catch (CreateException ce) {
    log.warn("getAllDetails(): couldn't create ChargeLineSearchHome " + ce.toString());
    } catch (RemoteException re) {
    log.warn("getAllDetails(): " + re.toString());
    } catch (NamingException ex) {
    log.warn("getAllDetails(): couldn't get an initial context " + ex.toString());
    throw new ReadFailedException("getAllDetails(): " + ex.toString());
    return charge;
    * @param charge
    * @param user
    * @exception UpdateFailedException
    public void setDetails(DCharge charge, DUser user)
    throws UpdateFailedException {
              System.out.println("#### VJ: ChargeBean.setDetails(DCharge, DUser)");
    try {
    // set other attributes
    setAttributes(charge);
    updateTotals();
    // set mod history
    this.modifiedDate = new Timestamp(new java.util.Date().getTime());
    this.modifiedBy = user.getUsername();
    } catch (NullPointerException ex1) {
    log.warn("setDetails(): " + ex1);
    throw new UpdateFailedException("setDetails(): " + ex1.toString());
    * Increments the next sequenceId and returns the current sequenceId (before incrememt)
    * @exception java.rmi.RemoteException
    * @exception UpdateFailedException
    public Integer incNextSequenceId()
    throws UpdateFailedException {
    Integer nextId = null;
    try {
    int current = this.nextSequenceId.intValue();
    // make a copy of the existing id
    nextId = new Integer(current);
    // now inc it
    this.nextSequenceId = new Integer(++current);
    } catch (EJBException e) {
    log.error("incNextSequenceId(): couldn't inc next sequenceId: " + e.toString());
    throw new UpdateFailedException(e.getMessage());
    return nextId;
    * Used by setDetails, ejbCreate.
    * @param member
    protected void setAttributes(DCharge charge) {
              System.out.println("#### VJ: ChargeBean.setAttributes(DCharge)");
         this.isDirty = true;
    ARTransactionManager mgr = null;
    try {
    Context ctx = new InitialContext();
    Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ARTransactionManagerHome");
    ARTransactionManagerHome mgrHome = (ARTransactionManagerHome) PortableRemoteObject.narrow(obj, ARTransactionManagerHome.class);
    mgr = mgrHome.create();
    } catch (NamingException ne) {
    log.warn("setAttributes(): couldn't lookup ARTransactionManagerHome " + ne.toString());
    throw new EJBException(ne.toString());
    } catch (CreateException ce) {
    log.warn("setAttributes(): couldn't create ARTransactionManagerHome " + ce.toString());
    throw new EJBException(ce.toString());
    } catch (RemoteException ex) {
    log.error(ex.toString());
    throw new EJBException(ex.toString());
    try {
    TaxCode tc = mgr.getTaxCode(charge.getTaxCode());
    TaxAmounts amounts = ARUtilities.calculateTax(charge.getFreightAmount(), tc);
    this.taxOnFreightAmount = new Double(amounts.getAmountTax().doubleValue() - amounts.getAmountTaxIncluded().doubleValue());
    } catch (ReadFailedException rfe) {
    log.error("ReadFailedException reading tax code : " + charge.getTaxCode(), rfe);
    throw new EJBException(rfe.toString());
    } catch (RecordNotFoundException rnfe) {
    log.error("RecordNotFoundException reading tax code : " + charge.getTaxCode(), rnfe);
    throw new EJBException(rnfe.toString());
    } catch (RemoteException ex) {
    log.error(ex.toString());
    throw new EJBException(ex.toString());
              System.out.println("#### VJ: ChargeBean.setAttributes(DCharge) prior setters");
    this.applyToNum = charge.getApplyToNum();
    this.termsCode = charge.getTermsCode();
    this.finChgCode = charge.getFinanceChargeCode();
    this.shippingCode = charge.getShippingCode();
    this.postingCode = charge.getPostingCode();
    this.taxCode = charge.getTaxCode();
    this.agingDate = new Timestamp(charge.getAgingDate().getTime());
    this.dueDate = new Timestamp(charge.getDueDate().getTime());
    this.grossAmount = charge.getGrossAmount();
    this.taxAmount = charge.getTaxAmount();
    this.taxIncludedAmount = charge.getTaxIncludedAmount();
    this.freightAmount = charge.getFreightAmount();
    this.netAmount = charge.getNetAmount();
    this.paidAmount = charge.getPaidAmount();
    this.dueAmount = charge.getDueAmount();
    this.trxType = charge.getTrxType();
    this.docNum = charge.getDocNum();
    this.docDate = new Timestamp(charge.getDocDate().getTime());
    this.applyDate = new Timestamp(charge.getApplyDate().getTime());
    this.debtorNum = charge.getDebtorNum();
    this.trxStatus = charge.getTrxStatus();
    this.approvalStatus = charge.getApprovalStatus();
    this.printingStatus = charge.getPrintingStatus();
    this.postingStatus = charge.getPostingStatus();
    this.holdStatus = charge.getHoldStatus();
    this.holdReason = charge.getHoldReason();
    this.notes = charge.getNotes();
    this.message = charge.getMessage();
    this.nextSequenceId = charge.getNextSequenceId();
    DAddress billingAddress = charge.getBillingAddress();
    if (billingAddress != null) {
    this.billingAddressee = billingAddress.getAddressee();
    this.billingJobPosition = billingAddress.getPosition();
    this.billingAddr1 = billingAddress.getAddress1();
    this.billing

    I've solved this problem using JDBC.
    Thanks
    Smile
    Message was edited by:
    nsqsmile

  • EJBException thrown when using EntityBean

    I am currently developing on the BEA Weblogic server 8.1 on Win2k SP4. The application
    is currently up and running under Weblogic. I've added a new EntityBean (along
    with the necessarn DB tables, classes, and descriptor file updates). Everything
    compiles and the jar file builds. However, when I run the application and attempt
    to access the new bean I get the following runtime exception:
    javax.ejb.EJBException: Attempt to pass a reference to an EJBLocalObject to a
    remote client. A local EJB component may only be accessed by clients co-located
    in the same ear or standalone jar file..
    javax.ejb.EJBException: Attempt to pass a reference to an EJBLocalObject to a
    remote client. A local EJB component may only be accessed by clients co-located
    in the same ear or standalone jar file.
         at com.jsims.ws.ejbgame.ejb.Metadata_na2102_ELOImpl.writeObject(Ljava.io.ObjectOutputStream;)V(Metadata_na2102_ELOImpl.java:355)
         at COM.jrockit.reflect.NativeMethodInvoker.invoke0(ILjava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Native
    Method)
    where Metadata is the new bean added to the system. Could someone give me a clue
    as to how I would start to debug this problem? I've gone over every file and I
    can't see any issues.
    Thanks in advance.

    Right, but you're returning a Collection of EJBLocalObjects. That's the
    problem.
    -- Rob
    Bill Beebe wrote:
    Rob Woollen <[email protected]> wrote:
    It looks like your GameFacade EJB has a remote call trying to return
    the
    Local Metadata EJBI wish that were true, but it's just returning a Collection. I've attached another
    file that includes code snippets of the various classes (from the client to the
    EJBs) stripped down to their bare essentials as well as the section in the ejb-jar.xml
    file where the ejb is defined.
    Here is the home interface class:
    package com.jsims.ws.ejbgame.ejb;
    import java.util.Collection;
    import javax.ejb.EJBLocalHome;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    public interface MetadataHome extends EJBLocalHome
    public static final String
    JNDI_NAME = "cirrus/ejb/Metadata";
    public MetadataLocal create(
    String toeId,
    String entityName,
    Integer count,
    String entityType,
    Integer parent,
    String symbolCode)
    throws
    CreateException;
    public MetadataLocal findByPrimaryKey(MetadataKey primeKey)
    throws FinderException;
    public Collection findAllUnits()
    throws FinderException;
    public Collection findUnitEgs(String toeId)
    throws FinderException;
    public Collection findAllByDomain(String domain)
    throws FinderException;
    Here is the EJBLocalObject definition:
    package com.jsims.ws.ejbgame.ejb;
    import javax.ejb.EJBLocalObject;
    * The local interface for the Metadata bean.
    public interface MetadataLocal extends EJBLocalObject
    public String getToeId();
    public String getEntityName();
    public Integer getCount();
    public String getEntityType();
    public Integer getParent();
    public String getSymbolCode();
    Here are the methods defined in GameFacade (and Bean):
    public interface GameFacade extends EJBObject
    public Collection getUnitsByDomain(String domain)
    throws RemoteException;
    Here is the implementation in the bean:
    public class GameFacadeBean
    extends NullEventListener
    implements SessionBean
    public Collection getUnitsByDomain(String domainName)
    Collection
    domainUnits = Collections.EMPTY_LIST;
    try
    domainUnits = metadataHome.findAllByDomain(domainName);
    catch(FinderException ex)
    ex.printStackTrace();
    domainUnits = Collections.EMPTY_LIST;
    return domainUnits;
    and here is where it is being used on the client:
    public TemplateView(int en, Framework fw)
    framework = fw;
    // Get the GameFacade and perform the query.
    Collection
    templates =
    framework.getGame().getUnitsByDomain(domainName);
    Here is the definition in the ejb-jar.xml entry:
    <entity>
    <display-name>Metadata</display-name>
    <ejb-name>Metadata</ejb-name>
    <local-home>com.jsims.ws.ejbgame.ejb.MetadataHome</local-home>
    <local>com.jsims.ws.ejbgame.ejb.MetadataLocal</local>
    <ejb-class>com.jsims.ws.ejbgame.ejb.MetadataBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>com.jsims.ws.ejbgame.ejb.MetadataKey</prim-key-class>
    <reentrant>False</reentrant>
    <abstract-schema-name>Metadata</abstract-schema-name>
    <cmp-field>
    <field-name>toeId</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>entityName</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>count</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>entityType</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>parent</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>symbolCode</field-name>
    </cmp-field>
    <query>
    <query-method>
    <method-name>findAllUnits</method-name>
    <method-params/>
    </query-method>
    <ejb-ql>SELECT OBJECT(f) FROM Metadata AS f WHERE f.count = 0 OrderBy f.toeId</ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findUnitEgs</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT OBJECT(f) FROM Metadata AS f WHERE f.toeId = ?1 AND f.count > 0 OrderBy f.count</ejb-ql>
    </query>
    <query>
    <query-method>
    <method-name>findAllByDomain</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT OBJECT(f) FROM Metadata AS f, TOE as t, ToeTemplateMappings as t2 WHERE f.toeId = t2.toeId AND t2.templateId = t.templateId AND t.domain=?1 and f.count = 0 OrderBy f.toeId</ejb-ql>
    </query>
    <!--query>
    <query-method>
    <method-name>findAllUnitKeys</method-name>
    <method-params/>
    </query-method>
    <ejb-ql>SELECT f.toeId FROM Metadata AS f WHERE f.count = 0 OrderBy f.toeId</ejb-ql>
    </query-->
    </entity>

  • Forte for Java J2EE Tutorial -- RMI RemoteException

    In testing the J2EE tutorial (Restaurant_TestApp) I keep encountering the following error when invoking the findAll method. I get the same error when invoking Data.Restaurant create.
    The error is:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException java.rmi.RemoteException
    Any help or pointers from someone who has successfully built and tested the tutorial would be hugely appreciated!
    Many thanks,
    Luke
    The full error from the J2EE log is:
    javax.ejb.EJBException
         at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:1560)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1472)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1289)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:403)
         at Data.RestaurantEJB_PM_RemoteHomeImpl.findAll(RestaurantEJB_PM_RemoteHomeImpl.java:99)
         at Data._RestaurantHome_Stub.findAll(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:232)
         at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:97)
         at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:190)
         at org.apache.jsp.dispatch$jsp._jspService(dispatch$jsp.java:127)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:484)
    java.rmi.RemoteException
         at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:389)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:431)
         at Data.RestaurantEJB_PM_RemoteHomeImpl.findAll(RestaurantEJB_PM_RemoteHomeImpl.java:99)
         at Data._RestaurantHome_Stub.findAll(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:232)
         at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:97)
         at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:190)
         at org.apache.jsp.dispatch$jsp._jspService(dispatch$jsp.java:127)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:484)

    RMI is not that hard.. its just hard to explain :)
    I have not done the tutorial.. so bare with me..
    the errors your seeing can mean many things.. but above all else it means that you've got a problem either connecting or communicating to the rmi_server you created or the rmiRegistry
    My suggestion is this...
    First try a simpler application.
    How about a simple server that returns a string
    and sets a string.
    then a client app that can read the server string and envoke a change to it...
    This will show the basics involved.
    let me know your toughts..
    j.

  • Help : javax.ejb.EJBException: nested exception is: SQL Exception: Database

    Hello,
    I found a write up of error connecting to DB2 from SUSE linux
    i am using websphere admin console , jdbc db2 universal driver to
    connect to a remote db (DB2).
    the test connection works...but the application gives
    the above error
    jdbc test connection trace
    [ibm][db2][jcc] BEGIN TRACE_DRIVER_CONFIGURATION
    [ibm][db2][jcc] Driver: IBM DB2 JDBC Universal Driver Architecture 1.1.67
    [ibm][db2][jcc] Compatible JRE versions: { 1.3, 1.4 }
    [ibm][db2][jcc] Range checking enabled: true
    [ibm][db2][jcc] Bug check level: 0xff
    [ibm][db2][jcc] Trace level: 0xffffffff
    [ibm][db2][jcc] Default fetch size: 64
    [ibm][db2][jcc] Default isolation: 2
    [ibm][db2][jcc] Collect performance statistics: false
    [ibm][db2][jcc] No security manager detected.
    [ibm][db2][jcc] Detected local client host: SUSE.SYSDEV/127.0.0.2
    [ibm][db2][jcc] Access to package sun.io is permitted by security manager.
    [ibm][db2][jcc] JDBC 1 system property jdbc.drivers = null
    [ibm][db2][jcc] Java Runtime Environment version 1.4.1
    [ibm][db2][jcc] Java Runtime Environment vendor = IBM Corporation
    [ibm][db2][jcc] Java vendor URL = http://www.ibm.com/
    [ibm][db2][jcc] Java installation directory =
    /opt/WebSphere/AppServer/java/bin/../jre
    [ibm][db2][jcc] Java Virtual Machine specification version = 1.0
    [ibm][db2][jcc] Java Virtual Machine specification vendor = Sun
    Microsystems Inc.
    [ibm][db2][jcc] Java Virtual Machine specification name = Java Virtual
    Machine Specification
    [ibm][db2][jcc] Java Virtual Machine implementation version = 1.4.1
    [ibm][db2][jcc] Java Virtual Machine implementation vendor = IBM Corporation
    [ibm][db2][jcc] Java Virtual Machine implementation name = Classic VM
    [ibm][db2][jcc] Java Runtime Environment specification version = 1.4
    [ibm][db2][jcc] Java Runtime Environment specification vendor = Sun
    Microsystems Inc.
    [ibm][db2][jcc] Java Runtime Environment specification name = Java
    Platform API Specification
    [ibm][db2][jcc] Java class format version number = 48.0
    [ibm][db2][jcc] Java class path =
    /opt/WebSphere/AppServer/properties:/opt/WebSphere/AppServer/properties:/opt/WebSphere/AppServer/lib/bootstrap.jar:/opt/WebSphere/AppServer/lib/j2ee.jar:/opt/WebSphere/AppServer/lib/lmproxy.jar:/opt/WebSphere/AppServer/lib/urlprotocols.jar:/opt/WebSphere/AppServer/
    [ibm][db2][jcc] Java native library path =
    /opt/WebSphere/AppServer/java/bin/../jre/bin:/opt/WebSphere/AppServer/java/jre/bin/classic:/opt/WebSphere/AppServer/java/jre/bin:/opt/WebSphere/AppServer/bin:/opt/mqm/java/lib:/opt/wemps/lib:/usr/lib
    [ibm][db2][jcc] Path of extension directory or directories =
    /opt/WebSphere/AppServer/java/bin/../jre/lib/ext
    [ibm][db2][jcc] Operating system name = Linux
    [ibm][db2][jcc] Operating system architecture = x86
    [ibm][db2][jcc] Operating system version = 2.4.19-64GB-SMP
    [ibm][db2][jcc] File separator ("/" on UNIX) = /
    [ibm][db2][jcc] Path separator (":" on UNIX) = :
    [ibm][db2][jcc] User's account name = root
    [ibm][db2][jcc] User's home directory = /root
    [ibm][db2][jcc] User's current working directory = /opt/WebSphere/AppServer
    [ibm][db2][jcc] END TRACE_DRIVER_CONFIGURATION
    **************************************imp ***********************
    [ibm][db2][jcc] BEGIN TRACE_CONNECTS
    [ibm][db2][jcc] Attempting connection to nnn.nnn.nnn.nnn:50000/was40
    [ibm][db2][jcc] Using properties: { dataSourceName=null,
    password=<escaped>, portNumber=50000, fullyMaterializeLobData=true,
    securityMechanism=3, cliSchema=dbo, resultSetHoldability=2,
    serverName=167.16.183.11, currentPackageSet=null, loginTimeout=0,
    planName=null, traceFile=/opt/WebSphere/AppServer/logs/server1/trace,
    kerberosServerPrincipal=null,
    retrieveMessagesFromServerOnGetMessage=true, currentSchema=dbo,
    driverType=4, description=null, readOnly=false, deferPrepares=true,
    databaseName=was40, traceLevel=-1, user=db2inst1 }
    [ibm][db2][jcc] END TRACE_CONNECTS
    *************************************imp *******************
    [ibm][db2][jcc][t4] Request.flush() called at 2004-7-6 10:47:39
    Thread: Servlet.Engine.Transports : 2 Tracepoint: 1
    [ibm][db2][jcc][t4] SEND BUFFER: EXCSAT (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 0072D0410001006C 10410027115E8482
    .r.A...l.A.'.^.. ..}....%.....;db
    [ibm][db2][jcc][t4] 0010 F2918383E28599A5 9385A34BC5958789
    ...........K.... 2jccServlet.Engi
    [ibm][db2][jcc][t4] 0020 95854BE3998195A2 979699A3A2407A40
    ..K..........@z@ ne.Transports :
    [ibm][db2][jcc][t4] 0030 F2000F116DE2E4E2 C54BE2E8E2C4C5E5
    ....m....K...... 2..._SUSE.SYSDEV
    [ibm][db2][jcc][t4] 0040 000E115AC4C2F2D1 C3C340F14BF00018
    [email protected]... ...!DB2JCC 1.0..
    [ibm][db2][jcc][t4] 0050 1404140300032407 0007240F00071440
    ......$...$....@ ...............
    [ibm][db2][jcc][t4] 0060 000614740005000C 1147D8C4C2F261D1
    ...t.....G....a. ..........QDB2/J
    [ibm][db2][jcc][t4] 0070 E5D40026D0010002 0020106D000611A2
    ...&..... .m.... VM..}......_...s
    [ibm][db2][jcc][t4] 0080 000300162110A681 A2F4F04040404040
    ....!......@@@@@ ......was40
    [ibm][db2][jcc][t4] 0090 4040404040404040
    [ibm][db2][jcc][t4]
    [ibm][db2][jcc][t4] Reply.fill() called at 2004-7-6 10:47:39 Thread:
    Servlet.Engine.Transports : 2 Tracepoint: 2
    [ibm][db2][jcc][t4] RECEIVE BUFFER: EXCSATRD (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 0066D04300010060 1443001C115E8482
    .f.C...`.C...^.. ..}....-.....;db
    [ibm][db2][jcc][t4] 0010 F28995A2A3F18482 F281878595A3F0F0
    ................ 2inst1db2agent00
    [ibm][db2][jcc][t4] 0020 F0F1F9C6F3F60018 1404140300032407
    ..............$. 019F36..........
    [ibm][db2][jcc][t4] 0030 0005240F00071440 000614740005000D
    [email protected].... ....... ........
    [ibm][db2][jcc][t4] 0040 1147D8C4C2F261F6 F0F0F0000C116D84
    .G....a.......m. ..QDB2/6000..._d
    [ibm][db2][jcc][t4] 0050 82F28995A2A3F100 0F115AC4C2F240E4
    ..........Z...@. b2inst1...!DB2 U
    [ibm][db2][jcc][t4] 0060 C4C240F74BF20010 D0030002000A14AC
    [email protected]........... DB 7.2..}.......
    [ibm][db2][jcc][t4] 0070 000611A20003 ......
    ...s..
    [ibm][db2][jcc][t4]
    [ibm][db2][jcc][t4] Request.flush() called at 2004-7-6 10:47:39
    Thread: Servlet.Engine.Transports : 2 Tracepoint: 1
    [ibm][db2][jcc][t4] SEND BUFFER: SECCHK (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 003ED04100010038 106E000611A20003
    .>.A...8.n...... ..}......>...s..
    [ibm][db2][jcc][t4] 0010 00162110A681A2F4 F040404040404040
    ..!......@@@@@@@ ....was40
    [ibm][db2][jcc][t4] 0020 404040404040000C 11A08482F28995A2
    @@@@@@.......... ....db2ins
    [ibm][db2][jcc][t4] 0030 A3F1000C11A18482 F28995A2A3F100A8
    ................ t1...~db2inst1.y
    [ibm][db2][jcc][t4] 0040 D001000200A22001 00162110A681A2F4 ......
    ...!..... }....s......was4
    [ibm][db2][jcc][t4] 0050 F040404040404040 4040404040400006
    .@@@@@@@@@@@@@.. 0 ..
    [ibm][db2][jcc][t4] 0060 210F2407000C112E D1C3C3F0F1F0F0F0
    !.$............. ........JCC01000
    [ibm][db2][jcc][t4] 0070 003C210437D1C3C3 F0F1F0F0F0D1E5D4
    .<!.7........... .....JCC01000JVM
    [ibm][db2][jcc][t4] 0080 4040404040404040 4040404040404084
    @@@@@@@@@@@@@@@. d
    [ibm][db2][jcc][t4] 0090 82F2918383E28599 A59385A34BC59587
    ............K... b2jccServlet.Eng
    [ibm][db2][jcc][t4] 00A0 8995858482F28995 A2A3F100000D002F
    .............../ inedb2inst1.....
    [ibm][db2][jcc][t4] 00B0 D8E3C4E2D8D3C1E2 C300172135C1C3F1
    ...........!5... QTDSQLASC....AC1
    [ibm][db2][jcc][t4] 00C0 C6F1F2F7C54BD7C3 F1F200FD9591649F
    .....K........d. F127E.PC12..nj..
    [ibm][db2][jcc][t4] 00D0 001600350006119C 04B80006119D04B0
    ...5............ ................
    [ibm][db2][jcc][t4] 00E0 0006119E04B8 ......
    [ibm][db2][jcc][t4]
    [ibm][db2][jcc][t4] Reply.fill() called at 2004-7-6 10:47:39 Thread:
    Servlet.Engine.Transports : 2 Tracepoint: 2
    [ibm][db2][jcc][t4] RECEIVE BUFFER: SECCHKRM (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 0015D0420001000F 1219000611490000
    ...B.........I.. ..}.............
    [ibm][db2][jcc][t4] 0010 000511A4000033D0 020002002D220100
    ......3.....-".. ...u...}........
    [ibm][db2][jcc][t4] 0020 0611490000000C11 2EE2D8D3F0F7F0F2
    ..I............. .........SQL0702
    [ibm][db2][jcc][t4] 0030 F3000D002FD8E3C4 E2D8D3C1E2C3000A
    ..../........... 3....QTDSQLASC..
    [ibm][db2][jcc][t4] 0040 00350006119C0333
    .5.....3 ........
    [ibm][db2][jcc][t4]
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] setDB2CurrentSchema () called
    [ibm][db2][jcc][Connection@887519a] BEGIN TRACE_CONNECTS
    [ibm][db2][jcc][Connection@887519a] Successfully connected to server
    jdbc:db2://167.16.183.11:50000/was40
    [ibm][db2][jcc][Connection@887519a] User: db2inst1
    [ibm][db2][jcc][Connection@887519a] Database product name: DB2/6000
    [ibm][db2][jcc][Connection@887519a] Database product version: SQL07023
    [ibm][db2][jcc][Connection@887519a] Driver name: IBM DB2 JDBC
    Universal Driver Architecture
    [ibm][db2][jcc][Connection@887519a] Driver version: 1.1.67
    [ibm][db2][jcc][Connection@887519a] END TRACE_CONNECTS
    [ibm][db2][jcc][t4] DRDA manager levels: { SQLAM=5, AGENT=3,
    CMNTCPIP=5, RDB=7, SECMGR=6 }
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] DB2PooledConnection.getConnection () returned a
    logical connection
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] getAutoCommit () returned true
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] isClosed () returned false
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] DB2PooledConnection.recycleConnection() ()
    called
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] DB2PooledConnection.recycleConnection ()
    returned void
    [ibm][db2][jcc][Thread:Servlet.Engine.Transports :
    2][Connection@887519a] DB2PooledConnection.close() (close the
    phycical connection) called
    [ibm][db2][jcc][t4] Request.flush() called at 2004-7-6 10:47:39
    Thread: Servlet.Engine.Transports : 2 Tracepoint: 1
    [ibm][db2][jcc][t4] SEND BUFFER: RDBCMM (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 000AD00100010004 200E
    [ibm][db2][jcc][t4]
    [ibm][db2][jcc][t4] Reply.fill() called at 2004-7-6 10:47:39 Thread:
    Servlet.Engine.Transports : 2 Tracepoint: 2
    [ibm][db2][jcc][t4] RECEIVE BUFFER: ENDUOWRM (ASCII)
    (EBCDIC)
    [ibm][db2][jcc][t4] 0 1 2 3 4 5 6 7 8 9 A B C D E F
    0123456789ABCDEF 0123456789ABCDEF
    [ibm][db2][jcc][t4] 0000 0015D0520001000F 220C000611490004
    ...R...."....I.. ..}.............
    [ibm][db2][jcc][t4] 0010 0005211501000BD0 03000100052408FF
    ..!..........$.. .......}........
    [ibm][db2][jcc][t4]
    application error
    Exception Message:: RemoteException occurred in server thread; nested
    exception is: java.rmi.RemoteException: ; nested exception is:
    javax.ejb.EJBException: nested exception is:
    javax.transaction.TransactionRolledbackException: CORBA
    TRANSACTION_ROLLEDBACK 0x0 No; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK:
    javax.transaction.TransactionRolledbackException: ; nested exception
    is: javax.ejb.EJBException: nested exception is: SQL Exception:
    Database 'WAS40' not found. vmcid: 0x0 minor code: 0 completed: No
    Localized Message :: RemoteException occurred in server thread; nested
    exception is: java.rmi.RemoteException: ; nested exception is:
    javax.ejb.EJBException: nested exception is:
    javax.transaction.TransactionRolledbackException: CORBA
    TRANSACTION_ROLLEDBACK 0x0 No; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK:
    javax.transaction.TransactionRolledbackException: ; nested exception
    is: javax.ejb.EJBException: nested exception is: SQL Exception:
    Database 'WAS40' not found. vmcid: 0x0 minor code: 0 completed: No
    Do you have any suggestions
    Regards,
    Sunil

    Hi Peter,
    You are right. Child is being inserted even before parent got inserted (actually "committed") into the DB.we would need to look at your code where are you doing all these creates (may be ejbCreate). Most probably ur error should get fixed by changing the transactional attributes in the DD files. Try using <delay-database-inserts-until> element.
    More details available at:
    http://e-docs.bea.com/wls/docs70/faq/ejb.html#257426
    If it doesn't help, open up a case with BEA Support.
    Hope it helps!
    Thanks
    -Rais

Maybe you are looking for

  • Help with photos in project???!!

    Hello, I just bought an iMac about a month ago so that I could edit home movies and create DVD's of family vacations/events to share with my family. I have done this in the past on the PC with Pinnacle Movie Studio Software but it was buggy and more

  • Slow down after scanner attached

    I have been scanning photos with the HP scanner that Apple gave away with the computer. Everything I scan is followed by the pinwheel spinning for four to five minutes before anything goes back to normal. Is this 200GB computer full already? Not even

  • Indesign/pdf: bleed marks for cover

    I am trying to save a pdf book cover file with bleed marks before I send it to the printer.  My cover is 6x9.25 with .125 bleeds, so I made an indesign document with those specifications, placed my photoshopped cover which included the bleed (6.25x9.

  • Aperture 3 Wont even Open :(

    I just upgraded form A2 to A3 and then it says need to updates the library and when i say continue it says " Insufficient Disk space" I have like 159GB free on my drive and I use a Macpro 2009 , can anyone please help me

  • HELP!!! Lightroom automatically adjusting color in my photos and I can't  change it.

    Background: I am evaluating lightroom. I have zero tolerance for automatic adjustments that I can't control, since I strive for absolute consistency across all my photos. That means a manual setting of exposure and white balance on my camera, and I n