-
1. Re: Communication between nodes
brian.stansberry May 1, 2009 1:09 PM (in response to ekobir)No, you can't get access to the JChannel, and if you did that send() call wouldn't work. HAServiceMBeanSupport provides a callMethodOnPartition method that lets you invoke an RPC on the group; you could pass the target node as a param.
If you can use AS 5.1 (now in CR1 release) HAPartition also exposes methods for making RPCs solely on target nodes:
/**
* Calls method synchronously on target node only.
* @param serviceName Name of the target service name on which calls are de-multiplexed
* @param methodName name of the Java method to be called on remote services
* @param args array of Java Object representing the set of parameters to be
* given to the remote method
* @param types The types of the parameters
* node of the partition or only on remote nodes
* @param targetNode is the target of the call
* @return the value returned by the target method
* @throws Exception Throws if a communication exception occurs
*/
public Object callMethodOnNode(String serviceName, String methodName,
Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode) throws Throwable;
/**
* Calls method on target node only.
* @param serviceName Name of the target service name on which calls are de-multiplexed
* @param methodName name of the Java method to be called on remote services
* @param args array of Java Object representing the set of parameters to be
* given to the remote method
* @param types The types of the parameters
* node of the partition or only on remote nodes
* @param targetNode is the target of the call
*
* @throws Exception Throws if a communication exception occurs
*/
public void callAsyncMethodOnNode(String serviceName, String methodName,
Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode) throws Throwable;
There's no convenience method to expose that via HAServiceMBeanSupport, but that's not hard for you to implement. -
2. Re: Communication between nodes
ekobir May 5, 2009 4:37 AM (in response to ekobir)Thanks for your reply. Quickest option for me to use AS5.1 as AS5.0 is already in place.
-
3. Re: Communication between nodes
ekobir May 7, 2009 6:53 AM (in response to ekobir)Hi All
I'm struggling to deploy singleton jboss service. Can you provide some feedback what it is wrong with following config file?
The problem is that I'm not able to set TargetName attribute of HASingletonController.
Note: I'm using jboss-eap-5.0--> Supported Alpha Version
11:48:55,438 ERROR [AbstractKernelController] Error installing to Configured: name=xyz:service=TestServiceHASingletonController state=Instantiated mode=Manual requiredState=Configured
java.lang.RuntimeException: Exception setting attribute TargetName on mbean xyz:service=TestServiceHASingletonController
Caused by: javax.management.InvalidAttributeValueException: Set attribute has class class javax.management.ObjectName loaded from null that is not assignable to attribute class class javax.management.ObjectName loaded from BaseClassLoader@15b9a0cpublic interface TestServiceMBean extends HAServiceMBean { public void startSingleton(); public void stopSingleton(); } public class TestService extends HAServiceMBeanSupport implements TestServiceMBean { private static Logger logger = Logger.getLogger( TestService.class); @Override public void startSingleton() { logger.info("Start Singleton Service"); } @Override public void stopSingleton(){ logger.info("Stop Singleton Service"); } @Override protected void createService() throws Exception { super.createService(); logger.info("Create Service"); } @Override protected void startService() throws Exception { super.startService(); logger.info("Start Service"); } @Override protected void stopService() throws Exception { super.stopService(); logger.info("Stop Service"); } @Override protected void destroyService() throws Exception { super.destroyService(); logger.info("Destroy Service"); } } <?xml version="1.0" encoding="UTF-8" ?> <server> <mbean code="xyz.TestService" name="xyz:service=TestService"> <!-- I tried to inject HAPartition like below as setting ClusteredPartition is deprecated, unfortunately it didnt work <depends>HAPartition</depends> <property name="HAPartition"><inject bean="HAPartition"/></property> --> <depends optional-attribute-name="ClusterPartition" proxy-type="attribute"> jboss:partition=${jboss.partition.name:DefaultPartition},service=HAPartition </depends> </mbean> <mbean code="org.jboss.ha.singleton.HASingletonController" name="xyz:service=TestServiceHASingletonController"> <depends optional-attribute-name="ClusterPartition" proxy-type="attribute"> jboss:partition=${jboss.partition.name:DefaultPartition},service=HAPartition </depends> <depends optional-attribute-name="TargetName"> xyz:service=TestService </depends> <attribute name="TargetStartMethod">startSingleton</attribute> <attribute name="TargetStopMethod">stopSingleton</attribute> </mbean> </server>
-
4. Re: Communication between nodes
brian.stansberry May 7, 2009 10:20 AM (in response to ekobir)Do you still see this problem with community AS 5.1.0.CR1?
The injection of the HAPartition isn't working because you're using -jboss-beans.xml syntax in a -service.xml. It should be:<attributed name="HAPartition"><inject bean="HAPartition"/></attribute>
The element name is "attribute" not "property". -
5. Re: Communication between nodes
ekobir May 7, 2009 10:46 AM (in response to ekobir)Thanks again Brain. I have tried with 5.0.1 GA and JBoss EAP 5.0.0.
To try on release candidate didnt even cross my mind, I apologise for that. -
6. Re: Communication between nodes
brian.stansberry May 7, 2009 10:56 AM (in response to ekobir)No need to apologize. It might still be there, but it's in an area in active development that's outside of my regular involvement. So first thing to do before doing deep analysis is to check if it's already fixed. :)
-
7. Re: Communication between nodes
ekobir May 7, 2009 11:11 AM (in response to ekobir)Hey Brain
still no luck after downloading and testing on jBoss 5.1.0CR1. You can find full stack trace below.16:05:02,203 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/servers/jboss-5.1.0.CR1/server/production/deploy/Test.ear/ state=PreReal mode=Manual requiredState=Real org.jboss.deployers.spi.DeploymentException: Error deploying: xyz:service=TestServiceHASingletonController 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.doInstallParentFirst(DeployersImpl.java:1210) 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:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) 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:702) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:338) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:231) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: Exception setting attribute TargetName on mbean xyz:service=TestServiceHASingletonController at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:170) 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:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) 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) ... 30 more Caused by: javax.management.InvalidAttributeValueException: Set attribute has class class javax.management.ObjectName loaded from null that is not assignable to attribute class class javax.management.ObjectName loaded from BaseClassLoader@14d1552{vfszip:/servers/jboss-5.1.0.CR1/server/production/deploy/Test.ear/} at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.checkAssignable(ModelMBeanAttributeInterceptor.java:229) at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:88) at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:76) at org.jboss.mx.server.Invocation.invoke(Invocation.java:90) at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(AbstractMBeanInvoker.java:461) at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:617) at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:166) ... 47 more
-
8. Re: Communication between nodes
brian.stansberry May 7, 2009 12:10 PM (in response to ekobir)Do you package a copy of the javax.management.ObjectName class in Test.ear?
Please outline the contents of Test.ear. -
9. Re: Communication between nodes
ekobir May 7, 2009 12:22 PM (in response to ekobir)Hey Brian
Thanks a lot... jmxri was in the ear file. After removing, everything worked properly...