[jboss-user] [JNDI/Naming/Network] - JNDI Newbie - Please help !!!

mrroger do-not-reply at jboss.com
Mon Nov 13 18:42:34 EST 2006


This is my code:

package test.main;
import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
import java.util.*;
import javax.management.*;
import javax.naming.*;

public class TestMain {
	public static void main(String args[]) throws Exception {
		System.out.println("Starting");
		Properties props=new Properties();		props.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
		props.put(InitialContext.PROVIDER_URL, "jnp://localhost:1099");		   props.put(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");		
		InitialContext ic = new InitialContext(props);		
		Hashtable icHash = ic.getEnvironment();		
		Enumeration enumHash = icHash.keys();		
		System.out.println("Key num: " + icHash.size());		
		while(enumHash.hasMoreElements()) {
			Object nextIc = enumHash.nextElement();			
			System.out.print("Keys: "+nextIc.toString());
			System.out.println(" = "+icHash.get(nextIc));
		}		
		System.out.println("Initial Context ok: ");	
		NamingEnumeration names = ic.list("");	
		System.out.println("Has More: " + names.hasMoreElements());			
		while(names.hasMoreElements()) {
			System.out.println((String) names.nextElement().toString());
		}
		RMIAdaptor server = (RMIAdaptor) ic.lookup("jmx/invoker/RMIAdaptor");
		System.out.println("RMIAdaptor ok: "+server.getMBeanCount());
		System.out.println("Name: " + server.getDefaultDomain());
	
===>        ObjectName nameTest = new ObjectName("jboss:service=JNDIView");
		
		MBeanInfo info = server.getMBeanInfo(nameTest);
		System.out.println("Name: " + info.getClassName());		
		System.out.println("Finished");
	}
}

This is the error where arrow is:

Exception in thread "main" java.lang.NullPointerException
   at java.io.ObjectStreamClass.setClass(libgcj.so.7)
   at java.io.ObjectInputStream.readClassDescriptor(libgcj.so.7)
   at java.io.ObjectInputStream.readObject(libgcj.so.7)
   at java.io.ObjectInputStream.readObject(libgcj.so.7)
   at java.rmi.MarshalledObject.get(libgcj.so.7)
   at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
   at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
   at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
   at org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:51)
   at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
   at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:59)
   at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
   at $Proxy0.getMBeanInfo(Unknown Source)
   at test.main.TestMain.main(TestMain.java:50)

PLEASE HELP !!!!

WHERE I AM WRONG ???

Thank a lot

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985647#3985647

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985647



More information about the jboss-user mailing list