Bug 738050 - as5 plugin: JBoss AS JVM Resources are not discovered for managed AS 6.0 servers due to "ClassNotFoundException: org.jnp.interfaces.NamingContextFactory" error during initialization of EMS connection
as5 plugin: JBoss AS JVM Resources are not discovered for managed AS 6.0 serv...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Plugin Container (Show other bugs)
4.1
Unspecified Unspecified
urgent Severity high (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: jon3
  Show dependency treegraph
 
Reported: 2011-09-13 14:13 EDT by Ian Springer
Modified: 2013-08-05 20:40 EDT (History)
3 users (show)

See Also:
Fixed In Version: 4.2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-07 14:21:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Screenshot (157.46 KB, image/png)
2011-09-20 06:29 EDT, Sunil Kondkar
no flags Details

  None (edit)
Description Ian Springer 2011-09-13 14:13:29 EDT
Here's the full stack trace:

    2011-09-12 10:55:14,125 WARN  [ResourceDiscoveryComponent.invoker.daemon-274] (jboss.on.common.jbossas.JmxConnectionHelper)- Could not establish connection to the instance [11] times.
    org.mc4j.ems.connection.EmsConnectException: Could not connect [jnp://127.0.0.60:1099] org.mc4j.ems.connection.ConnectionException: Necessary classes not found for remote connection, check installation path configuration.
            at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:102)
            at org.jboss.on.common.jbossas.JmxConnectionHelper.loadConnection(JmxConnectionHelper.java:211)
            at org.jboss.on.common.jbossas.JmxConnectionHelper.getEmsConnection(JmxConnectionHelper.java:122)
            at org.rhq.plugins.jbossas5.ApplicationServerComponent.getEmsConnection(ApplicationServerComponent.java:444)
            at org.rhq.plugins.jmx.EmbeddedJMXServerDiscoveryComponent.discoverResources(EmbeddedJMXServerDiscoveryComponent.java:56)
            at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:281)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: org.mc4j.ems.connection.ConnectionException: Necessary classes not found for remote connection, check installation path configuration.
            at org.mc4j.ems.impl.jmx.connection.support.providers.JBossConnectionProvider.getInitialContext(JBossConnectionProvider.java:118)
            at org.mc4j.ems.impl.jmx.connection.support.providers.JBossConnectionProvider.doConnect(JBossConnectionProvider.java:69)
            at org.mc4j.ems.impl.jmx.connection.support.providers.AbstractConnectionProvider.connect(AbstractConnectionProvider.java:97)
            ... 13 more
    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:247)
            at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
            at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
            at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
            at javax.naming.InitialContext.init(InitialContext.java:223)
            at javax.naming.InitialContext.<init>(InitialContext.java:197)
            at org.mc4j.ems.impl.jmx.connection.support.providers.JBossConnectionProvider.getInitialContext(JBossConnectionProvider.java:112)
            ... 15 more
Comment 1 Ian Springer 2011-09-13 15:43:09 EDT
This was a bug in the plugin container. Prior to invoking discoverResources() on a discovery component, it was setting the context classloader to the classloader that loaded the discovery component, rather than to the parent resource component's classloader.

[master 67a0771] (http://git.fedorahosted.org/git?p=rhq/rhq.git;a=commitdiff;h=67a0771ffa3678ae0a36946fc69612b07b055d82) fixes it.

To test it, verify that the JBoss AS JVM Resource (a child Resource of the JBoss AS Server Resource) and all its child Resources are auto-discovered and available. Verify this for 1) AS 6.0, 2) AS 6.1, 3) EAP 5.0, and 4) EAP 5.1. Note, in order for RHQ to be able to discover the JVM Resource, you will need to add the following to the bottom of the managed AS or EAP's run.conf and then restart the AS or EAP instance:

JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
Comment 2 Sunil Kondkar 2011-09-20 06:28:10 EDT
Verified on buiild#426 (Version: 4.1.0-SNAPSHOT Build Number: 7739090)

The JBoss AS JVM resource and all its child resources are auto-discovered and
available.

Please refer the screenshot attached for JBoss AS 6.0.0 JVM resource.

Verified that the JVM resource and all its child resources are auto-discovered and available for 1) AS 6.0, 2) AS 6.1, 3) EAP 5.0, and 4) EAP 5.1.

No exceptions are observed.

Marking as verified.
Comment 3 Sunil Kondkar 2011-09-20 06:29:15 EDT
Created attachment 523997 [details]
Screenshot
Comment 4 Mike Foley 2012-02-07 14:21:36 EST
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE

Note You need to log in before you can comment on or make changes to this bug.