2017-11-09 11 views
1

ActiveMQComponentをcamel cdiでorg.apache.activemq.pool.PooledConnectionFactorを使用して初期化しようとしています。 ActiveMQConnectionFactoryでは、正常に動作しています。CamelContextがPooledConnectionFactoryの初期化中にシャットダウンしています

ログをいくつか追加しましたが、PooledConnectionFactoryCamelContextがシャットダウンしているときに注意してください。それが構築および配備されているとき 私はJMSConfigurations等と多くの異なった方法を試みたが、まだ運がない。

この理由は何ですか?

エラーログ。

17:45:07,043 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-6) Apache Camel 2.19.3 (CamelContext: camel_cdi_context) is starting 
17:45:07,044 INFO [org.apache.camel.management.ManagedManagementStrategy] (MSC service thread 1-6) JMX is enabled 
17:45:07,064 INFO [org.wildfly.extension.camel] (MSC service thread 1-6) Camel context starting: camel_cdi_context 
17:45:07,064 INFO [org.wildfly.extension.camel] (MSC service thread 1-2) Bound camel naming object: java:jboss/camel/context/camel_cdi_context 
17:45:07,095 INFO [org.apache.camel.impl.DefaultRuntimeEndpointRegistry] (MSC service thread 1-6) Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000) 
17:45:07,131 INFO [stdout] (MSC service thread 1-6) Creating ActiveMQ Component 
17:45:07,131 INFO [stdout] (MSC service thread 1-6) createActiveMQComponent().connectionFactory : [email protected] 
17:45:07,131 INFO [stdout] (MSC service thread 1-6) createActiveMQComponent(). : mark-1 
17:45:07,135 INFO [org.apache.camel.impl.DefaultCamelContext] (MSC service thread 1-6) Apache Camel 2.19.3 (CamelContext: camel_cdi_context) is shutting down 
17:45:07,137 INFO [org.wildfly.extension.camel] (MSC service thread 1-6) Camel context stopped: camel_cdi_context 

私はさまざまな方法でmaximumConnections /タイムアウトのActiveMQConnectionFactoryと作業を進めることができます。 しかし、私は最高のことが好きです。

ActiveMQComponentProducer.java

@ApplicationScoped 
public class ActiveMQComponentProducer { 

    @Produces 
    @Named("activemqx") 
    public ActiveMQComponent createActiveMQComponent() { 

     System.out.println("Creating ActiveMQ Component"); 

     ActiveMQComponent activeMQComponent = ActiveMQComponent.activeMQComponent(); 
     String connectionString = "tcp://localhost:61616"; 

     ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionString); 
     System.out.println("createActiveMQComponent().connectionFactory : " + connectionFactory); 

     PooledConnectionFactory pooledConnectionFactory = null; 
     System.out.println("createActiveMQComponent(). : mark-1"); 

     try { 
      pooledConnectionFactory = new PooledConnectionFactory(connectionFactory); 
     } catch (Exception e) { 
      System.out.println("createActiveMQComponent(). : "+e); 
     } 
     System.out.println("createActiveMQComponent(). : mark-2"); 

     activeMQComponent.setConnectionFactory(pooledConnectionFactory); 
     return activeMQComponent; 
    } 

} 
  • キャメルバージョン:2.19
  • Wildflyバージョン:10.1.0
  • キャメルパッチバージョン:wildfly-ラクダパッチ4.9.0

答えて

1

クラスの読み込みの問題が発生している可能性があります。

WildFly-Camel 4.9.0リリースでは、PooledConnectionFactoryはデプロイメントクラスパスに自動的にエクスポートされません。この問題は、将来のリリースで固定されており、この問題によって追跡した回避策として

https://github.com/wildfly-extras/wildfly-camel/issues/2199

、あなたがjboss-deployment-structure.xmlディスクリプタ経由でデプロイメントにorg.apache.activemqためのモジュールの依存関係を追加することができます。 JARデプロイの場合はMETA-INF、WARデプロイの場合はWEB-INFに配置します。

<jboss-deployment-structure> 
    <deployment> 
     <dependencies> 
      <module name="org.apache.activemq" /> 
     </dependencies> 
    </deployment> 
</jboss-deployment-structure> 
+0

恐ろしい@ジェームス!今それはエラーなしで動作しています! – namalfernandolk

関連する問題