0

JBOSS 5.1 で hello world MDB を起動して、メッセージング アプリケーションを JBOSS 5.1 Messaging に取り込む方法を確認しようとしています。シンプルな hellow world MDB で有線の問題が発生します。MDB は正常にデプロイされ、JBOSS 5.1 AS の起動に問題はありませんでした。ただし、JBOSS 51 も実行しているクライアントからメッセージを送信しようとすると、次の例外がスローされます。

09:03:24,790 ERROR [STDERR] java.lang.NullPointerException
09:03:24,790 ERROR [STDERR]     at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:87)
09:03:24,790 ERROR [STDERR]     at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
09:03:24,791 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:269)
09:03:24,791 ERROR [STDERR]     at org.jboss.jms.client.JBossConnection.createQueueSession(JBossConnection.java:165)

ただし、スタンドアロンの Java プログラムから接続しようとすると、メッセージングは​​正常に機能します。私は今何をすべきか見当もつきません。構成は次のとおりです。

ejb-jar.xml:

<message-driven>
      <ejb-name>HelloWorldMDB</ejb-name>
      <ejb-class>com.yodlee.messaging.mdbs.HelloWorldMDB</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-driven-destination>
        <destination-type>javax.jms.Queue</destination-type>
        <subscription-durability>Durable</subscription-durability></message-driven-destination>
      <resource-ref>
        <res-ref-name>HelloWorldMDB</res-ref-name>
        <res-type>javax.jms.QueueConnectionFactory</res-type>
        <res-auth>Container</res-auth></resource-ref> 
</message-driven>

jboss.xml:

<message-driven>
                <ejb-name>HelloWorldMDB</ejb-name>
                <destination-jndi-name>queue/HelloWorldQueue</destination-jndi-name>
                <mdb-user>mqm</mdb-user>
                <mdb-passwd>mqm</mdb-passwd>
                <resource-ref>
                        <res-ref-name>HelloWorldMDB</res-ref-name>
                        <jndi-name>MDBDLQCF</jndi-name>
                </resource-ref>
</message-driven>

私が servelt とスタンドアロン プログラムで使用するクライアント コードは、以下のようにまったく同じです。

Properties env = new Properties();

        String queueName = "queue/HelloWorldQueue";
        String CFname = "ConnectionFactory";

        env.put(Context.PROVIDER_URL, "jnp://....:1099");
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
        env
                .put(Context.URL_PKG_PREFIXES,
                        "org.jboss.naming:org.jnp.interfaces");

        try {
            InitialContext ctx = new InitialContext(env);

            System.out.println("Looking up for queue");
            System.out.println(ctx.lookup(queueName).getClass().getName());
            Queue destination = (Queue) ctx.lookup(queueName);

            System.out.println(destination.getQueueName());

            System.out.println("Looking up for connection factory");
            System.out.println(ctx.lookup(CFname).getClass().getName());
            QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup(CFname);

            System.out.println("getting connection");
            QueueConnection conn = qcf.createQueueConnection("abc", "abc");
            System.out.println("creating session");
            QueueSession queueSession = conn.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);


            QueueSender sender = queueSession.createSender(destination);

            TextMessage message = queueSession.createTextMessage();

            message.setText("Test Message");

            System.out.println("Sending Message...");

            sender.send(message);
            System.out.println("Finished Sending Message.");

            sender.close();
            conn.close();
            queueSession.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
        }

この問題を解決するのを手伝ってくれませんか? デバッグするために他に必要な情報はありますか?

4

1 に答える 1

0

これをサーブレットから呼び出していますか? その場合:
WEB-INF/lib フォルダーに間違った jar があります。
必要な5.0の場合...javassist.jarとjboss-aop-jdk50.jarをWEB-INF/libフォルダーに入れて機能させます

別のメモ: コードでは、逆の取得順序でリソースを閉じ、finally ブロックでも実行します。

于 2010-07-15T16:49:08.490 に答える