3 Replies Latest reply on Dec 13, 2006 7:18 AM by Gavin King

    Using Seam from External Invocation

    Mark Jones Newbie

      So far my progress with seam has been rapid and I have enjoyed using it. I have just stumbled with the following problem. I am invoking Jobs using Quartz that act upon all my entities.

      I wanted to do nice things like @Logger and @PersistenceContext and use the entity manager to do the manipulation but unsuprisingly bijection does not take place.

      Can someone advise me on the best/better way(s) to deal with this scenario please?

      Kind Regards

        • 1. Re: Using Seam from External Invocation
          Gavin King Master

          You would need some interception of the Quartz event to set up the Seam contexts (Lifecycle.beginCall(), Lifecycle.endCall()). I don't know enough about Quartz to tell you exactly how to do it.

          • 2. Re: Using Seam from External Invocation
            Mark Jones Newbie

            Thanks Gavin but I think that might require a slightly better understanding that I have.

            Taking the broader problem, running repeated actions from antoher thread and still having access to the seam beans . Can anyone suggest something please?

            I have tried Component.getInstance("testBean") for example but I get

            java.lang.IllegalStateException: No application context active
             at org.jboss.seam.Component.forName(Component.java:1534)
             at org.jboss.seam.Component.getInstance(Component.java:1584)
             at org.jboss.seam.Component.getInstance(Component.java:1567)
             at org.jboss.seam.Component.getInstance(Component.java:1561)
             at halvor.schedulers.db.PendingOrderQuartzTarget.execute(PendingOrderQuartzTarget.java:11)
             at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
             at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
            


            I am assuming I need to configure something with this approach but do not know where to start.

            Any other approach suggestions are welcome; i am not tied to quartz in any way.

            • 3. Re: Using Seam from External Invocation
              Gavin King Master

              Have you tried using Seam 1.1 asynchronous methods?