[EJB 3.0 Users] - MBean with Scheduler: IllegalArgumentException
by myklynysh
Hello,
I want to create a MBean or stateless SessionBean, what has an method that should be called periodical e.g. every 10 second. I founded an example with modifying of scheduler-service.xml and created an interface and a MBean.
@Local
| public interface TestExampleMBean extends ServiceMBean {
|
| public void hitTest(int param);
|
| }
@Stateless
| public class TestExample extends ServiceMBeanSupport implements TestExampleMBean {
|
| public TestExample() {
| super();
| }
|
| public void hitTest(int param) {
| log.info("hitTest");
| }
|
| //..other methodes
| }
|
scheduler-service.xml has following code
<mbean code="cosee.reporting.service.example.TestExample"
| name=":name=TestExample">
| </mbean>
|
| <mbean code="org.jboss.varia.scheduler.Scheduler"
| name=":service=Scheduler,name=TestExample">
|
| <attribute name="StartAtStartup">true</attribute>
| <attribute name="SchedulableMBean">:name=TestExample</attribute>
| <attribute name="SchedulableMBeanMethod">hitTest(int)</attribute>
|
| <attribute name="InitialStartDate">NOW</attribute>
| <attribute name="SchedulePeriod">10000</attribute>
| <attribute name="InitialRepetitions">3</attribute>
| <attribute name="FixedRate">true</attribute>
| </mbean>
I deploy my application and while scheduling calls of the method IllegalArgumentException is being thrown every time.
I checked the parameter, the parameter types should be correct.
Stake trace looks so:
14:37:03,102 ERROR [Scheduler$BaseListener] Invoke failed for :name=TestExample hitTest
| javax.management.ReflectionException
| at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:189)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:165)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
| at org.jboss.varia.scheduler.Scheduler$MBeanListener.invoke(Scheduler.java:1316)
| at org.jboss.varia.scheduler.Scheduler$BaseListener.handleNotification(Scheduler.java:1235)
| at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
| at $Proxy215.handleNotification(Unknown Source)
| at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:257)
| at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(NotificationBroadcasterSupport.java:322)
| at javax.management.NotificationBroadcasterSupport$1.execute(NotificationBroadcasterSupport.java:307)
| at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:229)
| at org.jboss.mx.timer.JBossTimer.sendNotifications(JBossTimer.java:500)
| at org.jboss.mx.timer.JBossTimer.access$100(JBossTimer.java:63)
| at org.jboss.mx.timer.JBossTimer$RegisteredNotification.doRun(JBossTimer.java:662)
| at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:181)
| at org.jboss.util.timeout.TimeoutFactory$TimeoutTargetImpl.timedOut(TimeoutFactory.java:299)
| at org.jboss.util.timeout.TimeoutFactory$TimeoutWorker.run(TimeoutFactory.java:271)
| at org.jboss.util.threadpool.RunnableTaskWrapper.run(RunnableTaskWrapper.java:147)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: java.lang.IllegalArgumentException
| 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:157)
| ... 25 more
I don't really know, what I do wrong.
Thanks for your help
myklynysh
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268307#4268307
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268307
14 years, 5 months
[EJB 3.0 Users] - Re: EJB 3.0 lookup from Pojo and Injection
by MirekSz
I try explain exacly what I doing, the prevoius example wasn't real(but describe problem)
I have fasade
| @Stateful
| public class FasadeBean implements Fasade{
|
| @EJB
| private ChangedIdsCollectorService;
|
|
|
| public ServerResponse execute(String serviceName, String serviceMethod, Object[] arguments){
|
| Object result = serviceExecutor.execute(serviceName,serviceMethod, arguments);
|
| return new ServerResponse(result, ChangedIdsCollectorService.getChangedIds());
|
|
| }
|
|
| }
|
and service which collect ids of changed object(ENTITY)
| @stateles
| public class ChangedIdsCollectorServiceBean inplements ChangedIdsCollectorService{
|
| private List<Long> changedIds;
|
| public void addChangedId(Long id){
| changedIds.add(id);
| }
|
| public List<Long> getChangedIds(){
| return changedIds;
| }
|
| }
|
When i call fasade and execute for example ("OperatorService","update" , operatorEntity) this fasade invokes "OperatorService" and return updated enitity, but I also have in my Entity
metod which lookup for ChangedIdsCollectorService and add yourself to his list:
| public class AbstractEntity {
|
| @javax.persistence.PostUpdate
| public void changeListener(){
| Context context = new InitialContext();
| ChangedIdsCollectorService ChangedIdsCollectorService = ChangedIdsCollectorServicecontext.lookup("ChangedIdsCollectorService/local");
| ChangedIdsCollectorService.addChangedId(this.id);
|
|
| }
| }
|
In this way I get information about changed objects....update of operator can invokes some businness rule which can updates another object and I also will be have this Ids.
Now I don't now if in FasadeBean I will be have the same instance of ChangedIdsCollectorService (from injection) like in Entity(from lookup)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268305#4268305
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268305
14 years, 5 months
[jBPM Users] - Re: How to suspend Join Execution
by saraswati.santanu
Pradeep,
your problem is not very clear to me. It will be helpful if you can provide some code that can get the exception.
However, whatever I understood, an approach may be to add a start event listener on the join node and delete the tasks you do not need when there is a request for rework. A sample code for the start event listener of the join node may be like this:
| public void notify(EventListenerExecution execution) throws Exception {
| Task task = //find the task you need to invalidate
| //ugly casting. Is there a better way
| ((TaskImpl)task).setExecution((Execution)null);
| ((TaskImpl)task).setExecutionDbid(null);
| //now delete the task
| taskService.deleteTask(task.getId());
| }
|
You can always check and see if there is a better way to delete an existing task.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268294#4268294
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268294
14 years, 5 months