2 Replies Latest reply on Aug 7, 2003 7:13 AM by uuu

    JBossMQProvider and HTTPServerILService

    uuu

      Hi!
      I try to connect MDB to remote topic through HTTP in JBoss 3.2.1.
      I have configured JBossMQProvider in jms-ds.xml


      JBossMQRemoteProvider

      org.jboss.jms.jndi.JBossMQProvider

      HTTPConnectionFactory
      HTTPConnectionFactory
      http://localhost:8080/invoker/JMXInvokerServlet



      I've forced my MDB to use this JMS provider(JBossMQRemoteProvider) by defining <container-configuration>.
      If I use UIL2ConnectionFactory instead of HTTPConnectionFactory it works fine.
      But when I try HTTPConnectionFactory I get the following error:

      2003-08-07 14:10:10,094 WARN [org.jnp.interfaces.NamingContext] Failed to connect to localhost:8080
      javax.naming.CommunicationException: Failed to retrieve stub from server localhost:8080. Root exception is
      java.io.EOFException
      at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2150)
      at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2619)
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:726)
      at java.io.ObjectInputStream.(ObjectInputStream.java:251)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:198)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1116)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:478)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerCreate(JMSContainerInvoker.java:455)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.startService(JMSContainerInvoker.java:579)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at org.jboss.ejb.MessageDrivenContainer.startService(MessageDrivenContainer.java:220)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
      at $Proxy12.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:392)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      .....
      I've looked inside the code of org.jboss.jms.jndi.JBossMQProvider and it seems to me there's a bug.

      public Context getInitialContext() throws NamingException {
      Context ctx = null;
      boolean debug = log.isDebugEnabled();
      if (providerURL == null) {
      // Use default
      if (debug)
      log.debug("no provider url; connecting to local JNDI");
      ctx = new InitialContext(); // Only for JBoss embedded now
      } else {
      // Try another location

      Hashtable props = new Hashtable();
      props.put(Context.INITIAL_CONTEXT_FACTORY,INITIAL_CONTEXT_FACTORY);
      props.put(Context.PROVIDER_URL, providerURL);
      props.put(SECURITY_MANAGER, hasJndiSecurityManager);
      props.put(Context.URL_PKG_PREFIXES, URL_PKG_PREFIXES);

      if (debug)
      log.debug("connecting to remote JNDI with props: " + props);
      ctx = new InitialContext(props);
      }

      if (debug) {
      log.debug("created context: " + ctx);
      }
      return ctx;
      }
      That code tries to get the connection factory using org.jnp.interfaces.NamingContextFactory and it fails to handle communication by HTTP.
      And I found no way to make it use the right context factory.
      Please tell me if there is a way out.