2017-06-22 1 views
2

のJMSメニューが見つからない現在、私はWildfly 10で動作するJMSサンプルアプリケーションを作成していますが、サブシステムでJMSキューを作成できるメニューは表示されませんWildfly 10の管理コンソールの[管理]コンソールで、JMSメニューを探すのを手伝ってください。Wildfly 10でJMSを設定する方法

私は上記の事をしましたが、wildfly 10 server.Belowを開始しながら、私はいくつかの例外を持っては例外です:

Failed to process phase INSTALL of subdeployment "JMS1-war.war" of deployment "dfc.ear" 
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0092: No message destination with name JMS1-ejb.jar#jms/testingQ for binding java:module/env/jms/testingQ"}, 
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [ 
     "jboss.deployment.unit."dfc.ear".deploymentCompleteService is missing [jboss.deployment.subunit."dfc.ear"."JMS1-ejb.jar".deploymentCompleteService, jboss.deployment.subunit."dfc.ear"."JMS1-war.war".deploymentCompleteService]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.HandleDelegate is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.ValidatorFactory is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.InstanceName is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]", 
     "jboss.deployment.subunit."dfc.ear"."JMS1-ejb.jar".INSTALL is missing [jboss.deployment.subunit."dfc.ear"."JMS1-war.war".deploymentCompleteService]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.InAppClientContainer is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.ORB is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]", 
     "jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean.Validator is missing [jboss.naming.context.java.comp.dfc.JMS1-ejb.MDBBean]" 

マイwildflyスタンドアロン-full.xmlconfigurationは以下の通りです:

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0"> 
      <server name="default"> 
       <security-setting name="#"> 
        <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/> 
       </security-setting> 
       <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/> 
       <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/> 
       <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput"> 
        <param name="batch-delay" value="50"/> 
       </http-connector> 
       <in-vm-connector name="in-vm" server-id="0"/> 
       <http-acceptor name="http-acceptor" http-listener="default"/> 
       <http-acceptor name="http-acceptor-throughput" http-listener="default"> 
        <param name="batch-delay" value="50"/> 
        <param name="direct-deliver" value="false"/> 
       </http-acceptor> 
       <in-vm-acceptor name="in-vm" server-id="0"/> 
       <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/> 
       <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/> 
       <jms-queue name="testingQ"> 
       <entry name="jms/testingQ"/> 
       <entry name="java:jboss/exported/jms/testingQ"/> 
       </jms-queue> 
       <connection-factory name="InVmConnectionFactory" connectors="in-vm" entries="java:/ConnectionFactory"/> 
       <connection-factory name="RemoteConnectionFactory" connectors="http-connector" entries="java:jboss/exported/jms/RemoteConnectionFactory"/> 
       <connection-factory name="testingQFactory" connectors="http-connector" entries="java:jboss/exported/jms/testingQFactory"/> 
       <pooled-connection-factory name="activemq-ra" transaction="xa" connectors="in-vm" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"/> 
      </server> 
     </subsystem> 

メッセージを生成して使用するサーブレットコードは次のとおりです。

private Message createJMSMessageForjmsTestingQ(Session session, Object 
messageData) throws JMSException { 
// TODO create and populate message to send 
    TextMessage tm = session.createTextMessage(); 
    tm.setText(messageData.toString()); 
    return tm; 
} 


private void sendJMSMessageToTestingQ(Object messageData) throws 
NamingException, JMSException { 
    Context c = new InitialContext(); 
    ConnectionFactory cf = (ConnectionFactory) 
c.lookup("java:comp/env/jms/testingQFactory"); 
    Connection conn = null; 
    Session s = null; 
    try { 
     conn = cf.createConnection(); 
     s = conn.createSession(false, s.AUTO_ACKNOWLEDGE); 
     Destination destination = (Destination) 
c.lookup("java:comp/env/jms/testingQ"); 
     MessageProducer mp = s.createProducer(destination); 
     mp.send(createJMSMessageForjmsTestingQ(s, messageData)); 
    } finally { 
     if (s != null) { 
      try { 
       s.close(); 
      } catch (JMSException e) { 
       Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Cannot close 
session", e); 
      } 
     } 
     if (conn != null) { 
      conn.close(); 
     } 
} 

}駆動型Bean

私のメッセージは以下に記載されて:

以下
/* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 

package dfc.jms; 

import javax.ejb.MessageDrivenBean; 
import javax.ejb.MessageDrivenContext; 
import javax.jms.Message; 
import javax.jms.MessageListener; 

/** 
* 
* @author croushan 
*/ 
public class MDBBean implements MessageDrivenBean, MessageListener { 

    private MessageDrivenContext context; 

    // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code."> 

    /** 
    * @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext) 
    */ 
    public void setMessageDrivenContext(MessageDrivenContext aContext) { 
     context = aContext; 
    } 

    /** 
    * See section 15.4.4 of the EJB 2.0 specification 
    * See section 15.7.3 of the EJB 2.1 specification 
    */ 
    public void ejbCreate() { 
     // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services) 
    } 

    /** 
    * @see javax.ejb.MessageDrivenBean#ejbRemove() 
    */ 
    public void ejbRemove() { 
     // TODO release any resource acquired in ejbCreate. 
     // The code here should handle the possibility of not getting invoked 
     // See section 15.7.3 of the EJB 2.1 specification 
    } 

    // </editor-fold> 

    public void onMessage(Message aMessage) { 
     System.out.println("Message is :"+aMessage.toString()); 
    } 

    } 

は、ejb-jar.xmlのコードです:

<?xml version="1.0" encoding="UTF-8"?> 
<ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> 
    <enterprise-beans> 
     <message-driven> 
      <display-name>MDBBeanMDB</display-name> 
      <ejb-name>MDBBean</ejb-name> 
      <ejb-class>dfc.jms.MDBBean</ejb-class> 
      <transaction-type>Container</transaction-type> 
      <message-destination-type>javax.jms.Queue</message-destination-type> 
      <message-destination-link>jms/testingQ</message-destination-link> 
      <activation-config> 
       <activation-config-property> 
        <activation-config-property-name>acknowledgeMode</activation-config-property-name> 
        <activation-config-property-value>Auto-acknowledge</activation-config-property-value> 
       </activation-config-property> 
       <activation-config-property> 
        <activation-config-property-name>destinationType</activation-config-property-name> 
        <activation-config-property-value>javax.jms.Queue</activation-config-property-value> 
       </activation-config-property> 
      </activation-config> 
     </message-driven> 
     </enterprise-beans> 
    <assembly-descriptor> 
     <container-transaction> 
      <method> 
       <ejb-name>MDBBean</ejb-name> 
       <method-name>*</method-name> 
      </method> 
      <trans-attribute>Required</trans-attribute> 
     </container-transaction> 
     <message-destination> 
      <display-name>Destination for MDBBeanMDB</display-name> 
      <message-destination-name>jms/testingQ</message-destination-name> 
     </message-destination> 
     </assembly-descriptor> 
    </ejb-jar> 

おかげで、メッセージが含まれていません チャンダン

+0

'standalone-full.xml'でサーバを起動しますか?あなたは 'standalone.sh -c standalone-full.xml'を使いますか?サーブレットはメッセージを消費しませんが、スタックトレースからはMDBが 'MDBBean'と呼ばれるようです。それはどのように見えるのですか? standalone.xml 'java:jboss/exported/jms/testingQFactory'で指定したエントリを使う代わりに' java:comp/env/jms/testingQFactory'を使って接続ファクトリを探しているのはなぜですか?キューと同じです。これは、java:/ jms/queue/testingQ'のjmsエントリ名を持つ必要があります – yntelectual

+0

@yntelectualへの返信ありがとうございます。はい、私はstandalone.sh -c standalone-full.xmlを使用します。 –

+0

私はメッセージドリブンBeanとしてMDBBeanを持っています。質問にコードを含めました。 –

答えて

3

wildfly 10のデフォルトのスタンドアロンプ​​ロファイル。standalone-fullまたはstandalone-full-haのいずれかのプロファイルに切り替えるか、またはその対応を手動で有効にすることができますスポンディングサブシステムmessaging-activemq。 、ドメインモードでは

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0"> 
    <server name="default"> 
     <security-setting name="#"> 
      <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/> 
     </security-setting> 
     <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/> 
     <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/> 
     <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput"> 
      <param name="batch-delay" value="50"/> 
     </http-connector> 
     <in-vm-connector name="in-vm" server-id="0"/> 
     <http-acceptor name="http-acceptor" http-listener="default"/> 
     <http-acceptor name="http-acceptor-throughput" http-listener="default"> 
      <param name="batch-delay" value="50"/> 
      <param name="direct-deliver" value="false"/> 
     </http-acceptor> 
     <in-vm-acceptor name="in-vm" server-id="0"/> 
     <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/> 
     <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/> 
     <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/> 
     <connection-factory name="RemoteConnectionFactory" connectors="http-connector" entries="java:jboss/exported/jms/RemoteConnectionFactory"/> 
     <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/> 
    </server> 
</subsystem> 

fullfull-haは、メッセージング、デフォルトで有効になっているプロファイル:

<extension module="org.wildfly.extension.messaging-activemq"/>

、その後、サブモジュールの設定を:そのためにあなたは拡張子を追加する必要があります。

+0

私は自分のコードを含めて私の質問を編集しています。私は取得しています。それを調べて助けてください。 –

関連する問題