Thanks for the response Adrian.
Regarding your initial points I have done the following
-Moved the code into createService method
-Shifted the order that the mbean loads to be earlier by putting this into
conf/jboss-server.xml.
-Used Class.forName(name, true, classLoader) to ensure classes get preloaded
property
The results are promising. I have not managed to reproduce the issue once on
versions 4.0.1 and 4.0.2 of jboss yet.
Here is the final java code for the benefit anyone that follows
JmsClassPreloader.java
| import org.apache.log4j.Logger;
| import org.jboss.system.ServiceMBeanSupport;
|
| public class JmsClassPreloader extends ServiceMBeanSupport implements
JmsClassPreloaderMBean {
| private static final Logger logger =
Logger.getLogger(JmsClassPreloader.class);
|
| public void createService() throws Exception {
| try {
| if (logger.isDebugEnabled()) {
| logger.debug("starting JmsClassPreloader mbean
service");
| }
|
| // get the classloader associated with the thread
| ClassLoader cl =
Thread.currentThread().getContextClassLoader();
|
| //load the classes
| String name;
| name = "org.jboss.mq.selectors.ASCII_CharStream";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.Identifier";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.ISelectorParser";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.Operator";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.ParseException";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.RegExp";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.Selector";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.SelectorParser";
| Class clazz = Class.forName(name, true, cl);
| //initialise the inner class JJCalls
| clazz.newInstance();
| name = "org.jboss.mq.selectors.SelectorParserConstants";
| Class.forName(name, true, cl);
| name =
"org.jboss.mq.selectors.SelectorParserTokenManager";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.Token";
| Class.forName(name, true, cl);
| name = "org.jboss.mq.selectors.TokenMgrError";
| Class.forName(name, true, cl);
|
| } catch (Exception ex) {
| logger.warn("Exception in class preloader", ex);
| }
| }
| }
|
JmsClassPreloaderMBean.java
| import org.jboss.system.ServiceMBean;
|
| public interface JmsClassPreloaderMBean extends ServiceMBean {
|
| }
|
Both of these classes are in a jar file in the server/lib directory and I have
put the following entry in my server/conf/jboss-service.xml file right up the
top
| <server>
|
| <classpath codebase="lib" archives="*"/>
|
| <mbean code="JmsClassPreloader"
| name="acme.com:service=JmsClassPreloader">
| </mbean>
|
| ...
|
| </server>
|
Regarding your point 6 I understand how frustrating it must be when people
don't read the forums before posting but I personally don't think this applies
to me.
1) Prior to posting I read every single forum post using Search criteria
[keyword "ClassCircularityError", All Forums]. This search only received less
than a dozen hits all of which refer to version 3 or earlier of jboss and none
of which relate to jms.
2) A Search of jira for existing bug reports using "ClassCircularityError" as
the search term retrieved 3 hits none of which seemed even vaguely related to
my problem.
On those grounds since I was 99% sure it was a genuine bug I felt justified in
creating the bug report in addition to the forum post.
After you posted your mbean workaround suggestion I was admittedly guilty of
not reading the wiki hence my first blatently incorrect attempts at making an
mbean which I quickly corrected (oh to be able to edit or delete one's own
posts!)
Thanks again for the help.
Kindest Regards,
Gray.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886708#3886708
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3886708
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user