[EJB 3.0 Users] - Re: Client calls Timer only once
by Fuchs
The Bean class:
| @Stateless
| @Remote (CustomerArchivTimerBean.class)
| public class CustomerArchivTimerBean implements CustomerArchivTimerProxy
| {
| private @Resource SessionContext ctx;
|
| public void scheduleTimer(Date expiration, Serializable info)
| {
| System.out.println("Create single action timer [info=" + info + "]");
| ctx.getTimerService().createTimer(expiration, info);
| }
|
| public void scheduleTimer(long initialDuration, long intervalDuration, Serializable info)
| {
| System.out.println("Create initial+interval timer [info=" + info + "]");
| ctx.getTimerService().createTimer(initialDuration, intervalDuration, info);
| }
|
| public void cancelTimer(Serializable info)
| {
| System.out.println("Cancel timer [info=" + info + "]");
| Collection<Timer> timers = ctx.getTimerService().getTimers();
| for (Timer timer : timers)
| {
| if (timer.getInfo().equals(info))
| {
| System.out.println("Timer[info=" + info + "] found, cancelling...");
| timer.cancel();
| System.out.println("Timer[info=" + info + "] cancelled");
| }
| }
|
| }
|
| @Timeout
| public void timeoutHandler(Timer timer) throws Exception
| {
| System.out.println("Received timer event: " + timer.getInfo());
| Date date = new Date(System.currentTimeMillis());
| System.out.println("Current time is: " + date + ", origin: timeoutHandler");
| cancelTimer("CustomerArchivTimer");
| }
|
| }
|
The interface of the Bean:
| public interface CustomerArchivTimerProxy
| {
|
| public void scheduleTimer(Date expiration, Serializable info);
|
| public void scheduleTimer(long initialDuration, long intervalDuration, Serializable info);
|
| public void cancelTimer(Serializable info);
|
| public void timeoutHandler(Timer timer) throws Exception;
|
| }
|
The client methods are:
| public static void main(String[] args) throws Exception
| {
|
| testClusterScheduleIntervalTimer();
| System.out.println("Timer scheduled to trigger after 10 seconds");
| }
|
| public static void testClusterScheduleIntervalTimer() throws Exception
| {
| InitialContext ctx = new InitialContext();
| CustomerArchivTimerProxy timer = (CustomerArchivTimerProxy) ctx.lookup("CustomerArchivTimerBean/remote");
| timer.scheduleTimer(10000, 5000, "CustomerArchivTimer");
| }
|
The jndi properties:
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=localhost
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262319#4262319
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262319
16 years, 6 months
[JBoss Messaging Users] - JBoss Messaging 1.4.2 Fails - JBoss AS 5.0.1 Startup
by raja8183
Hi,
I've been for so long tryign to start the JBoss Messaging server on my JBoss 5.0.1 AS. I have been able to do this on a different context root. The error Ive come across is:
6:46:16,281 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/C:/JavaTools/jboss-5.0.1.GA/server/dispatch/deploy/messaging-service.xml state=PreReal mode=Manual requiredState=Real
| org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.messaging:service=ServerPeer
| at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
| at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:118)
| at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
| at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
| at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
| at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
| at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
| at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
| at org.jboss.Main.boot(Main.java:209)
| at org.jboss.Main$1.run(Main.java:547)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.RuntimeException: No Attribute found with name: SecurityDomain for jboss.messaging:service=ServerPeer, attributes: [ProviderVersion, DefaultExpiryQueue, DefaultMaxDeliveryAttempts, ServerAopConfig, JMSProviderName, FailoverCompleteTimeout, JMSVersion, DefaultRedeliveryDelay, StrictTck, Destinations, FailoverStartTimeout, MessageStatistics, RecoverDeliveriesTimeout, DefaultPreserveOrdering, ClientAopConfig, DefaultMessageCounterHistoryDayLimit, DefaultDLQ, SuckerPassword, Instance, DefaultTopicJNDIContext, ServerPeerID, ClusterPullConnectionFactoryName, PostOffice, PersistenceManager, EnableMessageCounters, MessageCounters, ProviderMajorVersion, JMSMajorVersion, DefaultQueueJNDIContext, SecurityStore, JMSUserManager, JMSMinorVersion, SupportsFailover, MessageCounterSamplePeriod, ProviderMinorVersion]
| at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:142)
| at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:114)
| at org.jboss.system.microcontainer.ConfigureAction.installAction(ConfigureAction.java:58)
| at org.jboss.system.microcontainer.ConfigureAction.installAction(ConfigureAction.java:42)
| at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
| at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
| at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
| at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
| at org.jboss.system.ServiceController.install(ServiceController.java:274)
| at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:90)
| ... 23 more
|
Also, I did try to comparing the two contexts, i.e the earlier good context with the the new one, the one trying to get things working.
Thanks,
Rama
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262299#4262299
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262299
16 years, 6 months
[JBoss Microcontainer Users] - Re: Optional depends?
by alesj
To make this work w/o ugly hacks you simply need double configuration.
Where in one of them you actually have a mock mod_cluster supply.
Otherwise this is pretty much hackish to achieve,
as you still heavily depend on deployment order.
e.g.
jbossweb is deployed first, at that time mod_cluster is not present in any state,
hence optional dependency is satisfied and afterwards never re-invoked.
But if the order was different you would wire up that optional dependency.
To make this "work" you would have to hack around the cleanup code
in order not to leave something hanging at the end and get incomplete deployment error.
With some mock object you always have proper order,
where in the mock case all you do is tag some bean as mod_cluster supplier.
We have an optional inject, but this is/should mostly be used when you know
you have a phase split - trying to optionally inject something from deployers/ into deploy/ beans.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262288#4262288
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262288
16 years, 6 months