Jboss 4.2.0 GA群集无法工作

Jboss 4.2.0 GA群集无法工作,jboss,ejb,cluster-computing,partition,Jboss,Ejb,Cluster Computing,Partition,我是Jboss和EJB的新手。我试图用2个实例组成一个Jboss集群,并从tomcat连接集群,所有Jboss实例和tomcat都在一台机器上运行。 问题是Jboss的两个实例可以组成一个集群,但是tomcat只连接集群的一个节点,当我关闭tomcat连接的节点时, tomcat仍在尝试连接它,无法尝试连接其他节点。因此,它总是显示连接被拒绝 Below is the detail: **1. About the environment**

我是Jboss和EJB的新手。我试图用2个实例组成一个Jboss集群,并从tomcat连接集群,所有Jboss实例和tomcat都在一台机器上运行。 问题是Jboss的两个实例可以组成一个集群,但是tomcat只连接集群的一个节点,当我关闭tomcat连接的节点时, tomcat仍在尝试连接它,无法尝试连接其他节点。因此,它总是显示连接被拒绝

Below is the detail:

**1. About the environment**                                                 
                                                   |------Jboss1
   uses ------> apache(https port443)---->tomcat---|
                                                   |------Jboss2
   Apache is a loadbanlancer with AJP, tomcat work as EJB client to call Jboss. Jboss1 and Jboss2 run on different ports (changed default ports one by one, ie jnp ports are 1199 and 1299,ha-jndi ports are 1200 and 1300)
   and formed a cluter with DefaultPartition. All the applications are good, cause they are copied from production system. And the tomcat can connect jboss1 and jboss2 sepratedly with 
   the respective jndi url(standalone, not for cluster)

**2. Configurations**
   **A.Tomcat jndi configuration:**

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1200,localhost:1300
java.naming.factory.url.pkgs=org.jboss.naming


   **B.Jboss configurations**
   cluster conf:
   I just use the default configuration for cluster with DefaultPartition, jgroups work in default UDP stack .

   **jndi configuration (no ports are defined):**


     # DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
        #
        java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
        java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces


   **jboss.xml for EJB**


     <jboss>
        <enterprise-beans>
           <session>
              <ejb-name>DBNFacade</ejb-name>
              <jndi-name>dbn/DBNFacadeBean</jndi-name>
              <clustered>True</clustered>
           </session>

    I add "**<clustered>True</clustered>**" for every section os session in jboss.xml of the EJB.

**3.Logs**
  **jboss cluster:**
  when I start the 2 instances of jboss, it shows in log like this:
  Node1:
  GMS: address is 127.0.0.1:58279
-------------------------------------------------------
02:42:35,064 INFO  [DefaultPartition] State could not be retrieved (we are the first member in group)
02:42:35,143 INFO  [HANamingService] Started ha-jndi bootstrap jnpPort=1200, backlog=50, bindAddress=localhost/127.0.0.1
02:42:35,155 INFO  [DetachedHANamingService$AutomaticDiscovery] **Listening on /127.0.0.1:1102, group=230.0.0.4, HA-JNDI address=127.0.0.1:1200**

02:42:44,881 INFO  [DefaultPartition] **New cluster view for partition** DefaultPartition (id: 1, delta: 1) : [127.0.0.1:1199, 127.0.0.1:1299]
02:42:44,888 INFO  [DefaultPartition] I am (127.0.0.1:1199) received membershipChanged event:
02:42:44,912 INFO  [DefaultPartition] Dead members: 0 ([])
02:42:44,913 INFO  [DefaultPartition] New Members : 1 ([127.0.0.1:1299])
02:42:44,914 INFO  [DefaultPartition] **All Members : 2** ([127.0.0.1:1199, 127.0.0.1:1299])

  Node2:
