[jboss-user] [Clustering/JBoss] - HAJMS over HTTP using HTTP

taekkyun do-not-reply at jboss.com
Tue Sep 19 14:19:02 EDT 2006


I am having problems with HA JMS on 4.0.3SP1.

I am using HAJNDI and HAJMS over HTTP(s) from a remote client.
I have few servers clustered.  Everything works fine when running single (clustered set) server, but when I have more than one server running in the cluster, I have problems.  This is also behind a load balancer.

When the client does a JNDI look up on HTTPXAConnectionFactory,
it works fine, however after the lookup and when the jms connection is being made thru the jbossmq-httpil/HTTPServerILServlet,
I don't get or get a connection depending on which server is being hit.

I am guessing at this point, its my JMS settings via HAJNDI.
Do I need to configure 
<!-- Access JMS via HAJNDI -->
    
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=${jboss.bind.address:localhost}:1100
       jnp.disableDiscovery=false
       jnp.partitionName=${jboss.partition.name:AffiliatePartition}
       jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
       jnp.discoveryPort=1102
       jnp.discoveryTTL=16
       jnp.discoveryTimeout=5000
       jnp.maxRetries=1
    
to do a look up over HTTP???

I have been playing with over and over and I'm pretty stuck here.

My configuration is below.


  | == deploy/http-invoker.sar/META-INF/jboss-service.xml
  | =====================================
  | <!-- Expose the HA Naming service interface via HTTP -->
  |    <mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
  |       name="jboss:service=invoker,type=http,target=HAJNDI">
  |       <!-- The Naming service we are proxying -->
  |       <attribute name="InvokerName">jboss:service=HAJNDI</attribute>
  |       <!-- Compose the invoker URL from the cluster node address -->
  |       <attribute name="InvokerURL">http://www.mysite.jp/invoker/JMXInvokerHAServlet</attribute>
  |       <attribute name="InvokerURLPrefix">http://</attribute>
  |       <attribute name="InvokerURLSuffix">:8080/invoker/JMXInvokerHAServlet</attribute>
  |       <attribute name="UseHostName">false</attribute>
  |       <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
  |       <attribute name="JndiName"></attribute>
  |       <attribute name="ClientInterceptors">
  |           <interceptors>
  |              <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
  |              <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
  |              <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor>
  |              <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
  |           </interceptors>
  |       </attribute>
  |    </mbean>
  | 
  | == deploy/http-invoker.sar/invoker.war/web.xml
  | =====================================
  | .......
  | <servlet>
  |        <servlet-name>HAJNDIFactory</servlet-name>
  |        <description>A servlet that exposes the JBoss JNDI Naming service stub
  |        through http, but only for a single read-only context. The return content
  |        is a serialized MarshalledValue containg the org.jnp.interfaces.Naming
  |        stub.
  |        </description>
  |        <servlet-class>org.jboss.invocation.http.servlet.NamingFactoryServlet</servlet-class>
  |       <init-param>
  |           <param-name>namingProxyMBean</param-name>
  |           <param-value>jboss:service=invoker,type=http,target=HAJNDI</param-value>
  |       </init-param>
  |       <init-param>
  |          <param-name>proxyAttribute</param-name>
  |          <param-value>Proxy</param-value>
  |       </init-param>
  |        <load-on-startup>2</load-on-startup>
  |    </servlet>
  | 
  | .......
  | <servlet-mapping>
  |         <servlet-name>HAJNDIFactory</servlet-name>
  |         <url-pattern>/HAJNDIFactory/*</url-pattern>
  |     </servlet-mapping>   
  |     <servlet-mapping>
  |         <servlet-name>JMXInvokerServlet</servlet-name>
  |         <url-pattern>/JMXInvokerServlet/*</url-pattern>
  |     </servlet-mapping>
  |     <!-- A mapping for the JMXInvokerServlet that only allows invocations
  |     of lookups under a read-only context. This is enforced by the
  |     ReadOnlyAccessFilter
  |     -->
  |     <servlet-mapping>
  |         <servlet-name>JMXInvokerServlet</servlet-name>
  |         <url-pattern>/readonly/JMXInvokerServlet/*</url-pattern>
  |     </servlet-mapping>
  |    <servlet-mapping>
  |        <servlet-name>JMXInvokerServlet</servlet-name>
  |        <url-pattern>/JMXInvokerHAServlet/*</url-pattern>
  |    </servlet-mapping>
  | 
  |     <!-- Alternate mappings that place the servlets under the restricted
  |     path to required authentication for access. Remove the unsecure mappings
  |     if only authenticated users should be allowed.
  |     -->
  |     <servlet-mapping>
  |         <servlet-name>JNDIFactory</servlet-name>
  |         <url-pattern>/restricted/JNDIFactory/*</url-pattern>
  |     </servlet-mapping>
  |     <servlet-mapping>
  |         <servlet-name>JMXInvokerServlet</servlet-name>
  |         <url-pattern>/restricted/JMXInvokerServlet/*</url-pattern>
  |     </servlet-mapping>
  | 
  |    <!-- An example security constraint that restricts access to the HTTP invoker
  |    to users with the role HttpInvoker Edit the roles to what you want and
  |    configure the WEB-INF/jboss-web.xml/security-domain element to reference
  |    the security domain you want.
  |    -->
  |    <security-constraint>
  |       <web-resource-collection>
  |          <web-resource-name>HttpInvokers</web-resource-name>
  |          <description>An example security config that only allows users with the
  |             role HttpInvoker to access the HTTP invoker servlets
  |          </description>
  |          <url-pattern>/restricted/*</url-pattern>
  |          <http-method>GET</http-method>
  |          <http-method>POST</http-method>
  |       </web-resource-collection>
  |       <auth-constraint>
  |          <role-name>HttpInvoker</role-name>
  |       </auth-constraint>
  |    </security-constraint>
  |    <login-config>
  |       <auth-method>BASIC</auth-method>
  |       <realm-name>JBoss HTTP Invoker</realm-name>
  |    </login-config>
  | 
  |    <security-role>
  |       <role-name>HttpInvoker</role-name>
  |    </security-role>
  | </web-app>
  | 
  | == deploy/jms
  | ====================
  | <connection-factories>
  |  
  |   <!-- ==================================================================== -->
  |   <!-- JMS Stuff                                                            -->
  |   <!-- ==================================================================== -->
  | 
  |   <!-- The JMS provider loader -->
  |   <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
  |          name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider">
  |     <attribute name="ProviderName">DefaultJMSProvider</attribute>
  |     <attribute name="ProviderAdapterClass">
  |       org.jboss.jms.jndi.JNDIProviderAdapter
  |     </attribute>
  |     <!-- The combined connection factory -->
  |     <attribute name="FactoryRef">XAConnectionFactory</attribute>
  |     <!-- The queue connection factory -->
  |     <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
  |     <!-- The topic factory -->
  |     <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
  |     <!-- Access JMS via HAJNDI -->
  |     <attribute name="Properties">
  |        java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
  |        java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
  |        java.naming.provider.url=${jboss.bind.address:localhost}:1100
  |        jnp.disableDiscovery=false
  |        jnp.partitionName=${jboss.partition.name:AffiliatePartition}
  |        jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
  |        jnp.discoveryPort=1102
  |        jnp.discoveryTTL=16
  |        jnp.discoveryTimeout=5000
  |        jnp.maxRetries=1
  |     </attribute>
  |   </mbean>
  | 
  |   <!-- The server session pool for Message Driven Beans -->
  |   <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
  |          name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool">
  |     <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
  |     <attribute name="PoolName">StdJMSPool</attribute>
  |     <attribute name="PoolFactoryClass">
  |       org.jboss.jms.asf.StdServerSessionPoolFactory
  |     </attribute>
  |   </mbean>
  | 
  |   <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
  |   <tx-connection-factory>
  |     <jndi-name>JmsXA</jndi-name>
  |     <xa-transaction/>
  |     <rar-name>jms-ra.rar</rar-name>
  |     <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
  |     <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
  |     <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
  | 
  |     <max-pool-size>20</max-pool-size>
  |     <security-domain-and-application>JmsXARealm</security-domain-and-application>
  |   </tx-connection-factory>
  | 
  | </connection-factories>
  | 
  | ==/deploy-hasingleton/jms/jbossmq-httpil.sar/META-INF/jboss-service.xml
  | =================================================
  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE server>
  | <server>
  |     <mbean code="org.jboss.mq.il.http.HTTPServerILService"
  |          name="jboss.mq:service=InvocationLayer,type=HTTP">
  |     <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends>
  |     <depends>jboss.web:service=WebServer</depends>
  |     <attribute name="ConnectionFactoryJNDIRef">HTTPConnectionFactory</attribute>
  |     <attribute name="XAConnectionFactoryJNDIRef">HTTPXAConnectionFactory</attribute>
  |     <attribute name="PingPeriod">0</attribute>
  |     <attribute name="TimeOut">60</attribute>
  |     <attribute name="RestInterval">0</attribute>
  |     <attribute name="URL">http://www.mysite.jp/jbossmq-httpil/HTTPServerILServlet</attribute>
  |     <attribute name="URLPrefix">http://</attribute>
  |     <attribute name="URLHostName">www.mysite.jp</attribute>
  |     <attribute name="URLPort">80</attribute>
  |   </mbean>
  | </server>
  | 
  | == deploy-hasingleton/jms/jbossmq-httpil.sar/jbossmq-httpil.war/WEB-INF/web.xml
  | ================================================
  | 
  | <web-app>
  |   <servlet>
  |     <servlet-name>HTTPServerILServlet</servlet-name>
  |     <display-name>JBossMQ HTTP-IL Servlet</display-name>
  |     <description>Provides and HTTP invocation layer for JBossMQ</description>
  |     <servlet-class>org.jboss.mq.il.http.servlet.HTTPServerILServlet</servlet-class>
  |     <init-param>
  |         <param-name>Invoker</param-name> 
  |         <param-value>jboss.mq:service=Invoker</param-value> 
  |      </init-param>
  |   </servlet>
  |   <servlet-mapping>
  |     <servlet-name>HTTPServerILServlet</servlet-name>
  |     <url-pattern>/HTTPServerILServlet/*</url-pattern>
  |   </servlet-mapping>
  | 
  |   <!-- Alternate mappings that place the servlets under the restricted
  |     path to required authentication for access. Remove the unsecure mappings
  |     if only authenticated users should be allowed.
  |     -->
  |   <servlet-mapping>
  |     <servlet-name>HTTPServerILServlet</servlet-name>
  |     <url-pattern>/restricted/HTTPServerILServlet/*</url-pattern>
  |   </servlet-mapping>
  | 
  |    <!-- An example security constraint that restricts access to the HTTP invoker
  |    to users with the role HttpInvoker Edit the roles to what you want and
  |    configure the WEB-INF/jboss-web.xml/security-domain element to reference
  |    the security domain you want.
  |    -->
  |    <security-constraint>
  |       <web-resource-collection>
  |          <web-resource-name>HTTPServerILServlet</web-resource-name>
  |          <description>An example security config that only allows users with the
  |             role JBossMqHttpIl to access the HTTP-IL servlet
  |          </description>
  |          <url-pattern>/restricted/*</url-pattern>
  |          <http-method>GET</http-method>
  |          <http-method>POST</http-method>
  |       </web-resource-collection>
  | ===============================================
  | AND FROM MY CLIENT Lookup is done with
  | java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
  | java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
  | java.naming.provider.url=http://www.gmoad.jp/invoker/HAJNDIFactory
  | ........

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

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



More information about the jboss-user mailing list