Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trigger a method without using client.

 
vignesh hariharan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a situation where my ear is deployed into weblogic server, it should automatically trigger a method based on timer control.
I have used the Timer class and scheduled methods to do. But I could not find out how to make a call to the timer function.

step 1: jar file deployed to weblogic server
step 2: immediately once the deployment is done, without any human intervention, a method needs to be called.

Is ther anyways to obtain this?

I jus tried this steps below.: using ejb3.0
1. created a bean class with the timer implemention which will trigger a method on a particular time.
2. I have a remote class for which the bean has been implemented.
3. I have a client file which will use the lookup to call the bean.

Now my question is how can i avoid the client file?? when I deploy, the bean should automatically be called somehow.
Hope am clear.

This would be a great help. I tried google.. But quite helpless.

Thanks
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With EJB3.1 you can have auto scheduled timers. See this previous discussion for more information http://www.coderanch.com/t/477104/EJB-JEE/java/Java-EE-timer-service-periodical
 
vignesh hariharan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jai,

Thanks for that. It helped me. But still i get errors in making use of it.

below is my bean




is my remote..


I dont have a client. As far i read accross, I dont need a cleint program. but the thing is I use weblogic 10.3 and I dont ve a ejb3.1.jar so I jus added ejb31-api-experimental-3.1.1.jar which i found from findjar.com and i use weblogic.jar for ejb3.0 classes.

not sure if this cud be the probelm. Can you help with that?


below is the err:

Exception preparing module: EJBModule(timerTest1) Unable to deploy EJB: timerTest1.jar from timerTest1.jar: There are 1 nested errors: weblogic.ejb.container.compliance.ComplianceException: No business interface, component interface or web service endpoint interface found for Session Bean TestTimer at weblogic.ejb.container.compliance.SessionBeanClassChecker.checkInterfacesExist(SessionBeanClassChecker.java:177) at weblogic.ejb.container.compliance.Ejb30SessionBeanClassChecker.checkInterfacesExist(Ejb30SessionBeanClassChecker.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that version of WebLogic support EJB3.1?
 
vignesh hariharan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Jai

Weblogic 10.3 doesnt support ejb3.1
But i manually dragged the jars which contains javax.ejb.schedule etc.. and added it to eclipse buildpath..
will that not be suffice for it to work??

Thanks
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vignesh hariharan wrote:


But i manually dragged the jars which contains javax.ejb.schedule etc.. and added it to eclipse buildpath..
will that not be suffice for it to work??



No. Just adding jars will not provide the services which the service is expected to implement. You'll have to upgrade to a version of WebLogic (or some other server) which supports EJB3.1, if you want to use this feature.
 
vignesh hariharan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh Ok. Is ter any other way I can achieve this? I am not concerned abt using @schedule.. But I somehow need an idea to do auto timers with ejb3.0 in WLS10.3
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are other ways to schedule jobs, like the java.util.Timer and TimerTask classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic