Failing to register a Cluster Singleton
wernerjoh Sep 14, 2010 5:31 AMHi!
I'm trying to do the following. I have to register an EJB3.0 as a singleton in a JBoss 5.1 GA in order have a single-point access to a onfiguration object it hands out. I want this to be ready to go as the server is loaded and not on first call.
In order to get this I have to get it into being a clusterwide singleton( well 2 nodes, 2 machines). I've tried several approaches. Just deploying the EJB in the /all/deploy-hasingleton directory, the -beans.xml approach which failed since I'm not up to speed on JMX annotations in xml file, name="" and so on and the classical JMX -service.xml
The last one works so and so, it does become a service with an interface in the JMX console and I can access it. It just doesn't move into the HA-JNDI namespace as I'd like it too which means I get the errors below. A NameNotFoundException which is a little odd as it registers it self in the Global JNDI tree when I look into the jboss.JNDIVIEW jmx bean.
I've used the JMX interface to interact with the bean and it does run as expected. It's not lost by any means. I've done a netstat -av and all ports are active and default so nothing should be whining there. I haven't seen it whine at that particularly problem anyway.
http://community.jboss.org/wiki/WritingaClusteredHASingletonService
This actually describes my problem down to the last detail, almost. In fact, this is the solution that I've used to get to
the state described above. For some reason however the @nnotations doesn't work as described and thusly I've had
to revert to the old xml way.
<<< snippets >>>
< jboss-service.xml in META-INF (whole file)>
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="se.ports.spikes.ClusterSingleton.NodeSingleton" name="dummy:service=NodeSingletonMBean">
</mbean>
<mbean name="ports.se:service=NodeSingleton-Controller" code="org.jboss.ha.singleton.HASingletonController">
<depends>dummy:service=NodeSingletonMBean</depends>
<attribute name="HAPartition">
<inject bean="HAPartition" />
</attribute>
<attribute name="TargetName">dummy:service=NodeSingletonMBean</attribute>
<attribute name="TargetStartMethod">startSingleton</attribute>
<attribute name="TargetStopMethod">stopSingleton</attribute>
</mbean>
</server>
< NodeSingleton.class (top of it)>
package se.ports.spikes.ClusterSingleton;
import java.util.Properties;
import javax.annotation.PostConstruct;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.annotation.ejb.*;
import org.jboss.util.naming.Util;
@Service( objectName = "dummy:service=NodeSingleton" ) // Doesn't seem to work
@Management( NodeSingleton.class )
public class NodeSingleton implements NodeSingletonRemote, NodeSingletonMBean {
Eclipse with Maven2 forces me into a Java compliance of 1.5 to see the annotations so I might have
done something wrong there.
This does produce the results described but I can't move beyond that. When I do a lookup later and
find the NodeSingleton I succeed to get a proxy. It's null however but it does think it has one at least.
Odd but true.
I've scoured through the forums to find what it is but it seems very likely to me I'm missing something very obvious.
Or rather I have to get this registered in the HA-JNDI properly is more like it.
Anyone got a clue to what I'm missing/doing wrong?
(english isn't my native language so please don't be offended or laugh your asses off
Error mess mentioned above:
15:29:14,971 ERROR [STDERR] javax.naming.NameNotFoundException: nodeSingletonJAR/NodeSingleton/remote
15:29:14,971 ERROR [STDERR] at org.jboss.ha.jndi.HAJNDI.lookupRemotely(HAJNDI.java:265)
15:29:14,971 ERROR [STDERR] at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:206)
15:29:14,972 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
15:29:14,972 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
15:29:14,972 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)
15:29:14,972 ERROR [STDERR] at se.ports.spikes.ClusterSingleton.NodeSingleton.start(NodeSingleton.java:99)
15:29:14,972 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:29:14,972 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
15:29:14,972 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
15:29:14,972 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
15:29:14,972 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
15:29:14,972 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
15:29:14,972 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
15:29:14,972 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
15:29:14,972 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
15:29:14,972 ERROR [STDERR] at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
15:29:14,972 ERROR [STDERR] at $Proxy38.start(Unknown Source)
15:29:14,972 ERROR [STDERR] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
15:29:14,972 ERROR [STDERR] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
15:29:14,972 ERROR [STDERR] at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
15:29:14,972 ERROR [STDERR] at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
15:29:14,972 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
15:29:14,972 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
15:29:14,973 ERROR [STDERR] at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
15:29:14,973 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
15:29:14,973 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
15:29:14,973 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
15:29:14,973 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
15:29:14,973 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
15:29:14,974 ERROR [STDERR] at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
15:29:14,974 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:460)
15:29:14,974 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
15:29:14,974 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
15:29:14,974 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
15:29:14,974 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
15:29:14,974 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
15:29:14,975 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
15:29:14,975 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
15:29:14,975 ERROR [STDERR] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
15:29:14,975 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
15:29:14,975 ERROR [STDERR] at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
15:29:14,975 ERROR [STDERR] at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
15:29:14,975 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
15:29:14,976 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
15:29:14,976 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
Other links I've used:
(Seemed to fit but once again)
http://docs.jboss.org/jbossclustering/cluster_guide/5.1/html/deployment.chapt.html
(Mainly to get an overview)