-------------------------------------------------------
GMS: address is 127.0.0.1:39298
-------------------------------------------------------
02:42:44,932 INFO  [DefaultPartition] **Number of cluster members: 2**
02:42:44,932 INFO  [DefaultPartition] Other members: 1
02:42:44,933 INFO  [DefaultPartition] Fetching state (will wait for 30000 milliseconds):
02:42:45,137 INFO  [DefaultPartition] state was retrieved successfully (in 204 milliseconds)
02:42:45,278 INFO  [HANamingService] Started ha-jndi bootstrap jnpPort=1300, backlog=50, bindAddress=localhost/127.0.0.1
02:42:45,290 INFO  [DetachedHANamingService$AutomaticDiscovery] **Listening on /127.0.0.1:1102, group=230.0.0.4, HA-JNDI address=127.0.0.1:1300**
02:42:45,655 INFO  [TreeCache] No transaction manager lookup class has been defined. Transactions cannot be used
02:42:45,804 INFO  [InterceptorChainFactory] interceptor chain is:

**when shutdown Jboss1:**
logs on Jboss2----**(it can detect the dead of Jboss1)**
02:50:44,935 INFO  [DefaultPartition] **New cluster view for partition DefaultPartition (id: 2, delta: -1) : [127.0.0.1:1299]**
02:50:44,965 INFO  [DefaultPartition] I am (127.0.0.1:1299) received membershipChanged event:
02:50:44,965 INFO  [DefaultPartition] **Dead members**: 1 ([127.0.0.1:1199])
02:50:44,965 INFO  [DefaultPartition] New Members : 0 ([])
02:50:44,965 INFO  [DefaultPartition] All Members : 1 ([127.0.0.1:1299])

