aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes trigger a method without using client. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "trigger a method without using client." Watch "trigger a method without using client." New topic
Author

trigger a method without using client.

vignesh hariharan
Ranch Hand

Joined: Jun 23, 2005
Posts: 77
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


Regards,
vignesh
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10205
    
166

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

[My Blog] [JavaRanch Journal]
vignesh hariharan
Ranch Hand

Joined: Jun 23, 2005
Posts: 77
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

Joined: Jul 20, 2005
Posts: 10205
    
166

Does that version of WebLogic support EJB3.1?
vignesh hariharan
Ranch Hand

Joined: Jun 23, 2005
Posts: 77
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

Joined: Jul 20, 2005
Posts: 10205
    
166

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

Joined: Jun 23, 2005
Posts: 77
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

Joined: Oct 14, 2008
Posts: 1337
There are other ways to schedule jobs, like the java.util.Timer and TimerTask classes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trigger a method without using client.