3 Replies Latest reply on May 1, 2003 10:43 AM by stevecoh1

    classloaders, commons-logging, jmx, jboss and threads

    stevecoh1 Newbie

      I am porting a web application from JRun to JBoss.
      This application used commons-logging on top of log4j to do its logging. Part of this application included a thread that took in a data feed, used by another part of the application.

      The port was made without too much difficulty but I wanted to use JBoss's JMX facilities to control the feed, which had previously been done by a kludgey HTTP interface. So I wrote a couple of MBeans to do that. There was a question of logging within the MBeans, I wasn't sure how to get the MBeans to see commons-logging so I let the logging be done by log4j in the MBeans. That was an acceptable compromise until I wrote the bean to control starting and stopping the feed from JMX console. I used an AttributeChangeNotification mechanism with my web-app being a listener for the notification. The stop button worked like a charm. But the start button caused a new, and unforeseen problem.

      When the feed thread was started from within the web app there was no problem and stopping that thread posed none either. However restarting the feed thread from the JMX console meant that the feed thread was now originating from JMX, and errors were thrown indicating that no classloader for commons-logging could be found there?

      So my question is how can commons-logging be put into the JBoss server's classpath - or alternatively, is there a better way of implementing JMX for this function that doesn't have these problems.