Hi everybody,

I'm having a rather exotic problem at the moment. Trying to connect to JBoss MQ 
from a remote client, I succeed when I don't want to.

Some test code may make this clearer:


Properties env = new Properties();
                env.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
                env.put(Context.PROVIDER_URL, 
"jnp://mafaws01:1099"
);
                env.put(Context.URL_PKG_PREFIXES, 
"org.jboss.naming:org.jnp.interfaces");
                Context context = new InitialContext(env);

                Queue queue = (Queue)context.lookup("queue/A");
                System.out.println("Found queue: " + queue);
                QueueConnectionFactory connectionFactory = 
(QueueConnectionFactory)context.lookup("ConnectionFactory");
                System.out.println("Found factory: " + connectionFactory);


This works fine when JBoss is up and running on the server mafaws01. But  to my 
amazement it also works when I've stopped JBoss! The output below  is what I 
get in that case. Apparently the NamingContext object fails to connect to the 
naming service but still hands me back the factory and queue registered in the 
JNDI tree, whereas I would prefer that it fails miserably... By the way, if I 
change the JNDI names to something not found in JNDI, I don't get a factory and 
queue. 

006-06-28 15:18:26,996 [main] DEBUG org.jnp.interfaces.NamingContext - Failed 
to connect to mafaws01:1099
javax.naming.CommunicationException: Failed to connect to server mafaws01:1099 
[Root exception is javax.naming.ServiceUnavailableException: Failed to connect 
to server mafaws01:1099 [Root exception is java.net.ConnectException: 
Connection refused: connect]]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at se.rgk.boxer.tests.RemoteJmsTest.main(RemoteJmsTest.java:21)
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to 
server mafaws01:1099 [Root exception is java.net.ConnectException: Connection 
refused: connect]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
        ... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.(Unknown Source)
        at java.net.Socket.(Unknown Source)
        at 
org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
        at 
org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
        ... 5 more
2006-06-28 15:18:27,371 [main] DEBUG 
org.jboss.mq.referenceable.SpyDestinationObjectFactory - 
SpyDestinationObjectFactory->getObjectInstance()
Found queue: QUEUE.A
2006-06-28 15:18:27,402 [main] DEBUG 
org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory - Extracting 
SpyConnectionFactory from reference
2006-06-28 15:18:27,480 [main] DEBUG 
org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory - The 
GenericConnectionFactory is: [EMAIL PROTECTED] 
connectionProperties={ClientILService=org.jboss.mq.il.uil2.UILClientILService, 
UIL_TCPNODELAY_KEY=yes, UIL_CHUNKSIZE_KEY=1000000, UIL_CONNECTADDRESS_KEY=null, 
UIL_CONNECTPORT_KEY=0, UIL_SOTIMEOUT_KEY=120000, UIL_RECEIVE_REPLIES_KEY=No, 
UIL_ADDRESS_KEY=172.16.11.90, UIL_PORT_KEY=8093, PingPeriod=60000, 
UIL_BUFFERSIZE_KEY=2048}]
Found factory: [EMAIL PROTECTED]


Are JNDI names and stubs somehow cached locally? Does anybody know how to 
disable this behaviour? Or is there away of checking whether the 
connectionFactory is really only a disconnected stub?



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

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

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to