3 Replies Latest reply on Sep 23, 2004 7:57 PM by Elias Ross

    Sending messages from JBoss to Joram

    pjrichter Newbie

      I'm trying to send a message to a Joram topic and cannot find specific documentation or examples anywhere. So far I've got:

      in jboss-service.xml:

      <!-- Bind the Joram JNDI server -->
       <mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=external/joram/fileMaint">
       <attribute name="JndiName">external/joram/fileMaint</attribute>
       <attribute name="CacheContext">true</attribute>
       <attribute name="Properties">joram.properties</attribute>
       <attribute name="InitialContext">
       <attribute name="RemoteAccess">true</attribute>

      in joram.properties

      Here's the code snippet I'm using
      private InitialContext jbosscontext = null;
       private Context joramcontext = null;
       private Connection conn = null;
       public String send() throws Exception
       System.out.println("Sends messages from JBoss to Joram...");
       jbosscontext = new InitialContext();
       Object tmp = jbosscontext.lookup("external/joram/fileMaint");
       joramcontext = (Context)tmp;
       TcpConnectionFactory cf = (TcpConnectionFactory) joramcontext.lookup("cf");

      I know the context exists and is bound because I can access from outside JBoss. I'm receiving this exception when it tries to retrieve the connection factory context:

      Cause: javax.naming.NameNotFoundException: cf not bound
       at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:303)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
       at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:234)

      Can anyone spot my problem or point me in the right direction?

        • 1. Re: Sending messages from JBoss to Joram
          Elias Ross Master

          I think for

           <attribute name="Properties">joram.properties</attribute>

          You put in the actual properties that you have in the file, not the filename.

          • 2. Re: Sending messages from JBoss to Joram
            pjrichter Newbie

            The documentation (JBoss Admin pg 230) just has a file name. Do you know what the format might be to list the properties?

            I also tried this technique, but keep getting a NoInitialContexException.

            Properties prop = new Properties();
             ictx = new InitialContext(prop);
             ConnectionFactory cnxF = (TcpConnectionFactory)TcpConnectionFactory.create("localhost", 16010);
             Connection cnx = cnxF.createConnection();
             Session session = cnx.createSession(true, 0);
             org.objectweb.joram.client.jms.Queue dest = (org.objectweb.joram.client.jms.Queue) ictx.lookup("MyQueue");

            • 3. Re: Sending messages from JBoss to Joram
              Elias Ross Master

              I think the docs are wrong, at these ones are...


              "Properties" should be "PropertiesUrl"

              If you have everything done correctly, the JndiView tool in the JMX console should show everything on this remote server. You can also play around with the actual MBean you're creating below, there's a bunch of stuff to use. It'll also show you what attributes are available.

              When it works, I guess you just do
              ConnectionFactory cf =
              new InitialContext().lookup("external/joram/fileMaint/cf");