[jboss-user] [EJB/JBoss] - TimerService Restart Issue
dolsen
do-not-reply at jboss.com
Thu Feb 19 10:54:10 EST 2009
I have the following Timer service class defined:
| @Stateless
| @RemoteBinding(jndiBinding="XXXCommandRemote")
| public class XXXCommandBean implements XXXCommandRemote
| {
| static Logger logger = Logger.getLogger(XXXCommandBean.class);
|
| @Resource TimerService timerService;
|
| public void scheduleCommand(Command command)
| {
| timerService.createTimer(command.getDuration(), command);
| }
|
| public void scheduleContinousCommand(Command command)
| {
| timerService.createTimer(command.getDuration(), command.getDuration(), command);
| }
|
| @Timeout
| public void runCommand(Timer timer)
| {
| Command command = (Command) timer.getInfo();
|
| logger.debug("runCommand: Firing command for user: " + command.getUserId() + " " + command.getDescription());
|
| User user = null;
|
| System.setProperty("java.security.policy", "server.policy");
| if (System.getSecurityManager() == null)
| {
| System.setSecurityManager(new RMISecurityManager());
| }
|
| InitialContext jndiContext;
| try
| {
| jndiContext = getInitialContext();
| UserRemote playerRef = (UserRemote) jndiContext.lookup("UserRemote");
| USerRemote dao = (UserRemote) PortableRemoteObject.narrow(playerRef, UserRemote.class);
| user = dao.findUser(command.getUserId());
| }
| catch (NamingException e)
| {
| logger.error("NamingException: ", e);
| }
| ...
|
This seems to work fine in normal cases.
However, if I have a command scheduled for the future, and then restart the app server I get the following error when the Timeout hook runs:
| 2009-02-19 08:31:04,125 DEBUG [org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory] (EJB-Timer-1235057250689[target=jboss.j2ee:ear=feudalism.ear,jar=feudalism
| -beans.jar,name=XXXCommandBean,service=EJB3]) Created Proxy of type $Proxy140 for EJB3 Business Interface: com.feudalism.session.user.UserRemote
| 2009-02-19 08:31:04,125 ERROR [com.feudalism.session.user.UserBean] (EJB-Timer-1235057250689[target=jboss.j2ee:ear=feudalism.ear,jar=feudalism-beans.jar,name=XXXCommandBean,service=EJB3]) NamingException:
| javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@
| 13c72d{vfsfile:/C:/java/jboss-5.0.0.GA/jboss-5.0.0.GA/server/feudalism/deploy/ejb2-timer-service.xml}]
| at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1463)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:809)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at com.feudalism.session.command.XXXCommandBean.runCommand(XXXCommandBean.java:92)
|
This is happening during lookup:
UserRemote playerRef = (UserRemote)jndiContext.lookup("UserRemote");
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211527#4211527
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211527
More information about the jboss-user
mailing list