Details
-
Bug
-
Resolution: Unresolved
-
Major
-
6.0.0.M3
-
None
-
Low
Description
We were getting the following exception when trying to connect from the RHQ Agent to AS M3 via JNP:
Caused by: java.lang.NoClassDefFoundError:
org/jboss/classpool/spi/ClassPoolRepositoryCallback
at org.jboss.aop.AspectManager.initManager(AspectManager.java:267)
at org.jboss.aop.AspectManager.instance(AspectManager.java:246)
at org.jboss.aop.AspectManager.instance(AspectManager.java:235)
at org.jboss.aop.proxy.ProxyFactory.createProxyCtClass(ProxyFactory.java:150)
at org.jboss.aop.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:119)
at org.jboss.aop.proxy.ProxyFactory.createInterfaceProxy(ProxyFactory.java:96)
at
org.jboss.aop.proxy.MarshalledInterfaceProxy.readResolve(MarshalledInterfaceProxy.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1078)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1779)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at java.rmi.MarshalledObject.get(MarshalledObject.java:159)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:771)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at
org.rhq.plugins.jbossas5.connection.AbstractProfileServiceConnectionProvider.lookup(AbstractProfileServiceConnectionProvider.java:81)
at
org.rhq.plugins.jbossas5.connection.RemoteProfileServiceConnectionProvider.doConnect(RemoteProfileServiceConnectionProvider.java:108)
at
org.rhq.plugins.jbossas5.connection.RemoteProfileServiceConnectionProvider.doConnect(RemoteProfileServiceConnectionProvider.java:43)
at
org.rhq.plugins.jbossas5.connection.AbstractProfileServiceConnectionProvider.connect(AbstractProfileServiceConnectionProvider.java:42)
at
org.rhq.plugins.jbossas5.ApplicationServerComponent.connectToProfileService(ApplicationServerComponent.java:401)
at
org.rhq.plugins.jbossas5.ApplicationServerComponent.start(ApplicationServerComponent.java:195)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
... 5 more
Caused by: java.lang.ClassNotFoundException:
org.jboss.classpool.spi.ClassPoolRepositoryCallback
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at
org.rhq.core.pc.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:63)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
... 36 more
Note, the exception occurs on a the call to InitialContext.lookup(). We never saw this in AS 5.x. I was able to get past the exception by adding JBOSS_HOME/lib/jboss-classpool.jar and JBOSS_HOME/lib/jboss-classpool-scoped.jar to the RHQ Agent's classpath.
So these two jars are now apparently required in the client classpath for the following basic JNP based lookup of the ProfileService to work:
Properties env = new Properties();
env.setProperty(Context.PROVIDER_URL, "jnp://127.0.0.1:1099/");
// Always use the non-login context factory, since we'll use JAAS for authentication if a username/password was
// provided.
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
InitialContext initialContext;
try
initialContext = new InitialContext(env);
} catch (NamingException e)
ProfileService profileService = (ProfileService)initialContext.lookup("ProfileService");
Since this is the case, I think these two jars should be copied to JBOSS_HOME/client/ and also included in JBOSS_HOME/client/jbossall-client.jar's MANIFEST.MF Class-Path, to emphasize that they are needed for client connections and so that existing client code that uses jbossall-client.jar will not have to be updated to also include these two jars.