This content has been marked as final.
Show 5 replies
-
1. Re: Can't do JNDI lookup for
lordbritish Apr 14, 2004 5:16 PM (in response to lordbritish)Oh yea, I was tring to get "/HAPartition/DefaultPartition".
I couldn't get "DefaultParition" because "HAPartition" is not there.
Seems mighty odd to me !! -
2. Re: Can't do JNDI lookup for
lordbritish Apr 15, 2004 11:25 AM (in response to lordbritish)This is still unresolved.
If I don't see a solution soon, I will create a bug report for it. -
3. Re: Can't do JNDI lookup for
starksm64 Apr 15, 2004 1:13 PM (in response to lordbritish)The TopologyMonitorService debug utility which does the same lookup:
protected void startService() throws Exception { InitialContext ctx = new InitialContext(); String partitionJndiName = "/HAPartition/" + partitionName; partition = (HAPartition) ctx.lookup(partitionJndiName); // Register as a listener of cluster membership changes partition.registerMembershipListener(this); log.info("Registered as MembershipListener"); try { hostname = InetAddress.getLocalHost().getHostName(); } catch(IOException e) { log.warn("Failed to lookup local hostname", e); hostname = "<unknown>"; } }
has no problem with this:<server> <mbean code="org.jboss.ha.framework.server.util.TopologyMonitorService" name="jboss.test:cluster=DefaultPartition"> <depends>jboss:service=DefaultPartition</depends> </mbean> </server> ... 10:48:53,906 INFO [MainDeployer] Starting deployment of package: file:/C:/cvs/Releases/jboss-3.2.3/server/all/deploy/topmon-service.xml 10:48:53,921 INFO [TopologyMonitorService] Registered as MembershipListener 10:48:53,921 INFO [TopologyMonitorService] Started jboss.test:cluster=DefaultPartition 10:48:53,937 INFO [MainDeployer] Deployed package: file:/C:/cvs/Releases/jboss-3.2.3/server/all/deploy/topmon-service.xml
Your probably doing your lookup before the cluster service has created the binding. -
4. Re: Can't do JNDI lookup for
lordbritish Apr 15, 2004 2:37 PM (in response to lordbritish)This is my MBean:
public class RMIConfig implements RMIConfigMBean { public void start() throws Exception { System.out.println("======== CALLED START ======"); InitialContext ctx = new InitialContext(); Object obj = ctx.lookup("/HAPartition/DefaultPartition"); RMISocketFactory rmiSocketFactry = RMISocketFactory.getSocketFactory(); HAPartition myPartition = (HAPartition) obj; MyService myService = new MyServiceImpl(); HARMIServerImpl rmiserver = new HARMIServerImpl(myPartition, "MyService", MyService.class, myService, 3433, rmiSocketFactry, rmiSocketFactry); MyService stub = (MyService) rmiserver.createHAStub(new RoundRobin()); ctx.bind("RMI_STUB", stub); System.out.println("======== SUCCESSFULLY STARTED ======"); } public void stop() throws Exception { System.out.println("======== CALLED STOP ======"); } }
This is how I configured it in in my user-service.xml file:<server> <classpath codebase="." archives="RMIConfig.jar"/> <mbean code="test.RMIConfig" name="user:service=RMIConfig"> </mbean> </server>
If I'm trying to access "/HAPartition" before it's inititialed, how do I make sure that it is initialized before it gets to my MBean code??
Like I said, with JBoss 4.0, my code works - I can find "/HAPartition". -
5. Re: Can't do JNDI lookup for
lordbritish Apr 15, 2004 2:44 PM (in response to lordbritish)Ok, I figured it out:
I needed to add this to my MBean config:<depends>jboss:service=DefaultPartition</depends>
Hehhe, it's all working now ;)
Thx !!