3 Replies Latest reply on Feb 8, 2006 5:46 AM by armita

    Filter on Seam application

    armita

      Could you please tell me how can I access my Seam components in a Filter class?
      I have tryed:
      UserLogic userLogic = (UserLogic) Component.getInstance("userLogic",false);
      Which returns null
      and

      InitialContext ctx = new InitialContext();
      UserLogic userLogic = (UserLogic) ctx.lookup("mcipro/UserLogicAction/local");

      which returns ok but trying to access a method of it gives:
      javax.ejb.EJBException: java.lang.NullPointerException
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)

        • 1. Re: Filter on Seam application

          Perhaps you could chain the SeamServletFilter in before your filter to initialise all of the Seam stuff before it gets to your custom filter.

          Don't know if this will work but just a thought.

          James

          • 2. Re: Filter on Seam application
            gavin.king

            Yes, that ,might work. But if you do that, you should make sure you *don't* use SeamPhaseListener or subclasses.

            Personally I would avoid use of a servlet filter for this, and try to do the work in a phase listener.

            • 3. Re: Filter on Seam application
              armita

              My filter is last in the chain but still is not working.

              But I couln't understand why a standard EJB lookup gives me errors?