2016-11-17 96 views
1

我有一個獨立域名的工作,但在羣集安裝失敗的應用程序。JMS的查找連接工廠池Glassfish的羣集上失敗

在我的應用程序中,我有一個JCA資源適配器,需要通過JMS消息在EIS中的特定情況下發送消息,因此在連接實現之後,我會呼叫getJMSConnectionFactory

private Object lookup(String what) { 
    try { 
     // needs no environment 
     Context jndiContext = new InitialContext(); 
     return jndiContext.lookup(what); 
    } catch (NamingException ex) { 
     throw MyProjectException.getInstance("lookup of " + what + " failed.", ex); 
    } 
} 

public ConnectionFactory getJMSConnectionFactory() throws JMSException { 
    return (ConnectionFactory)lookup("java:comp/DefaultJMSConnectionFactory"); 
} 

我也查找目的地,然後發送JMS消息。現在的作品,當我部署到單個域不如預期,但是當我嘗試這樣做,在集羣的設置,我得到這個例外(下面的相關詳細信息):

javax.ejb.EJBException 
Caused by: myclasspath.MyProjectException: sayHelloyOverJMS 
Caused by: myclasspath.MyProjectException: lookup of java:comp/DefaultJMSConnectionFactory failed. 
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/DefaultJMSConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Lookup failed for 'jms/__defaultConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}]]] 
Caused by: javax.naming.NamingException: Lookup failed for 'jms/__defaultConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}]] 
Caused by: javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}] 
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} 
Caused by: javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: jms] 
Caused by: javax.naming.NameNotFoundException: jms 

我認爲相關的細節是:

Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool'. 

似乎找到'__SYSTEM/pools',但不是'jms'。我確實看過Glassfish的GUI來配置連接池 jms/__defaultConnectionFactory-Connection-Pool,但我沒有在那裏找到任何有關'目標'的信息,所以我認爲它應該可用於整個域,包括集羣。羣集配置的資源選項卡沒有列出連接池(或任何其他'__SYSTEM'條目)。

當我問的GlassFish什麼JNDI資源:

$ asadmin list-jms-resources cluster_name 
jms/DataFlowClusterCommunicationTopic 
jms/__defaultConnectionFactory 
Command list-jms-resources executed successfully. 

$ asadmin list-jms-resources domain-1-instance 
remote failure: The list-jms-resources command is not allowed on target domain-1-instance because it is part of cluster cluster_name 
Command list-jms-resources failed. 

$ asadmin list-jms-resources domain 
jms/DataFlowClusterCommunicationTopic 
jms/__defaultConnectionFactory 
Command list-jms-resources executed successfully. 

所以,據我的理解,jms/__defaultConnectionFactory名存在,且應在羣集設置不亞於域設置中找到。

環境:

  • AS:GlassFish應用服務器版本4.1.1(建設1)
  • 的Java:

    • OpenJDK的版本 「1.8.0_111」
    • 的OpenJDK運行環境(build 1.8.0_111-8u111-b14-2-b14)
    • OpenJDK 64位服務器虛擬機(版本25.111-b14,混合模式)
  • 操作系統:Linux富克斯-Linux的PC 4.7.0-1-AMD64#1 SMP的Debian 4.7.8-1(2016年10月19日)x86_64的GNU/Linux的

  • 與行家3構建
+1

你在這個問題上有什麼進展嗎?,我有同一個 – karelss

+0

@karelss不幸的是,現在我不再有自己的問題了(我不再在這個項目上了)。我們有機會切換到不同的AS並做到了。它在那裏工作,但那種等待發生的模糊感問題依然存在。 –

+0

@karelss如果你贊成這個問題,它會被推到FrontPage中。如果您選擇提出新問題,請留下鏈接,以便最終可以重複關閉。 –

回答

1

我發現這篇文章,因爲我遇到與glassfish版本4.0和4.1.1相同的問題,當我試圖將我的項目從獨立安裝到羣集設置。

在做了一些測試之後,我能夠發現glassfish團隊接受的幾個問題,只有在集羣模式下,我才能測試,從嵌入式openmq設置更改爲remote或本地FIX問題,並且系統在集羣中運行良好。

這種行爲讓我覺得這個問題與嵌入式openMQ設置的JNDI樹有關