**errors on tomcat:**
ExceptionHandler] URL=[https://192.168.1.232/np/security/signIn.do], QueryString=[null], Referer=[https://192.168.1.232/np/clients/testzfc/login.jsp], SessionId=[7F3DA2CC9AA76C66C091448DEB3EDD7E], orgCode=[testzfc], Exception type=[org.jboss.remoting.CannotConnectException], message=[Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://**localhost:5446**/?clientMaxPoolSize=300&dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&socketTimeout=600000&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]]
- org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://**localhost:5446**/?clientMaxPoolSize=300&dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&socketTimeout=600000&unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]

the url "localhost:5446" in error log of tomcat is just the port of Jboss1.

What's more, sometimes when I started the 2 instances of Jboss, the tomcat connects Jboss2  instead, I do not know the rule. But the resule is the same, tomcat can only recongnize and connect one member of Jboss cluster, unless I restart the tomcat after shuting down the one instance of jboss that was connected successfully by the tomcat.


Could someone tell me what's wrong with this? Thanks in advance!
以下是详细信息:
**1. 关于环境**
|------Jboss1
使用------->apache(https端口443)--->tomcat---|
|------Jboss2
Apache是带有AJP的loadbanlancer,tomcat作为EJB客户端调用Jboss。Jboss1和Jboss2在不同的端口上运行(逐个更改了默认端口,即jnp端口为1199和1299,ha jndi端口为1200和1300)
并与DefaultPartition形成了一个集群。所有的应用程序都很好,因为它们是从生产系统复制的。并且tomcat可以通过以下方式分别连接jboss1和jboss2
各自的jndi url(独立,不适用于集群)
**2. 配置**
**A.Tomcat jndi配置:**
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1200,localhost:1300
java.naming.factory.url.pkgs=org.jboss.naming
**B.Jboss配置**
群集配置:
我只是使用默认配置,用于带有DefaultPartition的集群,jgroups在默认UDP堆栈中工作。
**jndi配置(未定义端口):**
#除非您知道自己在做什么,否则不要编辑此文件
#
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
**用于EJB的jboss.xml**
DBNFacade
dbn/DBNFacadeBean
真的
我在EJB的jboss.xml中为每个操作系统会话添加“**True**”。
**3.日志**
**jboss集群:**
当我启动jboss的2个实例时,它在日志中显示如下:
节点1:
GMS:地址是127.0.0.1:58279
-------------------------------------------------------
02:42:35064信息[DefaultPartition]状态无法检索(我们是组中的第一个成员)
02:42:35143信息[HANamingService]已启动ha jndi引导程序jnpPort=1200,backlog=50,bindAddress=localhost/127.0.0.1
02:42:35155信息[DetachedHANamingService$AutomaticDiscovery]**监听/127.0.0.1:1102,组=230.0.0.4,HA-JNDI地址=127.0.0.1:1200**
02:42:44881信息[DefaultPartition]**分区的新群集视图**DefaultPartition(id:1,增量:1):[127.0.0.1:1199127.0.0.1:1299]
02:42:44888信息[DefaultPartition]我(127.0.0.1:1199)收到成员身份更改事件:
02:42:44912信息[DefaultPartition]已死亡成员:0([])
02:42:44913信息[DefaultPartition]新成员:1([127.0.0.1:1299])
02:42:44914信息[DefaultPartition]**所有成员:2**([127.0.0.1:1199127.0.0.1:1299])
节点2:
-------------------------------------------------------
GMS:地址是127.0.0.1:39298
-------------------------------------------------------
02:42:44932信息[DefaultPartition]**集群成员数:2**
02:42:44932信息[DefaultPartition]其他成员:1
02:42:44933信息[DefaultPartition]获取状态(将等待30000毫秒):
02:42:45137信息[DefaultPartition]状态已成功检索(在204毫秒内)
02:42:45278信息[HANamingService]已启动ha jndi引导程序jnpPort=1300,backlog=50,bindAddress=localhost/127.0.0.1
02:42:45290信息[DetachedHANamingService$AutomaticDiscovery]**监听/127.0.0.1:1102,组=230.0.0.4,HA-JNDI地址=127.0.0.1:1300**
02:42:45655信息[TreeCache]未定义事务管理器查找类。无法使用事务处理
02:42:45804信息[拦截器链工厂]拦截器链是:
**关闭Jboss1时:**
Jboss2上的日志---**(它可以检测Jboss1的死机)**
02:50:44935信息[DefaultPartition]**分区DefaultPartition的新群集视图(id:2,增量:-1):[127.0.0.1:1299]**
02:50:44965信息[DefaultPartition]我(127.0.0.1:1299)收到成员身份更改事件:
02:50:44965信息[DefaultPartition]**死亡成员**:1([127.0.0.1:1199])
02:50:44965信息[DefaultPartition]新成员:0([])
02:50:44965信息[DefaultPartition]所有成员:1([127.0.0.1:1299])
**tomcat上的错误:**
异常处理程序]URL=[https://192.168.1.232/np/security/signIn.do],QueryString=[null],Referer=[https://192.168.1.232/np/clients/testzfc/login.jsp],SessionId=[7F3DA2CC9AA76C66C091448DEB3EDD7E],orgCode=[testzfc],异常类型=[org.jboss.remoting.CannotConnectException],消息=[无法连接到服务器。为InvokerLocator建立套接字连接时出现问题[socket://**localhost:5446**/?clientMaxPoolSize=300&dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshaller.InvocationMarshaller&socketTimeout=600000&unmarshaller=org.jboss.invocation.unifified.marshaller.InvocationUnMarshaller]
-org.jboss.remoting.CannotConnectException:无法连接到服务器。为InvokerLocator建立套接字连接时出现问题[socket://**localhost:5446**/?clientMaxPoolSize=300&dataType=invocation&enableTcpNoDelay=true&marshaller=org.jboss.invocation.unified.marshaller.InvocationMarshaller&socketTimeout=600000&unmarshaller=org.jboss.invocation.unifified.marshaller.InvocationUnMarshaller]
tomcat错误日志中的url“localhost:5446”就是Jboss1的端口。
另外,有时候我启动Jboss的2个实例时,tomcat会连接Jboss2,我不知道规则,但结果是一样的,tomcat只能识别并连接Jboss集群的一个成员,除非我重新启动tomcat a