This is still not the right list for this question.  Please move it
elsewhere or you will get very flamed.

However, Class.forName is unlikely to work properly in any nontrivial
environment.  Try Thread.currentThread().getContextClassLoader()

david jencks

On 2002.07.13 19:14:20 -0400 Florin Popa wrote:
> Hi!
> 
> I still have the same problem even if I succeed to implement the MBean.
> You can see below what I did exactly;the bold line is the business logic
> I need within my startup class...
> BUT, I got the same exception.. It seems the MBean does not help
> either... Is the same classloader used for the MBean and for my
> FrameworkManager class (this is the business logic I need to start as
> startup class)?
> 
> 
> I attach as well the exception I got:
> 
> -3.0.0/server/default/deploy/user-service.xml
> 00:55:30,965 INFO  [STDOUT] %%%%%%%%%%%%%%%%%%%%% here is the start of
> MBean
> 00:55:30,995 INFO  [STDOUT] FrameworkManager::getInstance ENTRY
> 00:55:31,005 INFO  [STDOUT] FrameworkManager::FrameworkManager ENTRY
> 00:55:31,005 INFO  [STDOUT] FrameworkManager::establishVendor ENTRY
> 00:55:31,005 INFO  [STDOUT] FrameworkManager::establishVendor EXIT
> 00:55:31,005 INFO  [STDOUT] FrameworkManager::bootStrap ENTRY
> 00:55:31,015 INFO  [STDOUT] FrameworkManager::bootStrap
> frameworkDirectory is: C
> :\_kkt\build
> 00:55:31,015 INFO  [STDOUT] FrameworkManager::bootStrap
> frameworkConfigDirectory
>  is: C:\_kkt\config
> 00:55:31,035 INFO  [STDOUT] [FrameworkManager] 4 framework service(s)
> located
> 00:55:31,035 INFO  [STDOUT] inFileList[0] is:
> framework\config\ConfigService.cla
> ss
> 00:55:31,035 INFO  [STDOUT] inFileList[0] post process is:
> framework.config.Conf
> igService
> 00:55:31,035 INFO  [STDOUT] inFileList[1] is:
> framework\dbconnection\DbConnectio
> nService.class
> 00:55:31,035 INFO  [STDOUT] inFileList[1] post process is:
> framework.dbconnectio
> n.DbConnectionService
> 00:55:31,035 INFO  [STDOUT] inFileList[2] is:
> framework\jndi\JNDIService.class
> 00:55:31,035 INFO  [STDOUT] inFileList[2] post process is:
> framework.jndi.JNDISe
> rvice
> 00:55:31,035 INFO  [STDOUT] inFileList[3] is:
> framework\logging\LogService.class
> 
> 00:55:31,035 INFO  [STDOUT] inFileList[3] post process is:
> framework.logging.Log
> Service
> 00:55:31,035 INFO  [STDOUT] location of logging was: 3
> 00:55:31,045 INFO  [STDOUT] [FrameworkManager] initializing service  0 :
> framewo
> rk.logging.LogService
> 00:55:31,045 INFO  [STDOUT] ####################
> framework.logging.LogService
> 00:55:31,095 ERROR [MainDeployer] could not start deployment:
> file:/C:/jboss-3.0
> .0/server/default/deploy/user-service.xml
> java.lang.ExceptionInInitializerError:
> java.lang.NullPointerException
>         at
> org.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.jav
> a:379)
>         at
> org.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigur
> ator.java:308)
>         at
> org.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:25
> 2)
>         at
> org.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:28
> 0)
>         at org.log4j.Category.<clinit>(Category.java:108)
>         at framework.logging.LogService.<clinit>(Unknown Source)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:120)
>         at framework.manager.FrameworkManager.bootStrap(Unknown Source)
>         at framework.manager.FrameworkManager.<init>(Unknown Source)
>         at framework.manager.FrameworkManager.getInstance(Unknown
> Source)
>         at startup.Startup.start(Startup.java:24)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
> nDispatcher.java:284)
>         at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
>         at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
> ler.java:894)
>         at $Proxy6.start(Unknown Source)
>         at
> org.jboss.system.ServiceController.start(ServiceController.java:340)
> 
> Here is the source code for the MBean
> 
> 
> package startup;
> public interface StartupMBean {
> 
>  //following are the service methods which needs to be implemented
>  //and are called by the JBoss container
>  //When server starts, first init is called and then start is called
>  //write code in start to do implement any startup functionality
>  public abstract void init() throws Exception;
>  public abstract void start() throws Exception;
> 
>  //When server stops, first stop is called and then destroy is called
>  //write code in stop to do implement any cleanup functionality
>  public abstract void stop() throws Exception;
>  public abstract void destroy() throws Exception;
> }
> 
> package startup;
> //import org.jboss.util.*; //from jboss.jar
> import javax.management.*; //from jmxri.jar
> import framework.manager.FrameworkManager;
> 
> public class Startup implements MBeanRegistration, StartupMBean {
> 
>  public Startup() {
>  }
>  //the ObjectName returned is important and is to be given exactly
>  //in jboss.jcml file
>  public ObjectName preRegister(MBeanServer server, ObjectName name)
> throws java.lang.Exception {
>    return new ObjectName(":service=Startup");
>  }
> 
>  public void postRegister(java.lang.Boolean registrationDone) {}
>  public void preDeregister() throws java.lang.Exception { }
>  public void postDeregister() {}
>  public void init() throws Exception { }
> 
>  public void start() throws Exception {
>    //write custom code here to do implement any startup functionality
> System.out.println("%%%%%%%%%%%%%%%%%%%%% here is the start of MBean");
> FrameworkManager fm = FrameworkManager.getInstance();
> 
>  }
>  public void stop() throws Exception {
>    //write custom code here to do implement any cleanup functionality
>  }
>  public void destroy() throws Exception {}
>  }
> 
> Thanks a lot,
>  florin
> 
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi!
> <p>I still have the same problem even if I succeed to implement the
> MBean.
> You can see below what I did exactly;the bold line is the business logic
> I need within my startup class...
> <br>BUT, I got the same exception.. It seems the MBean does not help
> either...
> Is the same classloader used for the MBean and for my FrameworkManager
> class (this is the business logic I need to start as startup class)?
> <br>&nbsp;
> <p>I attach as well the exception I got:
> <p>-3.0.0/server/default/deploy/user-service.xml
> <br>00:55:30,965 INFO&nbsp; [STDOUT] %%%%%%%%%%%%%%%%%%%%% here is the
> start of MBean
> <br>00:55:30,995 INFO&nbsp; [STDOUT] FrameworkManager::getInstance ENTRY
> <br>00:55:31,005 INFO&nbsp; [STDOUT] FrameworkManager::FrameworkManager
> ENTRY
> <br>00:55:31,005 INFO&nbsp; [STDOUT] FrameworkManager::establishVendor
> ENTRY
> <br>00:55:31,005 INFO&nbsp; [STDOUT] FrameworkManager::establishVendor
> EXIT
> <br>00:55:31,005 INFO&nbsp; [STDOUT] FrameworkManager::bootStrap ENTRY
> <br>00:55:31,015 INFO&nbsp; [STDOUT] FrameworkManager::bootStrap
> frameworkDirectory
> is: C
> <br>:\_kkt\build
> <br>00:55:31,015 INFO&nbsp; [STDOUT] FrameworkManager::bootStrap
> frameworkConfigDirectory
> <br>&nbsp;is: C:\_kkt\config
> <br>00:55:31,035 INFO&nbsp; [STDOUT] [FrameworkManager] 4 framework
> service(s)
> located
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[0] is:
> framework\config\ConfigService.cla
> <br>ss
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[0] post process is:
> framework.config.Conf
> <br>igService
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[1] is:
> framework\dbconnection\DbConnectio
> <br>nService.class
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[1] post process is:
> framework.dbconnectio
> <br>n.DbConnectionService
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[2] is:
> framework\jndi\JNDIService.class
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[2] post process is:
> framework.jndi.JNDISe
> <br>rvice
> <br>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[3] is:
> framework\logging\LogService.class
> <p>00:55:31,035 INFO&nbsp; [STDOUT] inFileList[3] post process is:
> framework.logging.Log
> <br>Service
> <br>00:55:31,035 INFO&nbsp; [STDOUT] location of logging was: 3
> <br>00:55:31,045 INFO&nbsp; [STDOUT] [FrameworkManager] initializing
> service&nbsp;
> 0 : framewo
> <br>rk.logging.LogService
> <br>00:55:31,045 INFO&nbsp; [STDOUT] ####################
> framework.logging.LogService
> <br>00:55:31,095 ERROR [MainDeployer] could not start deployment: <A
> HREF="file:/C:/jboss-3.0">file:/C:/jboss-3.0</A>
> <br>.0/server/default/deploy/user-service.xml
> <br>java.lang.ExceptionInInitializerError:
> <br>java.lang.NullPointerException
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.jav
> <br>a:379)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigur
> <br>ator.java:308)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:25
> <br>2)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:28
> <br>0)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.log4j.Category.&lt;clinit>(Category.java:108)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> framework.logging.LogService.&lt;clinit>(Unknown
> Source)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> java.lang.Class.forName0(Native
> Method)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> java.lang.Class.forName(Class.java:120)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> framework.manager.FrameworkManager.bootStrap(Unknown
> Source)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> framework.manager.FrameworkManager.&lt;init>(Unknown
> Source)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> framework.manager.FrameworkManager.getInstance(Unknown
> Source)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> startup.Startup.start(Startup.java:24)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> java.lang.reflect.Method.invoke(Native
> Method)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
> <br>nDispatcher.java:284)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
> <br>ler.java:894)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at $Proxy6.start(Unknown
> Source)
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
> org.jboss.system.ServiceController.start(ServiceController.java:340)
> <p>Here is the source code for the MBean
> <br>&nbsp;
> <p>package startup;
> <br>public interface StartupMBean {
> <p>&nbsp;//following are the service methods which needs to be
> implemented
> <br>&nbsp;//and are called by the JBoss container
> <br>&nbsp;//When server starts, first init is called and then start is
> called
> <br>&nbsp;//write code in start to do implement any startup functionality
> <br>&nbsp;public abstract void init() throws Exception;
> <br>&nbsp;public abstract void start() throws Exception;
> <p>&nbsp;//When server stops, first stop is called and then destroy is
> called
> <br>&nbsp;//write code in stop to do implement any cleanup functionality
> <br>&nbsp;public abstract void stop() throws Exception;
> <br>&nbsp;public abstract void destroy() throws Exception;
> <br>}
> <p>package startup;
> <br>//import org.jboss.util.*; //from jboss.jar
> <br>import javax.management.*; //from jmxri.jar
> <br>import framework.manager.FrameworkManager;
> <p>public class Startup implements MBeanRegistration, StartupMBean {
> <p>&nbsp;public Startup() {
> <br>&nbsp;}
> <br>&nbsp;//the ObjectName returned is important and is to be given
> exactly
> <br>&nbsp;//in jboss.jcml file
> <br>&nbsp;public ObjectName preRegister(MBeanServer server, ObjectName
> name) throws java.lang.Exception {
> <br>&nbsp;&nbsp; return new ObjectName(":service=Startup");
> <br>&nbsp;}
> <p>&nbsp;public void postRegister(java.lang.Boolean registrationDone) {}
> <br>&nbsp;public void preDeregister() throws java.lang.Exception { }
> <br>&nbsp;public void postDeregister() {}
> <br>&nbsp;public void init() throws Exception { }
> <p>&nbsp;public void start() throws Exception {
> <br>&nbsp;&nbsp; //write custom code here to do implement any startup
> functionality
> <br>System.out.println("%%%%%%%%%%%%%%%%%%%%% here is the start of
> MBean");
> <br><b>FrameworkManager fm = FrameworkManager.getInstance();</b>
> <p>&nbsp;}
> <br>&nbsp;public void stop() throws Exception {
> <br>&nbsp;&nbsp; //write custom code here to do implement any cleanup
> functionality
> <br>&nbsp;}
> <br>&nbsp;public void destroy() throws Exception {}
> <br>&nbsp;}
> <p>Thanks a lot,
> <br>&nbsp;florin</html>
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to