Zachary Bedell [
https://community.jboss.org/people/zbedell] created the discussion
"Access EAR classpath from MBean in JBoss Module?"
To view the discussion, visit:
https://community.jboss.org/message/760914#760914
--------------------------------------------------------------
I've defined an MBean whose classes are in a JBoss module (stored at
$JBOSS_HOME/modules/ucs/jb4compat/main). My configuration/standalone.xml lists this
module as in global-modules under the ee subsystem. I have an EAR deployment
(standalone/deployments/MyEar.ear) which has META-INF/jboss-service.xml that references
the MBean in the module. My EAR starts to deploy, the module class is found, and the
start() method of the MBean is called. All of the attributes listed in the mbean element
in jboss-service.xml are called, and my properties are set as expected. So far so
good...
The problem arises in that one of the attributes set via
jboss-service.xml::server/mbean/attribute is intended to be the name of an attribute on
the classpath. Under JBoss 4.2.3 (from which I'm migrating), the MBean calls
Thread.currentThread().getContextClassLoader().getResource([attributeValue]) which yields
a URL to the classpath resource which would usually get something out of EAR/META-INF.
Under JBoss 7.1.1, the TCCL appears to be the JBoss Module (ucs.jb4compat) classloader
rather than the EAR's classloader, so I have no access to classpath elements within
the ear.
Is there a way within the MBean's start() method that I can get a handle on the
classloader of the EAR which contains the jboss-service.xml that spawned the MBean in the
first place? Any help would be appreciated.
Best regards,
Zac Bedell
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/760914#760914]
Start a new discussion in JBoss AS 7 Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]