[jboss-user] [Beginners Corner] Weird Connection Problem on JBoss5.0CR2 (connect doesn't work after startup - but during startup it works)

Richard Krutisch richard.krutisch at gmx.net
Sun Nov 30 05:01:52 EST 2008


Hello, I've got a very weird problem, and I'd be really thankfull for help.

I run this very simple program, just to list the bindings on my jboss:

        Properties properties= new Properties();
        //+ this is the factory used to create the context
        
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
        
properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
        properties.put("java.naming.provider.url","jnp://127.0.0.1:1099");


        Context ctx = new InitialContext(properties);
       
        System.out.println("got initial context: " + ctx.getClass());
        for (Enumeration e = ctx.listBindings(""); e.hasMoreElements();) {
            try {
            System.out.println("root context: " + 
e.nextElement().getClass());
            }catch(Exception exc){
                exc.printStackTrace();
            }
        }


The results differ, according to the time I run the program.
If I run the program during JBoss startup, the results look like this:

//        got initial context: class javax.naming.InitialContext
//        - SocketClientInvoker[147ee05, socket://127.0.0.1:4446] 
setting enableTcpNoDelay to true
//        - SocketClientInvoker[147ee05, socket://127.0.0.1:4446] 
constructed
//        - SocketClientInvoker[147ee05, socket://127.0.0.1:4446] 
setting enableTcpNoDelay to true
//        - SocketClientInvoker[147ee05, socket://127.0.0.1:4446] connecting
//        - Creating semaphore with size 50
//        - SocketClientInvoker[147ee05, socket://127.0.0.1:4446] connected
//        root context: UserTransactionSessionFactory: 
$Proxy121:org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy at 1feca64
//        root context: UUIDKeyGeneratorFactory: 
org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory:org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory at 998b08
//        root context: jmx: 
org.jnp.interfaces.NamingContext:org.jnp.interfaces.NamingContext at 76cbf7
(I get output on the server as well)

...
But if I run the client after startup, the client doesn't seem to 
connect to the server, but is staying locally in his own process engine, 
executing the server code there, and not finding the 'jboss' MBeanServer:

Exception in thread "main" java.lang.IllegalStateException: No 'jboss' 
MBeanServer found!

    at 
org.jboss.mx.util.MBeanServerLocator.locateJBoss(MBeanServerLocator.java:131)
    at 
org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory.readResolve(HiLoKeyGeneratorFactory.java:420)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at 
java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
    at 
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
    at 
org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
    at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:964)
    at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:917)
    at javax.naming.InitialContext.listBindings(InitialContext.java:447)
    at client.JBossClient.main(JBossClient.java:41)


I use JBoss5.0CR2 - starting the Main.class by hand, from inside of 
eclipse. (I start it from Source, because I want to read and insert log 
statements in the code)

I would be very gratefull for any hints, why it doesn't work after jboss 
startup is completed.
Richard



More information about the jboss-user mailing list