]
Pete Muir updated JBSEAM-2694:
------------------------------
Fix Version/s: 2.1.x
QuartzDispatcher and ClassNotFoundException
---------------------------------------------
Key: JBSEAM-2694
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2694
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 2.0.1.GA
Environment: AS 4.2.1
Reporter: Markus Heidt
Fix For: 2.1.x
Error Message after startup of JBoss AS
***********************
21:16:01,118 ERROR [ErrorLogger] Job (DEFAULT.-6ad11a7d:1185c88089f:-7f8e threw an
exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
[See nested exception: org.jboss.seam.InstantiationException:
Could not instantiate Seam component: danteUsersRetriever]
at org.quartz.core.JobRunShell.run(JobRunShell.java:214)
...
Caused by: javax.naming.CommunicationException
[Root
exception is java.lang.ClassNotFoundException:
No ClassLoaders found for: org.domain.QuartzTest.session.DanteUsersRetriever
(no security manager: RMI class loader disabled)]
**********************
Reproducible:
* Create new seam project
* change components.xml:
***********************
<components
...
xmlns:async="http://jboss.com/products/seam/async"
...
xsi:schemaLocation=
"...http://jboss.com/products/seam/async
http://jboss.com/products/seam/async-2.0.xsd...
>
<async:quartz-dispatcher/>
***********************
* Add two classes
DanteUsersTimer.java
***********************
package org.domain.QuartzTest.session;
import org.jboss.annotation.ejb.Local;
@Local
public interface DanteUsersTimer {
public void start() throws Exception;
public void cancel();
public void stop();
}
***********************
DanteUsersTimerBean.java
***********************
package org.domain.QuartzTest.session;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.async.CronSchedule;
import org.jboss.seam.async.QuartzDispatcher;
import org.jboss.seam.async.QuartzTriggerHandle;
import org.jboss.seam.log.Log;
@Name("danteUsersTimer")
@Scope(ScopeType.APPLICATION)
@Startup
public class DanteUsersTimerBean implements DanteUsersTimer {
private static final String defaultTrigger = "1 * * * * ?"; //every minute
@Logger private Log log;
private QuartzTriggerHandle handle;
private String trigger = defaultTrigger;
@Observer("org.jboss.seam.postInitialization")
public void start() throws Exception{
setTrigger(defaultTrigger);
}
public void restoreDefault(){
setTrigger(defaultTrigger);
}
public void setTrigger(String trigger){
try{
QuartzTriggerHandle handle =
QuartzDispatcher.instance().scheduleTimedEvent("retrieveDanteUsers",
new CronSchedule((Long) null, trigger));
if (this.handle != null)
this.handle.cancel();
this.handle = handle;
this.trigger = trigger;
}
catch (Exception e){
log.error("setTrigger(): #0", e, trigger);
}
}
public String getTrigger(){
return trigger;
}
public void cancel(){
try{
if (handle != null)
handle.cancel();
handle = null;
trigger = null;
}
catch (Exception e){
log.error("cancel(): #0", e, trigger);
}
}
@Destroy
public void stop(){
cancel();
}
}
***********************
DanteUsersRetriever.java
***********************
package com.dai.dante_tscm.session.users;
import org.jboss.annotation.ejb.Local;
@Local
public interface DanteUsersRetriever {
public void retrieve();
}
***********************
DanteUsersRetrieverBean.java
***********************
package com.dai.dante_tscm.session.users;
import javax.ejb.Stateless;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.log.Log;
@Name("danteUsersRetriever")
@Stateless
public class DanteUsersRetrieverBean implements DanteUsersRetriever{
@Logger private Log log;
@Observer("retrieveDanteUsers")
public void retrieve() {
log.info("retrieve dante users");
}
}
***********************
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: