[jboss-user] [JBoss Seam] - Asynchronous method triggered multiple times.
I've a Stateless local Session Bean which defines an asynchronous method which is launched at startup by an observer method. Everything works fine except that the method is triggered multiple times simultaneously. Any idea why? Neither the TimeService implementation nor the Quartz implementation solves the issue. Here's the Session Bean interface: | @Local | public interface SendMailJob { | | @Asynchronous | public void processMailQueue(@Duration long start, @IntervalDuration long interval); | | } | Here's the Session Bean implementation: | @Stateless(name = SendMailJob) | @Name(sendMailJob) | public class SendMailJobImpl implements SendMailJob { | | @Resource(name=jdbc/luxair_asr_Datasource) | private DataSource dataSource; | | @Resource(name=mail/luxair_asr_MailSession) | private Session mailSession; | | | @Logger | private Log log; | | | public void processMailQueue(long start, long interval) { | | // ... | } | } | Here's the component that launches the asynchronous method at startup: | @Name(sendMailJobLauncher) | public class SendMailJobLauncher { | private long interval; | | public void setInterval(long interval) { | this.interval = interval * 60 * 60 * 1000; | } | | // | // Resource | // | | @In(create = true) | private SendMailJob sendMailJob; | | @Logger | private Log log; | | @Observer(org.jboss.seam.postInitialization) | public void statup() { | log.info(startup() launch sendMailJob [interval: {0}], interval); | sendMailJob.processMailQueue(2 * 60 * 1000, interval); | } | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4110520#4110520 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4110520 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - @Asynchronous mail example fails
Hi, Sending a simple mail works fine but sending a simple mail asynchronously fails with java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factor. I am using jboss-seam-2.0.0.CR3 and jboss-4.2.1.GA Exception is | | 09:01:45,708 ERROR [STDERR] java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory | 09:01:45,709 ERROR [STDERR] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256) | 09:01:45,709 ERROR [STDERR] at org.jboss.seam.mock.MockFacesContext.init(MockFacesContext.java:60) | 09:01:45,709 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.init(FaceletsRenderer.java:95) | 09:01:45,709 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.run(FaceletsRenderer.java:77) | 09:01:45,709 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:169) | 09:01:45,709 ERROR [STDERR] at org.jboss.seam.example.mail.AsynchronousMailProcessor.scheduleSend(AsynchronousMailProcessor.java:18) | 09:01:45,710 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | 09:01:45,710 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | 09:01:45,710 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | 09:01:45,710 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | 09:01:45,710 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:50) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.example.mail.AsynchronousMailProcessor_$$_javassist_2.scheduleSend(AsynchronousMailProcessor_$$_javassist_2.java) | 09:01:45,711 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | 09:01:45,711 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | 09:01:45,711 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | 09:01:45,711 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125) | 09:01:45,711 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52) | 09:01:45,712 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76) | 09:01:45,712 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45) | 09:01:45,712 ERROR [STDERR] at org.jboss.seam.async.ThreadPoolDispatcher$RunnableAsynchronous.run(ThreadPoolDispatcher.java:114) | 09:01:45,712 ERROR [STDERR] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) | 09:01:45,712 ERROR [STDERR] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) | 09:01:45,712 ERROR [STDERR] at java.util.concurrent.FutureTask.run(FutureTask.java:123) | 09:01:45,712 ERROR [STDERR] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65) | 09:01:45,712 ERROR [STDERR] at
[jboss-user] [JBoss Seam] - @Asynchronous @TransactionTimeout
I wish to launch transaction that takes hours from a Quartzed Asynchronous method: | @Asynchronous | @Transactional | @TransactionTimeout(10) | public QuartzTriggerHandle scheduleAsynchronousJob(@Expiration Date expiration, AsynchronousJob asynchronousJob) | { But this return for long transactions: 10:22:46,205 ERROR [JobRunShell] Job DEFAULT.-723041d8:114f8ca2bc8:-7fef threw an unhandled Exception: | java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active! | at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.rollbackAndDisassociate(TransactionImple.java:1466) | at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:163) | at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:126) | at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:148) | at org.jboss.seam.transaction.UTTransaction.rollback(UTTransaction.java:66) | at org.jboss.seam.util.Work.workInTransaction(Work.java:52) | at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:42) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106) | at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155) | at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91) | at org.jboss.seam.oxalya.carriocas.AsynchronousJobQuartz_$$_javassist_1.scheduleAsynchronousJob(AsynchronousJobQuartz_$$_javassist_1.java) | 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:597) | at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) | at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124) | at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52) | at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76) | at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45) | at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:289) | at org.quartz.core.JobRunShell.run(JobRunShell.java:203) | at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) Any idea to solve this? Thank you View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4083326#4083326 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4083326 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Asynchronous JavaBean method not getting called
I have a method in a JavaBean that sends out an email and I'd quite like it to be asynchronous. My method is annotated with @Asynchronous and I have async:timer-service-dispatcher/ in my components.xml. However the method never gets called even though I do explicitly call it. @Asynchronous | public void send(Company company, String[] roles, String subject, String content) { | //stuff | } If I comment out the @Asynchronous then the method is called fine and my email is sent. I'm using Seam 1.3.0.ALPHA (should really upgrade but waiting for 2.0.GA) and in my components.xml I've set it to use the async-2.0.xsd as none exists for 1.3. Are there any issues/tricks that I should be aware of? The Seam Mail example works fine on the same server and my config looks the same (for the async stuff). Thanks, Damian. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4077331#4077331 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4077331 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Asynchronous call before App Startup
Hi, I'm using JBoss Seam 1.2.1.GA. I've been trying to start an asynchronous process that send out notifications of an event in emaisl immediately the application starts up. This event may have already been configured during a previous run of the application. The asyncrhronuous method also needs to have access to an EntityManager to read the details of the event and to a facelet-configured email template. The problem is i don't know how to automatically invoke the asynchronous method before the first user even logs in and what scope to outject the list of recepients and data so that the email template can send it. I've tried @Startup and @Scope(APPLICATION) but the contexts are not configured at that stage so i get a null pointer. Any ideas? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4067426#4067426 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4067426 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Asynchronous Problem
Hello, I need an asynchronous process in my web application. So i use the @Asynchronous annotation to do the job but i need a mean to inform my Stateful EJB that the job is done. 1. First, i use the @Observer and RaiseEvent Without sucess because of Asynchronous annotation 2. Second, i use jms to send a message when the job is done but my MDB is stateless so no acess to my EJB stateful. 3. Third, same technique but i send in the message My EJB Stateful (Sorry), but it crashed due to some transactions problems. So, is there a solution ? Use business context to save job done and use it in my EJB stateful to see that there is an event? Thanks for your help. Problem in the third scenario : 11:59:30,749 ERROR [JmsServerSession] Unexpected error delivering message org.jboss.mq.SpyObjectMessage { Header { jmsDestination : TOPIC.refreshTopic jmsDeliveryMode : 2 jmsExpiration : 0 jmsPriority : 4 jmsMessageID: ID:6-11838023706871 jmsTimeStamp: 1183802370687 jmsCorrelationID: null jmsReplyTo : null jmsType : null jmsRedelivered : false jmsProperties : {} jmsPropReadWrite: false msgReadOnly : true producerClientId: ID:6 } } java.lang.ClassCastException: cannot assign instance of org.jboss.seam.intercept.ClientSideInterceptor to field org.jboss.seam.oxalya.carriocas.RefreshEvent.sessionVisuList of type org.jboss.seam.oxalya.carriocas.SessionVisuList in instance of org.jboss.seam.oxalya.carriocas.RefreshEvent at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2004) at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1184) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1914) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:147) at org.jboss.seam.oxalya.carriocas.RefreshList.onMessage(RefreshList.java:33) 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 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:116) at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53) 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 org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66) at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) at
[jboss-user] [JBoss Seam] - @Asynchronous @Observer - Poll raising
Hello, How raising an Event from an Asynchronous method? Basically: newSessionBean.java | ... |public String step1() |{ | sessionVisu = new SessionVisu(sessionVisu, user); | sessionVisu.setStatus(description); | computeHandler.processGetComputes(sessionVisu); | return /sessions.xhtml; |} | ... | ComputeHandlerBean.java | ... | @Asynchronous | public void processGetComputes(SessionVisu sessionVisu){ | try {SECONDS.sleep(30);} | catch(InterruptedException ignore){} | sessionVisu = entityManager.merge(sessionVisu); | sessionVisu.setStatus(compute); | entityManager.persist(sessionVisu); | events.raiseTransactionSuccessEvent(flushComputeSessionVisus); |} | ... | SessionVisuListBean.java | ... | @Factory | @Observer(flushComputeSessionVisus) | public void getComputeSessionVisus() | { | computeSessionVisus = entityManager.createQuery(select s from SessionVisu s where s.user.username = :username and s.status = :status) | .setParameter(username, user.getUsername()) | .setParameter(status, compute) | .getResultList(); | } | ... | The idea is to have a portlet polled by Ajax4jsf. I used in my componentd.xml framework:entity-query name=sessionVisuCompute | framework:ejbqlfrom SessionVisu s/framework:ejbql | framework:restrictions | valueuser_id = #{userComp.id}/value | valuestatus = #{sessComp.status}/value | /framework:restrictions |/framework:entity-query | |component name=userComp class=User | property name=id#{user.id}/property |/component |component name=sessComp class=SessionVisu | property name=statuscompute/property |/component But i really wish to use the event/observer mechanism. Any idea? Thank you View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4060435#4060435 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4060435 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Asynchronous seam mail can not get the base URL dynamically
Hi, While creating a user account, I'm trying to invoke an asynchronous method in my SLSB to send the activation mail. In my activation mail template, I'm trying to resolve the activation URL dynamically instead of having a static one. I tried the following methods and none of them gets the correct URL: s:link - resolves to /project/activation.seam - I don't know where the project is coming from 'cause that is not my application context path #{facesContext.externalContext.requestContextPath} - resolves to null defined a factory variable and try to use #{basePath} - resolves to null factory name=basePath scope=APPLICATION value=#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}// finally tried to inject facesContext in the SLSB that renders the mail template, and it fails to inject. Finally concluded that it is 'cause of asynchronous method. I think it looses all the contexts when it is run. If I make it synchronous, everything works fine. Has anyone come across this problem? Is there a way to set contexts for asynchronous methods? Thanks View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058956#4058956 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058956 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - @Asynchronous / Conversations / Transactions Best Practices
I have an asynchronous method started from a SLSB. I know I can access the entitymanager in the async SLSB, is it possible to have Conversations or some type of fine grained transaction control. My async method takes a list of records and iterates over each record. I need to have the processing for each record occur in a separate transaction. If I don't use the method in the async mode, I can use Nested Conversations for each record (at least that is what Im trying to get working now). It seems that I can not use the conversation context (even a new one) within an async method. I figure there has to be a way to have control over transactions, I just don't know enough about J2EE transaction control to figure it out. Any pointers would be helpful. Thanks, Chris View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058299#4058299 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058299 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - @Asynchronous call fails after upgrade to AS 4.2.0.GA
I had an aysnchronous call that was working fine until I upgraded to AS 4.2.0.GA. From my logs I get the following stack trace when I try to invoke the ansyc method. Has anyone got an idea on what might cause this? Regards, Chris. 14:44:42,187 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is [EMAIL PROTECTED] | 14:44:42,187 ERROR [TimerServiceImpl] Cannot create txtimer | java.lang.IllegalStateException: Unable to persist timer | at org.jboss.ejb.txtimer.DatabasePersistencePolicy.insertTimer(DatabasePersistencePolicy.java:124) | 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:597) | 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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) | at $Proxy30.insertTimer(Unknown Source) | at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:256) | at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:171) | at org.jboss.ejb3.timerservice.jboss.TimerServiceFacade.createTimer(TimerServiceFacade.java:71) | at org.jboss.seam.core.Dispatcher.schedule(Dispatcher.java:228) | at org.jboss.seam.core.Dispatcher.scheduleInvocation(Dispatcher.java:205) | 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:597) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) | at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) | at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57) | at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) | at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103) | at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53) | at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:597) | at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) | at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126) | at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at
[jboss-user] [JBoss Seam] - Asynchronous programming pattern
Whenever we make an asynchronous method call, a thread will be dispatched. It works well so far but we encountered serveral asynchronous call requirements such as doing calculation when rolling over a day, sending reminder message for a payment due, expiring a registration for certain condition. A scheduled task might be cancelled in the middle, say, a payment made after the reminder scheduled to send but before actually sending it. Firstly we just simple make a asynchronous call when needed, but it turns out there are too many threads running. We worry about the performance and resources even though we haven't experienced them yet. We tried to make only one asynchronous call with interval at every 5 minutes. The other scheduled tasks are registered with it, and the tasks will mature within 5 minutes will be dispatched with a one-off asynchronous call by this thread. The problem here is that the one-off asynchronous calls run immidiately and the expiration or duration totally get ignored. Thus the scheduled time might have discrepancy in 5 minutes. Does Seam support to make an asynchronous call from another asynchronous call? Or has anybody got another programming pattern to fulfill such kind of requirements. In case I incorrently programmed the asynchronous feature, I pasted the code below: | //Making an asynchronous call to look after the other scheduled tasks | | @Name(scheduleDispatcherAction) | @Scope(ScopeType.APPLICATION) | @Synchronized | @Startup | public class ScheduleDispatcherAction implements ScheduleDispatcher, Serializable { | | @In(create = true) | private ScheduleService scheduleServiceAction; | | @Create | public void startService() { | ... | scheduleServiceAction.dispatchTasks(cal.getTime(), ScheduleService.INTERVAL_MILLIS); | | cal.add(Calendar.MINUTE, 1); | ScheduledTask task = new ScheduledTask(new Long(1), cal.getTime(), 45000, miscAction, test1, null); | ScheduleServiceAction.addTask(task); | cal.add(Calendar.MINUTE, 1); | task = new ScheduledTask(new Long(2), cal.getTime(), 0, miscAction, test2, null); | ScheduleServiceAction.addTask(task); | } | | //The method to dispatch the scheduled tasks | | @Name(scheduleServiceAction) | @Scope(ScopeType.APPLICATION) | @Synchronized | public class ScheduleServiceAction implements ScheduleService, Serializable { | | @Asynchronous | public void dispatchTasks(@Expiration Date startDate, @IntervalDuration long interval) { | IteratorScheduledTask iter = taskPool.iterator(); | while (iter.hasNext()) { | ScheduledTask aTask = iter.next(); | long dueMillis = aTask.getStartDate().getTime() - System.currentTimeMillis(); | if (dueMillis ScheduleService.INTERVAL_MILLIS) { | break; | } else if (dueMillis 0) { | dueMillis = 0; | } | | Object action = Component.getInstance(aTask.getActionName(), ScopeType.APPLICATION); | Method method = action.getClass().getMethod(aTask.getMethodName(), new Class[]{long.class, Object[].class}); | method.invoke(action, dueMillis, aTask.getParameters()); | // It's the same result if not using reflection here. | ... | | //Task code | | @Name(miscAction) | @Scope(ScopeType.APPLICATION) | @Synchronized | public class MiscAction implements MiscService, Serializable { | | @Asynchronous | public void test1(@Duration long duration, Object[] paras) {; | System.out.println(test1 started at + (new Date())); | } | | @Asynchronous | public void test2(@Duration long duration, Object[] paras) { | System.out.println(test2 started at + (new Date())); | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045329#4045329 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045329 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - @Asynchronous
Hi, I'm using @Asynchronous on a SFSB and I get the expected behaviour. The current thread is not being blocked until the method completes. However, if I use a non HTTP client and a context lookup, then the active thread is actually being blocked, until the method finishes. So if use something like: | sfsb = (MySFSB) initialContext.lookup(/myApp/MySFSB/remote); | sfsb.asychronousCall(); | then the call blocks the current thread. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4043513#4043513 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4043513 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Asynchronous em problem
Hi, I got Application context collection: @In(scope=ScopeType.APPLICATION, value=schedulerDates, required=false) @Out(scope=ScopeType.APPLICATION, value=schedulerDates, required=false) List schedulerDates; If user do some update to DB, also automatic adds the date of excecute to my app scope collection. And my problem is with asynhronous em. I got method in my class who is fired every 5 sek. and i got error with my Entity Manager? Here is declaration @In(create=true) protected EntityManager em; and problem. | 00:16:24,118 WARN [Contexts] Could not destroy component: em | org.hibernate.TransactionException: Could not register synchronization | can anyone tell me how to well implement my em in class or what that problem means? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4040346#4040346 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4040346 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - asynchronous workflow in seam without jBPM
i built a pipeline within my seam application. that is, a user can upload a file to the server and as soon as the file is uploaded, the pipeline starts. even when the user logs out, the pipeline still runs until every task is comleted. the several tasks read file contents and save it into a database. my problem now is that i can't Inject my EntityManager or the Seam Logger into my Pipeline classes. EntityManager and Logger are always null. This Pipeline classes are ThreadPoolExecutors with @Name Annotation. In all other classes (e.g.my UploadBean which is sateless) i can inject the EntityManager and the em.persist(obj) works fine.I remember that i got an no application context active exception, has that anything to do with it? I now try to solve this problem by using jBPM, but is this the only way to implement async workflow? the following is one of my PipeLine classes which will thorow a null pointer exception while trying to persist a task due EntityManager is null because its not injected @Name(convertexecutor) public class ConvertExecutor extends PipelineExecutor implements IPipelineExecutor { @In private EntityManager entityManager; public ConvertExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); } protected void beforeExecute(Thread t, Runnable r) { super.beforeExecute(t, r); } protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); SplitTask task = new SplitTask(((PipelineTask) r).getUserUpload(), ((PipelineTask) r).getPriority()); ExecutorManager.getSplitExecutor().execute(task); entityManager.persist(task); } } View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4022035#4022035 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4022035 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - asynchronous invokations
i tryied to make a synchronous calls to ejb methods following the doc guidelines and after i reverted my code, removing dispatcher and all the stuff i continue to get events every 10 seconds, that's the debug log: 16:19:34,656 DEBUG [SessionBeanInterceptor] post construct phase for component instantiated outside Seam, assu | ming default role: org.jboss.seam.core.dispatcher | 16:19:34,656 ERROR [TimerImpl] Error invoking ejbTimeout: java.lang.RuntimeException: java.lang.NullPointerExc | eption after 2 days of searching i really dont know where to continue looking for. Does anybody have a suggestion? thanks View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4016425#4016425 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4016425 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - @Asynchronous / Dispatcher not bound
Hi, just a short question: Is the @Asynchronous Annotation only supposed to be working on JBoss AS ? Or should a deployment on/in Tomcat be working as well? bye, Michael View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=3992791#3992791 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3992791 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user