-
1. Re: Restart a pool MBean
juha Apr 6, 2004 6:36 AM (in response to k2c)Try undeploying the components that depend on the datasource (the EJBs), then bounce the datasource and redeploy the applications. Maybe that yields a better result.
-
2. Re: Restart a pool MBean
k2c Apr 6, 2004 6:45 AM (in response to k2c)Hi juha!
Thanks for your quick reply! :)
I am a newbie to jboss and i have a doubt. What do you mean by 'bounce the datasource' ? What are the actions to follow to do that action?
I understand that deploy and undeploy is place and remove the ejb from the deploy directory.
Thanks once more for your help. -
3. Re: Restart a pool MBean
juha Apr 6, 2004 6:49 AM (in response to k2c)Hmm, right. 2.x doesn't have redeployable services, only EJBs. Undeploy EJB, stop/start datasource, deploy EJB.
-
4. Re: Restart a pool MBean
k2c Apr 6, 2004 7:07 AM (in response to k2c)Ok this is my output from the server.log file
when i do those actions:
'
[12:58:49,715,CORE_DB] Stopping
[12:58:49,716,CORE_DB] XA Connection pool CORE_DB removed from JNDI
[12:58:49,716,XAPoolDataSource] Closing DataSource
[12:58:49,716,XAPoolDataSource] Binding to JNDI name null
[12:58:49,716,ObjectPool] Removing pool: CORE_DB
[12:58:49,719,CORE_DB] XA Connection pool CORE_DB shut down
[12:58:49,719,CORE_DB] Stopped
[12:58:57,185,Connection] PING
[12:58:57,185,Connection] PONG, serverIL=org.jboss.mq.il.jvm.JVMServerIL@1fe451
[12:59:03,094,Connection] PING
[12:59:03,094,Connection] PONG, serverIL=org.jboss.mq.il.jvm.JVMServerIL@1fe451
[12:59:03,271,CORE_DB] Starting
[12:59:03,272,CORE_DB] setGCInterval(30000)
[12:59:03,272,CORE_DB] setGCMinIdleTime(60000)
[12:59:03,272,CORE_DB] setIdleTimeout(60000)
[12:59:03,272,CORE_DB] setTimestampUsed(true)
[12:59:03,272,XAConnectionFactory] Starting
[12:59:03,331,ObjectPool] Adding pool: CORE_DB, GC enabled: true
[12:59:03,339,CORE_DB] Stopped
javax.naming.NameAlreadyBoundException: java:/CORE_DB already exists in the NonSerializableFactory map
at org.jboss.naming.NonSerializableFactory.bind(NonSerializableFactory.java:88)
at org.jboss.jdbc.XADataSourceLoader.bind(XADataSourceLoader.java:486)
at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:439)
at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at com.sun.jdmk.comm.HtmlInvokePage.buildPage(HtmlInvokePage.java:240)
at com.sun.jdmk.comm.HtmlRequestHandler.processGetRequest(HtmlRequestHandler.java:325)
at com.sun.jdmk.comm.HtmlRequestHandler.processRequest(HtmlRequestHandler.java:152)
at com.sun.jdmk.comm.HtmlRequestHandler.doRun(HtmlRequestHandler.java:79)
at com.sun.jdmk.comm.ClientHandler.run(ClientHandler.java:84)
at java.lang.Thread.run(Thread.java:479)
'
Probably we should unregister the Name CORE_DB from the NonSerializableFactory....
Any help ?
Thanks -
5. Re: Restart a pool MBean
juha Apr 6, 2004 8:01 AM (in response to k2c)javax.naming.Context.rebind()
don't know if it is exposed as an MBean anywhere (naming service, or JNDI View), if not you'll have to implement your own MBean that does. -
6. Re: Restart a pool MBean
k2c Apr 6, 2004 10:43 AM (in response to k2c)Hi juha!
Do you know some source of information where can i learn how to implement the method rebind() in a MBean ?
Another aproach .... What if we use RMI to start and stop the MBean? Would that be the same as manually stopping and starting the Mbean ?
Thanks -
7. Re: Restart a pool MBean
juha Apr 6, 2004 11:21 AM (in response to k2c)Any tutorial that explains how to use JNDI should do. RMI works the same.
-
8. Re: Restart a pool MBean
k2c Apr 7, 2004 11:40 AM (in response to k2c)Hi to all!
I have tried the rebind and unbind commands with no success. Below are the steps i have followed:
1. Went to the JNDIView in the console and it showed me an entry to the mbean CORE_DB like this:
CORE_DB (class: org.jboss.pool.jdbc.xa.XAPoolDataSource)
2. Then i made a stop in the CORE_DB service service=XADataSource,name=CORE_DB
3. went again to the JNDIView service and the CORE_DB entry no longer exists.
4. Then tried to start the CORE_DB mbean again and the same error appeared like the one i have showed before.
javax.naming.NameAlreadyBoundException: java:/CORE_DB already exists in the NonSerializableFactory map
5. The next step was to implement an mbean which might do a rebind.
This is the code of the rebind method:
public void rebindDBMb() {
try {
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "localhost:8082");
System.out.println("[stopDBMb] : get Context");
Context ctx = new InitialContext();
System.out.println("[stopDBMb] : lookup");
XAPoolDataSource ref = (XAPoolDataSource) ctx.lookup("java:/CORE_DB");
System.out.println("[stopDBMb] : rebind");
ctx.rebind("java:/CORE_DB",ref);
} catch (Exception e) {
System.out.println("ERROR in MBean MyMonitor: stopDBMb");
}
}
But it did not work
This is the result from the server.log which shows the sequence i have made:
[17:26:36,799,CORE_DB] Stopping
[17:26:36,800,CORE_DB] XA Connection pool CORE_DB removed from JNDI
[17:26:36,800,XAPoolDataSource] Closing DataSource
[17:26:36,800,XAPoolDataSource] Binding to JNDI name null
[17:26:36,801,ObjectPool] Removing pool: CORE_DB
[17:26:36,805,CORE_DB] XA Connection pool CORE_DB shut down
[17:26:36,805,CORE_DB] Stopped
[17:26:55,798,CORE_DB] Starting
[17:26:55,799,CORE_DB] setGCInterval(30000)
[17:26:55,799,CORE_DB] setGCMinIdleTime(60000)
[17:26:55,799,CORE_DB] setIdleTimeout(60000)
[17:26:55,799,CORE_DB] setTimestampUsed(true)
[17:26:55,800,XAConnectionFactory] Starting
[17:26:55,867,ObjectPool] Adding pool: CORE_DB, GC enabled: true
[17:26:55,875,CORE_DB] Stopped
javax.naming.NameAlreadyBoundException: java:/CORE_DB already exists in the NonSerializableFactory map
at org.jboss.naming.NonSerializableFactory.bind(NonSerializableFactory.java:88)
at org.jboss.jdbc.XADataSourceLoader.bind(XADataSourceLoader.java:486)
at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:439)
at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at com.sun.jdmk.comm.HtmlInvokePage.buildPage(HtmlInvokePage.java:240)
at com.sun.jdmk.comm.HtmlRequestHandler.processGetRequest(HtmlRequestHandler.java:325)
at com.sun.jdmk.comm.HtmlRequestHandler.processRequest(HtmlRequestHandler.java:152)
at com.sun.jdmk.comm.HtmlRequestHandler.doRun(HtmlRequestHandler.java:79)
at com.sun.jdmk.comm.ClientHandler.run(ClientHandler.java:84)
at java.lang.Thread.run(Thread.java:479)
[17:27:03,714,STDOUT] [stopDBMb] : get Context
[17:27:03,714,STDOUT] [stopDBMb] : lookup
[17:27:03,715,STDOUT] ERROR in MBean MyMonitor: stopDBMb
So as you see an error has occured in my mbean after the lookup command.
6. Next i try to view the JNDIView service and the console just hangs. It does not shows nothing and the browser keeps waiting for information to arrive. Probably i have messed with the Naming factory properties. But what am i doing wrong?
Does the system properties are not right?
Thanks to all in advance. -
9. Re: Restart a pool MBean
diegolealbr May 17, 2006 3:00 PM (in response to k2c)I had to use
Hashtable ht = new Hashtable();
ht.put(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE, "true");
JMXConnectorServer jmxCS = JMXConnectorServerFactory.newJMXConnectorServer(url, ht, mbs);
where mbs is my MBeanServer