6 Replies Latest reply on Jul 24, 2008 5:14 AM by kconner

    JMS service setting is used by the client which make the esb

    evanyang

      I am using JBoss AS 4.2.2 and JBoss ESB 4.3.
      We all know that in the jboss-esb.xml, we need to define the JMS configurations:

      <jms-provider name="JBossMQ"
       connection-factory="ConnectionFactory"
       jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
       jndi-URL="localhost">
      ....
      
      


      All the sample showing the jndi-URL is 'localhost' which make sense for services that connect to local jms on the server side.

      But this configuration also used by the ServiceInvoker from the client program, which causing problem:

      1. took me a long while to figure out why I keep having service not available exception with the localhost:1099, while my client program is connecting to the jboss/esb remotely, and no where has any note about this problem can be found over the internet.

      2. so when I change this URL to the host name, all is working, but then the same esb archive can't be deployed to different environments (like dev/qa/prod)

      Is there a different way that the client program can be implemented? (I am using a copy of the jbosses-properties.xml from the samples) or any solution (or different way of configuration for the jboss-esb.xml) for the esb portability?



        • 1. Re: JMS service setting is used by the client which make the
          kconner

          You should only specify the JNDI attributes if you wish to make them explicit. If they are not specified then they will default to the values used within the server.

          The only gotcha (until 4.4GA is out) would be if you were binding to the ANY address. If you are doing this then you should modify the jbossesb-properties.xml file and change jboss.bind.address.

          • 2. Re: JMS service setting is used by the client which make the
            evanyang

            Still not clear what I need to do here?

            OK, from the server side, I have to change the jndi-url from the jboss-esb.xml, which I prefer not to:

            <jms-provider name="JBossMQ"
             connection-factory="ConnectionFactory"
             jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
             jndi-URL="evan-desktop.xxx.com">
            


            Then what exactly I need to do on the client jbossesb-properties.xml?

            <?xml version="1.0" encoding="ISO-8859-1"?>
            <!--
             JBoss, Home of Professional Open Source
             Copyright 2006, JBoss Inc., and others contributors as indicated
             by the @authors tag. All rights reserved.
             See the copyright.txt in the distribution for a
             full listing of individual contributors.
             This copyrighted material is made available to anyone wishing to use,
             modify, copy, or redistribute it subject to the terms and conditions
             of the GNU Lesser General Public License, v. 2.1.
             This program is distributed in the hope that it will be useful, but WITHOUT A
             WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
             PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
             You should have received a copy of the GNU Lesser General Public License,
             v.2.1 along with this distribution; if not, write to the Free Software
             Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
             MA 02110-1301, USA.
            
             (C) 2005-2006,
             @author JBoss Inc.
            -->
            <!-- $Id: jbossesb-unittest-properties.xml $ -->
            <!--
             These options are described in the JBossESB manual.
             Defaults are provided here for convenience only.
            
             Please read through this file prior to using the system, and consider
             updating the specified entries.
            -->
            <esb
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
             <properties name="core">
             <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
             <property name="org.jboss.soa.esb.jndi.server.url" value="evan-desktop.xxx.com"/>
             <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
             <property name="jboss.esb.invm.scope.default" value="NONE"/>
             </properties>
             <properties name="registry">
             <property name="org.jboss.soa.esb.registry.queryManagerURI"
             value="jnp://evan-desktop.xxx.com:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
             <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
             value="jnp://evan-desktop.xxx.com:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
             <property name="org.jboss.soa.esb.registry.implementationClass"
             value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
             <property name="org.jboss.soa.esb.registry.factoryClass"
             value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
             <property name="org.jboss.soa.esb.registry.user"
             value="jbossesb"/>
             <property name="org.jboss.soa.esb.registry.password"
             value="password"/>
             <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
             <property name="org.jboss.soa.esb.scout.proxy.transportClass"
             value="org.apache.ws.scout.transport.RMITransport"/>
             </properties>
             <properties name="transports" depends="core">
             <property name="org.jboss.soa.esb.mail.smtp.host" value="evan-desktop.xxx.com"/>
             <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
             <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
             <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
             </properties>
             <properties name="connection">
             <property name="min-pool-size" value="5"/>
             <property name="max-pool=size" value="10"/>
             <property name="blocking-timeout-millis" value="5000"/>
             <property name="abandoned-connection-timeout" value="10000"/>
             <property name="abandoned-connection-time-interval" value="30000"/>
             </properties>
             <properties name="dbstore">
             <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://evan-desktop.xxx.com:9001/jbossesb"/>
             <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
             <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
             <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
             <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
             <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
             <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
             <!--table managed by pool to test for valid connections - created by pool automatically -->
             <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
             <!-- # of milliseconds to timeout waiting for a connection from pool -->
             <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
             </properties>
             <properties name="messagerouting">
             <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
             </properties>
            </esb>
            
            


            • 3. Re: JMS service setting is used by the client which make the
              evanyang

              I have tried to not define the JNDI attributes in the jboss-esb.xml:

              <jms-provider name="JBossMQ" connectionfactory="ConnectionFactory">
              ....
              </jms-provider>
              


              but that does not work, since it defaulted to localhost again:



              If they are not specified then they will default to the values used within the server.


              I am getting the "Failed to connect to server localhost:1099" again when connecting from a remote client.

              This is critical to my project, please any one know this problem or have similar experiences, please provide you comments.
              Thanks.

              • 4. Re: JMS service setting is used by the client which make the
                kconner

                ESB 4.3 defaults to the IP address used by the binding parameter on startup (-b x.x.x.x) so your configuration should be correct.

                I am assuming that you have started the server on an external IP address so the only explanations that I can think of for the localhost references are
                - You have another deployment creating that EPR
                - You have stale EPRs in the registry.
                - You have modified jbossesb-properties.xml

                What EPRs are being returned from the registry? (see the ServiceInvoker debugs in the logs)

                • 5. Re: JMS service setting is used by the client which make the
                  evanyang

                  I have redeployed my ESB archive with the different jboss-esb.xml couple times, may bet there is a stale registry issue, but since I don't know how to clean up stale registry (please provide comment if any process exist), so I reinstalled a new jboss AS/ESB and deploy the archives, then here are the new problems:

                  1. first i started the server as "run -b 0.0.0.0", then the client throws exception of can't find "0.0.0.0:1099", so I started the server as "run -b my.host.name.com", then my client now is connecting to the remote server.

                  2. how ever my esb service/action that looks up a local EJB now is failing to bind the bean, here is the binding code in my action:

                  Properties prop = new Properties();
                  prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                  prop.setProperty(Context.PROVIDER_URL,"jnp://localhost:1099");
                  prop.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                  
                  InitialContext context = new InitialContext(prop);
                  
                  bean = (LiveProcessBeanLocal)context.lookup("livePorcessEAR/LiveProcessBean/local");
                  


                  The exception is:

                  Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
                  


                  But of course I can specified the PROVIDER_URL to be my host name, but then it come back to the original issue, the ESB archive is not portable.


                  • 6. Re: JMS service setting is used by the client which make the
                    kconner

                     

                    "evanyang" wrote:
                    I have redeployed my ESB archive with the different jboss-esb.xml couple times, may bet there is a stale registry issue, but since I don't know how to clean up stale registry (please provide comment if any process exist), so I reinstalled a new jboss AS/ESB and deploy the archives, then here are the new problems:

                    The easiest way is to clean out the database or, if this is not possible, you can have the ServiceInvoker do this by setting the property 'org.jboss.soa.esb.failure.detect.removeDeadEPR' to 'true'.

                    You will still see errors as the dead EPRs are encountered but a failure would then lead to a removal of the EPR from the registry.

                    "evanyang" wrote:
                    1. first i started the server as "run -b 0.0.0.0", then the client throws exception of can't find "0.0.0.0:1099", so I started the server as "run -b my.host.name.com", then my client now is connecting to the remote server.

                    With current releases you must override the default in jbossesb-properties.xml if you wish to specify the wild card binding address. This has been addressed in https://jira.jboss.org/jira/browse/JBESB-1804 and will be in the upcoming ESB 4.4 release.

                    "evanyang" wrote:
                    2. how ever my esb service/action that looks up a local EJB now is failing to bind the bean, here is the binding code in my action:

                    Properties prop = new Properties();
                    prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                    prop.setProperty(Context.PROVIDER_URL,"jnp://localhost:1099");
                    prop.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                    
                    InitialContext context = new InitialContext(prop);
                    
                    bean = (LiveProcessBeanLocal)context.lookup("livePorcessEAR/LiveProcessBean/local");
                    


                    The exception is:

                    Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
                    


                    But of course I can specified the PROVIDER_URL to be my host name, but then it come back to the original issue, the ESB archive is not portable.

                    If you are running your code from within the esb then there is no need to specify the properties, just using the following would suffice.
                    final InitialContext context = new InitialContext();