-
1. Re: cluster-singleton @MDB on jboss 7 - how?
yigongjoyce Jul 17, 2012 2:43 AM (in response to hatchetman82)you can try to use Barrier
with Annotation @Depends(value="jboss.ha:service=HASingletonDeployer,type=Barrier")
good luck!
-
2. Re: cluster-singleton @MDB on jboss 7 - how?
wdfink Jul 17, 2012 4:55 AM (in response to yigongjoyce)The annotation will not work in AS7, there is no longer a HASingletonDeployer
-
3. Re: cluster-singleton @MDB on jboss 7 - how?
wdfink Jul 17, 2012 5:01 AM (in response to hatchetman82)There is a RFE for such HASingletonDeployer in AS7 see AS7-4894 but it is not available yet.
You might use a SIngletonService for that, see quickstart
-
4. Re: cluster-singleton @MDB on jboss 7 - how?
hatchetman82 Jul 17, 2012 10:37 AM (in response to wdfink)thats correct, @DependsOn (couldnt find @Depends anywhere ?) doesnt work.
what i eventually did is write a clustered-singleton "relay" service that relays messages from the topic to a queue, from which standard @MDBs can pull jobs across the cluster ("greatly inspired" by the above quickstart :-) )
the result looks something like this:
{code}
public class SingletonServiceBean implements Service<UUID> {
private final static Logger log = LoggerFactory.getLogger(SingletonServiceBean.class);
public static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append("j2eeshop", "SingletonServiceBean");
public static final String SYNC_CACHE_MANAGER_NAME = "j2eeshop";
private FinishSignal signal;
private final AtomicBoolean started = new AtomicBoolean(false);
private final InjectedValue<ServerEnvironment> env = new InjectedValue<ServerEnvironment>();
private final InjectedValue<HornetQServer> hornet = new InjectedValue<HornetQServer>();
private Connection connection;
private Session session;
private MessageConsumer consumer;
private MessageProducer producer;
public SingletonServiceBean(FinishSignal signal) {
this.signal = signal;
}
@Override
public void start(final StartContext context) throws StartException {
log.error("SingletonServiceBean starting");
try {
InitialContext ic = new InitialContext();
ConnectionFactory connectionFactory = (ConnectionFactory) ic.lookup("java:/ConnectionFactory");
Topic sourceTopic = (Topic) ic.lookup("java:/topic/j2eeShop/events");
Queue targetQueue = (Queue) ic.lookup("java:/queue/j2eeShop/workQueue");
connection = connectionFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
consumer = session.createConsumer(sourceTopic);
producer = session.createProducer(targetQueue);
MessageListener listener = new MessageListener() {
@Override
public void onMessage(Message message) {
try {
String payload = ((TextMessage) message).getText();
log.error("RELAY got a message: {}, attempting to relay", payload);
producer.send(message, message.getJMSDeliveryMode(), message.getJMSPriority(), message.getJMSExpiration());
log.error("RELAY relayed successfully");
} catch (JMSException e) {
log.error("while trying to relay message " + message, e);
throw new IllegalStateException(e);
}
}
};
consumer.setMessageListener(listener);
connection.start();
started.set(true);
log.error("SingletonServiceBean started");
signal.finished();
this.signal=null; //disconnect reference (just in case)
} catch (Exception e) {
log.error("error starting SingletonServiceBean",e);
context.failed(new StartException(e));
throw new IllegalStateException(e);
}
}
@Override
public void stop(StopContext context) {
log.error("SingletonServiceBean stopping");
try {
consumer.setMessageListener(null);
consumer.close();
producer.close();
session.close();
connection.close();
} catch (JMSException e) {
log.error("while trying to gracefully disconenct from JMS",e);
throw new IllegalStateException(e);
} finally {
started.set(false);
}
log.error("SingletonServiceBean stopped");
}
@Override
public UUID getValue() throws IllegalStateException, IllegalArgumentException {
if (!this.started.get()) {
throw new IllegalStateException();
}
log.error("SingletonServiceBean called on {}", env.getValue().getNodeName());
return UUID.randomUUID();
}
public Injector<ServerEnvironment> getEnvInjector() {
return this.env;
}
public Injector<HornetQServer> getHornetInjector() {
return this.hornet;
}
}
{code}
this service is installed and started by a @Singleton:
{code}
@Singleton
@Startup
@Local(SingletonServicesAccess.class)
public class SingletonServicesAccessBean implements SingletonServicesAccess, FinishSignal {
private final Logger log = LoggerFactory.getLogger(SingletonServicesAccessBean.class);
private volatile boolean serviceUp = false;
@PostConstruct
public void startup() {
log.error("starting up.");
SingletonServiceBean service = new SingletonServiceBean(this);
SingletonService<UUID> singleton = new SingletonService<UUID>(service, SingletonServiceBean.SERVICE_NAME);
singleton.setElectionPolicy(new SimpleSingletonElectionPolicy());
ServiceController<UUID> controller = singleton.build(ServiceContainerHelper.getCurrentServiceContainer())
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getEnvInjector())
.addDependency(MessagingServices.getHornetQServiceName("default"), HornetQServer.class, service.getHornetInjector())
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
try {
log.error("starting singleton controller");
ServiceContainerHelper.start(controller);
log.error("started singleton controller");
} catch (StartException e) {
throw new IllegalStateException(e);
}
//actually the above start() returns when the ha-singleton wrapper service is up, which
//doesnt mean our service is up. doesnt even mean our service will be started on this node
//get our (singleton-decorated) service
ServiceContainer serviceContainer = CurrentServiceContainer.getServiceContainer();
ServiceController<UUID> realController = (ServiceController<UUID>) serviceContainer.getService(SingletonServiceBean.SERVICE_NAME);
SingletonService<UUID> decoratedService = (SingletonService<UUID>) realController.getService();
boolean isMaster = decoratedService.isMaster(); //is there something to wait for?
log.error("is singleton master? {}",isMaster);
if (isMaster) {
long start = System.currentTimeMillis();
while (!serviceUp) {
try {
Thread.sleep(50L);
if (System.currentTimeMillis()-start > 5000L) {
log.error("did not start within 5 seconds");
throw new IllegalStateException("did not start within 5 seconds");
}
} catch (InterruptedException e) {}
}
log.error("waited {} millis for service to boot",System.currentTimeMillis()-start);
} else {
log.error("not waiting for service boot - slave node");
}
}
@PreDestroy
public void shutdown() {
log.error("shutting down");
ServiceContainerHelper.remove(ServiceContainerHelper.getCurrentServiceContainer().getRequiredService(SingletonServiceBean.SERVICE_NAME));
}
@Override
public void finished() {
serviceUp = true;
}
@Override
public boolean isMaster() {
//get our (singleton-decorated) service
ServiceContainer serviceContainer = CurrentServiceContainer.getServiceContainer();
ServiceController<UUID> realController = (ServiceController<UUID>) serviceContainer.getService(SingletonServiceBean.SERVICE_NAME);
SingletonService<UUID> decoratedService = (SingletonService<UUID>) realController.getService();
return decoratedService.isMaster();
}
}
{code}
after playing around with this implementation (which seems to work), i have 2 further questions:
1.in my relay service im using an anonymous inner class (the implementation of MessageListener that does the actual relaying). if i try and "upgrade" this anon. class into a private static inner class i get a NoClassDefFound exception. im guessing this has something to do with jboss 7 msc class loading, but how do i get around this? do i need to make this single relay class into a full-blown module in order to have it on my service's classpath ?
2. my @Singleton tries to wait for the cluster-singleton to be deployed, but only if its going to be deployed (if the current node is the master, as selected by the SingletonService decorator). whats the "correct" way of waiting for my service? the controller i create tansitions to UP the moment the decorator is up, but that doesnt mean my service has even started booting yet. i settled for a callback above, but might be there's a better way that im missing?
-
5. Re: cluster-singleton @MDB on jboss 7 - how?
jbosss Aug 24, 2012 3:34 AM (in response to hatchetman82)Hi Radai,
I have a question based on your code that yo uhave posted here.
I can't seem to find the classes SingletonServicesAccess and ServiceContainerHelper anywhere in jboss 7.1.1 packages. Can you tell me which package are they in? Based on the fix for this issue (https://issues.jboss.org/browse/AS7-5341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel), seems like the ServiceContainerHelper class should be in the org.jboss.as.clustering.msc package. But I can't find such package in Jboss 7.1.1. Same for SingletonServicesAccess. Can find the package for this class too.
Can you help me?
Thanks!
-
-
7. Re: cluster-singleton @MDB on jboss 7 - how?
jbosss Aug 27, 2012 7:57 PM (in response to wdfink)Thanks Wolf-Dieter. The quickstart example did help me!
I tried to create a small replica of your quickstart example, but I am getting a NullPointerException in one of the lines of the code in the Init.startup() method when I deploy it. I am pretty much doing the same things as the example, but running into the NPE. The only thing that is different from your example, is that in my case, I am deploying a war file and not a jar. Would that matter?
The CurrentServiceContainer.getServiceContainer() is returning a null which then is throwing a NPE from the singleton.build() method.
This is the line in the Init class in your example and my code too.
ServiceController<String> controller = singleton.build(CurrentServiceContainer.getServiceContainer()) .addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.env).install(); Whereas if I just pick up your example and deploy it, it gets deployed and runs just fine !
Any idea why the CurrentServiceContainer.getServiceContainer() is returning a null for my application, while working fine for your example on the same Jboss 7.1.1 Final instance that I am running both the applications on? Maybe I am missing some configuration to initialize the ServiceContainer somewhere?
Here is the console output showing the ERROR
[Server:server-three] 16:53:41,318 INFO [org.jboss.as.server.deployment] (MSC s
ervice thread 1-5) JBAS015876: Starting deployment of "csa-ha-singleton.war"
[Server:server-three] 16:53:46,109 WARN [org.jboss.as.server.deployment] (MSC s
ervice thread 1-2) Class Path entry slf4j-api-1.5.6.jar in "/C:/jboss-as-7.1.1.F
inal/content/csa-ha-singleton.war/WEB-INF/lib/jacorb-2.3.1.jbossorg-1.jar" does
not point to a valid jar for a Class-Path reference.
[Server:server-three] 16:53:46,114 WARN [org.jboss.as.server.deployment] (MSC s
ervice thread 1-2) Class Path entry slf4j-jdk14-1.5.6.jar in "/C:/jboss-as-7.1.1
.Final/content/csa-ha-singleton.war/WEB-INF/lib/jacorb-2.3.1.jbossorg-1.jar" do
es not point to a valid jar for a Class-Path reference.
[Server:server-three] 16:53:46,119 WARN [org.jboss.as.server.deployment] (MSC s
ervice thread 1-2) Class Path entry concurrent-1.3.2.jar in "/C:/jboss-as-7.1.1.
Final/content/csa-ha-singleton.war/WEB-INF/lib/jacorb-2.3.1.jbossorg-1.jar" doe
s not point to a valid jar for a Class-Path reference.
[Server:server-three] 16:53:46,125 WARN [org.jboss.as.server.deployment] (MSC s
ervice thread 1-2) Class Path entry antlr-2.7.2.jar in "/C:/jboss-as-7.1.1.Final
/content/csa-ha-singleton.war/WEB-INF/lib/jacorb-2.3.1.jbossorg-1.jar" does not
point to a valid jar for a Class-Path reference.
[Server:server-three] 16:53:46,235 INFO [org.jboss.as.pojo] (MSC service thread
1-7) JBAS017000: Found legacy bean/pojo namespace: urn:jboss:bean-deployer:2.0
- might be missing some xml features (potential exceptions).
[Server:server-three] 16:53:46,437 INFO [org.jboss.as.ejb3.deployment.processor
s.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings
for session bean named ServiceAccessBean in deployment unit deployment "csa-ha-
singleton.war" are as follows:
[Server:server-three]
[Server:server-three] java:global/csa-ha-singleton/ServiceAccessBean!com.cs
a.has.cluster.ServiceAccess
[Server:server-three] java:app/csa-ha-singleton/ServiceAccessBean!com.csa.h
as.cluster.ServiceAccess
[Server:server-three] java:module/ServiceAccessBean!com.csa.has.cluster.Ser
viceAccess
[Server:server-three] java:jboss/exported/csa-ha-singleton/ServiceAccessBean!c
om.csa.has.cluster.ServiceAccess
[Server:server-three] java:global/csa-ha-singleton/ServiceAccessBean
[Server:server-three] java:app/csa-ha-singleton/ServiceAccessBean
[Server:server-three] java:module/ServiceAccessBean
[Server:server-three]
[Server:server-three] 16:53:46,450 INFO [org.jboss.as.ejb3.deployment.processor
s.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-8) JNDI bindings
for session bean named Init in deployment unit deployment "csa-ha-singleton.war
" are as follows:
[Server:server-three]
[Server:server-three] java:global/csa-ha-singleton/Init!com.csa.has.cluster
.Init
[Server:server-three] java:app/csa-ha-singleton/Init!com.csa.has.cluster.In
it
[Server:server-three] java:module/Init!com.csa.has.cluster.Init
[Server:server-three] java:global/csa-ha-singleton/Init
[Server:server-three] java:app/csa-ha-singleton/Init
[Server:server-three] java:module/Init
[Server:server-three]
[Server:server-three] 16:53:46,590 INFO [com.csa.has.cluster.Init] (MSC serv
ice thread 1-6) StartupSingleton will be initialized!
[Server:server-three] 16:53:46,669 ERROR [org.jboss.msc.service.fail] (MSC servi
ce thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."csa-ha-s
ingleton.war".component.Init.START: org.jboss.msc.service.StartException in serv
ice jboss.deployment.unit."csa-ha-singleton.war".component.Init.START: Failed to
start service
[Server:server-three] at org.jboss.msc.service.ServiceControllerImpl$StartTask
.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
[Server:server-three] at java.util.concurrent.ThreadPoolExecutor$Worker.runTas
k(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_17]
[Server:server-three] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Th
readPoolExecutor.java:908) [rt.jar:1.6.0_17]
[Server:server-three] at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_1
7]
[Server:server-three] Caused by: java.lang.IllegalStateException: JBAS011048: Fa
iled to construct component instance
[Server:server-three] at org.jboss.as.ee.component.BasicComponent.constructCom
ponentInstance(BasicComponent.java:163)
[Server:server-three] at org.jboss.as.ee.component.BasicComponent.createInstan
ce(BasicComponent.java:85)
[Server:server-three] at org.jboss.as.ejb3.component.singleton.SingletonCompon
ent.getComponentInstance(SingletonComponent.java:116)
[Server:server-three] at org.jboss.as.ejb3.component.singleton.SingletonCompon
ent.start(SingletonComponent.java:130)
[Server:server-three] at org.jboss.as.ee.component.ComponentStartService.start
(ComponentStartService.java:44)
[Server:server-three] at org.jboss.msc.service.ServiceControllerImpl$StartTask
.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
[Server:server-three] at org.jboss.msc.service.ServiceControllerImpl$StartTask
.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
[Server:server-three] ... 3 more
[Server:server-three] Caused by: javax.ejb.EJBException: java.lang.NullPointerEx
ception
[Server:server-three] at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleException
InOurTx(CMTTxInterceptor.java:166)
[Server:server-three] at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(C
MTTxInterceptor.java:230)
[Server:server-three] at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMT
TxInterceptor.java:333)
[Server:server-three] at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxIntercept
or.processInvocation(SingletonLifecycleCMTTxInterceptor.java:56)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ejb3.component.interceptors.CurrentInvoc
ationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.ja
va:41)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ee.component.TCCLInterceptor.processInvo
cation(TCCLInterceptor.java:45)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.invocation.ChainedInterceptor.processInvoca
tion(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ee.component.BasicComponent.constructCom
ponentInstance(BasicComponent.java:161)
[Server:server-three] ... 9 more
[Server:server-three] Caused by: java.lang.NullPointerException
[Server:server-three] at org.jboss.as.clustering.singleton.SingletonService.bu
ild(SingletonService.java:85)
[Server:server-three] at org.jboss.as.clustering.singleton.SingletonService.bu
ild(SingletonService.java:80)
[Server:server-three] at com.hp.csa.has.cluster.Init.startup(Init.java:35)
[Server:server-three] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native M
ethod) [rt.jar:1.6.0_17]
[Server:server-three] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMet
hodAccessorImpl.java:39) [rt.jar:1.6.0_17]
[Server:server-three] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg
atingMethodAccessorImpl.java:25) [rt.jar:1.6.0_17]
[Server:server-three] at java.lang.reflect.Method.invoke(Method.java:597) [rt.
jar:1.6.0_17]
[Server:server-three] at org.jboss.as.ee.component.ManagedReferenceLifecycleMe
thodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocat
ion(ManagedReferenceLifecycleMethodInterceptorFactory.java:130)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.invocation.WeavedInterceptor.processInvocat
ion(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ee.component.ManagedReferenceInterceptor
Factory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceIntercepto
rFactory.java:95)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.invocation.WeavedInterceptor.processInvocat
ion(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ee.component.NamespaceContextInterceptor
.processInvocation(NamespaceContextInterceptor.java:50)
[Server:server-three] at org.jboss.invocation.InterceptorContext.proceed(Inter
ceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
[Server:server-three] at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(C
MTTxInterceptor.java:228)
[Server:server-three] ... 18 more
[Server:server-three]
[Server:server-three] 16:53:47,238 INFO [stdout] (pool-9-thread-1)
[Server:server-three] 16:53:47,239 INFO [stdout] (pool-9-thread-1) ------------
-------------------------------------------------------
[Server:server-three] 16:53:47,241 INFO [stdout] (pool-9-thread-1) GMS: address
=master:server-three/web, cluster=web, physical address=16.103.174.188:55450
[Server:server-three] 16:53:47,244 INFO [stdout] (pool-9-thread-1) ------------
-------------------------------------------------------
[Server:server-three]
[Server:server-three] 16:53:49,395 INFO [org.infinispan.configuration.cache.Evi
ctionConfigurationBuilder] (MSC service thread 1-2) ISPN000152: Passivation conf
igured without an eviction policy being selected. Only manually evicted entities
will be pasivated.
[Server:server-three] 16:53:49,395 INFO [org.infinispan.configuration.cache.Evi
ctionConfigurationBuilder] (MSC service thread 1-7) ISPN000152: Passivation conf
igured without an eviction policy being selected. Only manually evicted entities
will be pasivated.
[Server:server-three] 16:53:49,416 INFO [org.infinispan.remoting.transport.jgro
ups.JGroupsTransport] (pool-10-thread-1) ISPN000078: Starting JGroups Channel
[Server:server-three] 16:53:49,419 INFO [org.infinispan.remoting.transport.jgro
ups.JGroupsTransport] (pool-10-thread-1) ISPN000094: Received new cluster view:
[master:server-three/web|0] [master:server-three/web]
[Server:server-three] 16:53:49,423 INFO [org.infinispan.remoting.transport.jgro
ups.JGroupsTransport] (pool-10-thread-1) ISPN000079: Cache local address is mast
er:server-three/web, physical addresses are [16.103.174.188:55450]
[Server:server-three] 16:53:49,428 INFO [org.infinispan.config.ConfigurationVal
idatingVisitor] (pool-10-thread-1) ISPN000152: Passivation configured without an
eviction policy being selected. Only manually evicted entities will be pasivate
d.
[Server:server-three] 16:53:49,467 INFO [org.infinispan.jmx.CacheJmxRegistratio
n] (pool-10-thread-1) ISPN000031: MBeans were successfully registered to the pla
tform mbean server.
[Server:server-three] 16:53:49,477 INFO [org.jboss.as.clustering.infinispan] (p
ool-10-thread-1) JBAS010281: Started repl cache from web container
[Server:server-three] 16:53:49,481 INFO [org.jboss.as.clustering.impl.CoreGroup
CommunicationService.web] (MSC service thread 1-8) JBAS010206: Number of cluster
members: 1
[Server:server-three] 16:53:49,692 INFO [org.jboss.as.server] (host-controller-
connection-threads - 2) JBAS015870: Deploy of deployment "csa-ha-singleton.war"
was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.d
eployment.unit.\"csa-ha-singleton.war\".component.Init.START" => "org.jboss.msc.
service.StartException in service jboss.deployment.unit.\"csa-ha-singleton.war\"
.component.Init.START: Failed to start service"}}
[Server:server-three] 16:53:49,719 INFO [org.infinispan.eviction.PassivationMan
agerImpl] (pool-10-thread-1) ISPN000029: Passivating all entries to disk
[Server:server-three] 16:53:49,724 INFO [org.infinispan.eviction.PassivationMan
agerImpl] (pool-10-thread-1) ISPN000030: Passivated 0 entries in 4 milliseconds
[Server:server-three] 16:53:49,731 INFO [org.jboss.as.clustering.infinispan] (p
ool-10-thread-1) JBAS010282: Stopped repl cache from web container
[Server:server-three] 16:53:49,762 INFO [org.infinispan.remoting.transport.jgro
ups.JGroupsTransport] (pool-8-thread-1) ISPN000082: Stopping the RpcDispatcher
[Server:server-three] 16:53:50,008 INFO [org.jboss.as.server.deployment] (MSC s
ervice thread 1-8) JBAS015877: Stopped deployment csa-ha-singleton.war in 316ms
[Server:server-three] 16:53:50,011 INFO [org.jboss.as.controller] (host-control
ler-connection-threads - 2) JBAS014774: Service status report
[Server:server-three] JBAS014777: Services which failed to start: service
jboss.deployment.unit."csa-ha-singleton.war".component.Init.START: org.jboss.ms
c.service.StartException in service jboss.deployment.unit."csa-ha-singleton.war"
.component.Init.START: Failed to start service
[Server:server-three]
Thanks!
-
8. Re: cluster-singleton @MDB on jboss 7 - how?
wdfink Aug 28, 2012 4:36 AM (in response to jbosss)I'm not sure why the CurrentServiceContainer will return null. I see no reason for a different behaviour if you deploy a JAR or WAR.
I'll investigate if I find time for it.
But is there a reason why you use a war? Could you use a jar as workaround?
-
9. Re: cluster-singleton @MDB on jboss 7 - how?
jbosss Aug 28, 2012 7:59 PM (in response to wdfink)Hi Wolf-Dieter,
So it seems like the war deployment has some issue. I changed it to be packaged as a jar and that works without any issues.
I have another question. I dont see anywhere the information where I can programatically figure out whether the current node is a master or a slave. Probably, in most cases, you dont care, but say if you dont implement a ha singleton service, but programatically want to know if the current node that this piece of code is runing on is a master or a slave (or for that matter even is confugured in a cluster or standalone) and then execute that code, how can that be done?
I looked at jboss clustering code and I couldnt find and API that can give this information. I looked at the GroupCommunicationService class and the MBeanServer class and they dont have this information. Is there any way I could query and get this information from JBOSS?
Thanks!
-
10. Re: cluster-singleton @MDB on jboss 7 - how?
patrik.varga Dec 10, 2012 10:15 AM (in response to wdfink)(Sorry for reviving old threads, and this not being an answer to it, but it may be helpful to others.)
I'm not sure why the CurrentServiceContainer will return null. I see no reason for a different behaviour if you deploy a JAR or WAR.
I noticed this behaviour with WAR deployments (not tested with others) when forgetting to declare the dependency on the org.jboss.as.server module. If you don't declare the dependency in MANIFEST.MF or jboss-deployment-structre.xml, then the CurrentServiceContainer.getServiceContainer() call will return null at runtime, instead of throwing an exception, or having a deployment error.
HTH,
Patrik