[jboss-user] start up mbean for jboss
Sadashiv Patwary
SPatwary at axeda.com
Wed Aug 20 13:11:32 EDT 2008
Hi all,
I want to add a startup class which should be loaded when the jboss
starts up. I did some research
Which says create mbean and add it jboss-service.xml file( not sure
which location).
I am using ear deployment. The class which I want o make the start up
class resides in ear file under /lib directory.
I am using jboss-4.2.1.GA.
I tried to put the MBean as service in
jboss-4.2.0.GA\server\servicelink\conf\ jboss-service.xml
but got no class
java.lang.ClassNotFoundException: No ClassLoaders found for JbossStartUp
Below is the code for MBean.
import org.jboss.system.ServiceMBean;
public interface JbossStartUpMBean extends ServiceMBean
{
public void init();
public void start() throws Exception;
public void stop();
public void create();
public void destroy();
public void jbossInternalLifecycle(java.lang.String s) throws
java.lang.Exception;
}
2.The implemenatation class:
public class JbossStartUp
implements MBeanRegistration, JbossStartUpMBean
{
private static Log logger = LogFactory.getLog(JbossStartUp.class);
public JbossStartUp()
{
}
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws Exception
{
return new ObjectName(":service=JbossStartUp");
}
public void postRegister(Boolean boolean1)
{
}
public void preDeregister()
throws Exception
{
}
public void postDeregister()
{
}
public void create()
{
}
public void start() throws Exception
{
startup();
}
public String startup()
throws Exception
{
testStartUp startup = new testStartUp();
startup.startup();
return "OK";
}
public void init()
{
}
public void stop()
{
}
public void destroy()
{
}
public String getName()
{
return null;
}
public int getState()
{
return 0;
}
public String getStateString()
{
return null;
}
Regards
shiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20080820/712926d3/attachment.html
More information about the jboss-user
mailing list