aspose file tools*
The moose likes JBoss/WildFly and the fly likes Service wont registerd on application deploy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Service wont registerd on application deploy" Watch "Service wont registerd on application deploy" New topic
Author

Service wont registerd on application deploy

ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
Hi, I am using Jboss5.1.x AS , EJB3.0 I am trying to add job(using Quartz) to my deployment. so I am registering new Service, so it will init the schedualer on application deploy. problem is: the service never got register when I deploy my app.

some code:

interface:

public interface ComponentMonitoringService{
void create() throws Exception;
void start() throws Exception;
void stop();
void destroy();
}


-----

@Service(objectName = "com.mirs.ecms.timer:service=ServerStartupManager")
@Management(ComponentMonitoringService.class)
public class ServerStartupManager implements ComponentMonitoringService
{

private SchedulerFactory schedulerFactory = null;
private Scheduler scheduler = null;
Logger logger = Logger.getLogger("ecms.log");

public void create() throws Exception
{
}

public void start() throws Exception
{
// Write your startup code

initScheduler();

}

private void initScheduler() throws ParseException, SchedulerException
{

schedulerFactory = new StdSchedulerFactory();
scheduler = schedulerFactory.getScheduler();

JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);
CronTrigger trigger1 = new CronTrigger("cronTrigger", "TriggersGroup1", "0 0/5 * * * ?");

scheduler.scheduleJob(startECMSJob, trigger1);

scheduler.start();
}

public void stop()
{
try
{
scheduler.shutdown();
} catch (Exception e)
{
logger.error("ServerStartupManager Failure occured during Manager stop", e);
}
}

public void destroy()
{
}
}

thanks ray.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

How are you packaging this application? And what's the full package name of the @Service annotation that you are using?

[My Blog] [JavaRanch Journal]
ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
I am using MyEclipse. so right now it all being packged under .ear file. my jboss5.1.x is installed locally.

about the " full package name of the @Service annotation that you are using" .. package name: org.jboss.annotation.ejb.service

ray
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

about the " full package name of the @Service annotation that you are using" .. package name: org.jboss.annotation.ejb.service


That's not the correct one for JBoss AS5. For JBoss AS5 and later, use @org.jboss.ejb3.annotation.Service. More details here
ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
I have this jar in my class path. but when I use @Service annotation, I can in the import options only the library i am currently using. how come?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

ray frid wrote:I have this jar in my class path.

That jar is for JBoss AS 4.x

ray frid wrote:
but when I use @Service annotation, I can in the import options only the library i am currently using. how come?


You need the JBOSS_HOME/client/jboss-ejb3-ext-api.jar in your classpath.
ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
YOU ARE THE BEST!!

man I have have struggle with this for 3 days now!!! first you found I am using the wrong annotation, second you told me where I should find the right one.
thanks again!!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

Glad to know it worked!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Service wont registerd on application deploy