1

JBoss で JMS クライアントとプロデューサーを作成しようとしています。HornetQ 2.3.0.Final のスタンドアロン バージョンを起動して接続し、メッセージを送受信できます。ただし、戦争としてEclipse WTPを介してクライアントを実行しています(ただし、最終的には同じJBossインスタンスから実行する予定です)。現在、組み込みの JBoss7 を hornetq として使用しようとしていますが、問題が発生しています。standalone-full.xml を変更し、hornetq-server セクションに追加しました

 <security-enabled>false</security-enabled>`

そしてそれを実行します

 ./standalone.sh -b 0.0.0.0 -server-config=standalone-full.xml`

次に、(スタンドアロンの hornetq インスタンスに接続するコードを変更せずに) Web サービスを実行しようとしましたが、

 SEVERE: Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.listener.SimpleMessageListenerContainer#0' defined in ServletContext resource [/META-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hornetq.api.core.HornetQException.<init>(ILjava/lang/String;Ljava/lang/Throwable;)V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)

私のJBoss出力は次のようになります。

 =========================================================================

   JBoss Bootstrap Environment

   JBOSS_HOME: C:\codebase\jboss-as-7.1.1.Final

   JAVA: C:\Java\jdk1.6.0_43/bin/java

   JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml

 =========================================================================

 Listening for transport dt_socket at address: 4242
           15:29:08,505 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
 15:29:08,672 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
 15:29:08,713 INFO  [org.jboss.as] JBAS0     15899: JBoss AS 7.1.1.Final "Brontes" starting
 15:29:09,632 INFO  [org.xnio] XNIO Version 3.0.3.GA
 15:29:09,637 INFO  [org.jboss.as.server] JBAS0     15888: Creating http management service using socket-binding (management-http)
 15:29:09,646 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
 15:29:09,654 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
 15:29:09,693 INFO  [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem
 15:29:09,721 INFO  [org.jboss.as.connector.subsystems.datasources] JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
 15:29:09,735 INFO  [org.jboss.as.clustering.infinispan] JBAS010280: Activating Infinispan subsystem.
 15:29:09,771 INFO  [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
 15:29:09,785 INFO  [org.jboss.as.security] JBAS013101: Activating Security Subsystem
 15:29:09,789 INFO  [org.jboss.as.webservices] JBAS0     15537: Activating WebServices Extension
 15:29:09,811 INFO  [org.jboss.as.logging] JBAS01     1502: Removing bootstrap log handlers
 15:29:09,810 INFO  [org.jboss.as.connector] JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
 15:29:09,834 INFO  [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final
 15:29:09,860 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS0     15400: Bound mail session [java:jboss/mail/Default]
 15:29:09,874 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 38) JBAS016300: Activating JacORB Subsystem
 15:29:09,943 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 49) JBAS011940: Activating OSGi Subsystem
 15:29:10,073 INFO  [org.jboss.jaxr] (MSC service thread 1-5) JBAS014000: Started JAXR subsystem, binding JAXR connection factory into JNDI as: java:jboss/jaxr/ConnectionFactory
 15:29:10,075 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.2.GA
 15:29:10,378 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS0     15012: Started FileSystemDeploymentService for directory C:\codebase\jboss-as-7.1.1.Final\standalone\deployments
 15:29:10,482 WARN  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011600: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
 15:29:10,486 INFO  [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /0.0.0.0:4447
 15:29:10,492 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:9999
 15:29:10,512 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http-0.0.0.0-0.0.0.0-8080
 15:29:10,572 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingjournal,bindingsDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingbindings,largeMessagesDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messaginglargemessages,pagingDirectory=C:\codebase\jboss-as-7.1.1.Final\standalone\data\messagingpaging)
 15:29:10,577 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) Waiting to obtain live lock
 15:29:10,606 INFO  [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-2) Using NIO Journal
 15:29:10,672 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
 15:29:10,679 WARN  [jacorb.codeset] (MSC service thread 1-4) Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1
 15:29:10,682 INFO  [org.hornetq.core.server.impl.FileLockNodeManager] (MSC service thread 1-2) Waiting to obtain live lock
 15:29:10,683 INFO  [org.hornetq.core.server.impl.FileLockNodeManager] (MSC service thread 1-2) Live Server Obtained live lock
 15:29:10,712 INFO  [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016330: CORBA ORB Service started
 15:29:10,783 INFO  [org.jboss.as.jacorb] (MSC service thread 1-4) JBAS016328: CORBA Naming Service started
 15:29:11,635 INFO  [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-2) Deleting unreferenced message id=30064771066 from the journal
 15:29:11,705 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-2) Started Netty Acceptor version 3.2.5.Final-a96d88c 0.0.0.0:5455 for CORE protocol
 15:29:11,708 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-2) Started Netty Acceptor version 3.2.5.Final-a96d88c 0.0.0.0:5445 for CORE protocol
 15:29:11,717 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) Server is now live
 15:29:11,719 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) HornetQ Server version 2.2.13.Final (HQ_2_2_13_FINAL_AS7, 122) [337187b6-ed9e-11e2-a678-549304ffc20f]) started
 15:29:11,724 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.queue.DemoQueue
 15:29:11,754 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/DemoQueue
 15:29:11,756 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/queue/DemoQueue
 15:29:11,759 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.queue.testQueue
 15:29:11,767 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/queue/test
 15:29:11,771 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test
 15:29:11,789 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
 15:29:11,791 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
 15:29:11,793 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.topic.testTopic
 15:29:11,816 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/topic/test
 15:29:11,818 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test
 15:29:11,825 INFO  [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
 15:29:11,898 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010406: Registered connection factory java:/JmsXA
 15:29:11,910 INFO  [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-7) HornetQ resource adaptor started
 15:29:11,912 INFO  [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-7) IJ020002: Deployed: file://RaActivatorhornetq-ra
 15:29:11,917 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
 15:29:12,005 INFO  [org.jboss.as] (Controller Boot Thread) JBAS0     15951: Admin console listening on http://127.0.0.1:9990
 15:29:12,007 INFO  [org.jboss.as] (Controller Boot Thread) JBAS0     15874: JBoss AS 7.1.1.Final "Brontes" started in 3707ms - Started 170 of 249 services (78 services are passive or on-demand)
 15:29:53,048 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 2006673595, [id: 0x779b68bb, /0.0.0.0:5445])) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: null]
at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:147) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:807) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:187) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:85) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:508) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:556) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:517) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:533) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73) [hornetq-core-2.2.13.Final.jar:]
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline$StaticChannelHandlerContext.sendUpstream(StaticChannelPipeline.java:534) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287) [netty-3.2.6.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-2.2.13.Final.jar:]
at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-2.2.13.Final.jar:]
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:367) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) [netty-3.2.6.Final.jar:]
at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:100) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44) [netty-3.2.6.Final.jar:]
at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181) [netty-3.2.6.Final.jar:]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_43]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_43]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_43]`

私のクライアントapplication-context.xmlは次のようになります。

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"

xsi:schemaLocation="
    http://www.springframework.org/schema/beans     
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/cache
    http://www.springframework.org/schema/cache/spring-cache.xsd
    http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring
    http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">



<bean id="hornetConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
    <constructor-arg name="ha" value="false" />
    <constructor-arg>
        <bean class="org.hornetq.api.core.TransportConfiguration">
            <constructor-arg
                value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
            <constructor-arg>
                <map key-type="java.lang.String" value-type="java.lang.Object">
                    <!-- HornetQ standalone instance details -->
                    <entry key="host" value="127.0.0.1"></entry>
                    <entry key="port" value="5445"></entry>
                </map>
            </constructor-arg>
        </bean>
    </constructor-arg>
</bean>

<!-- ConnectionFactory Definition -->
<bean id="connectionFactory"
    class="org.springframework.jms.connection.CachingConnectionFactory">
    <constructor-arg ref="hornetConnectionFactory" />
</bean>

<!-- Definition of the JMS queue -->
<bean id="defaultDestination" class="org.hornetq.jms.client.HornetQQueue">
    <constructor-arg index="0" value="DemoQueue" />
</bean>

<bean id="producerTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="defaultDestination" ref="defaultDestination" />
</bean>


<bean class="com.example.Sender" id="messageSenderService"
    p:jmsTemplate-ref="producerTemplate"></bean>


<bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destination" ref="defaultDestination" />
    <property name="messageListener" ref="messageListener" />
</bean>

<bean id="taskExecutor"
    class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    <property name="corePoolSize" value="5" />
    <property name="maxPoolSize" value="10" />
    <property name="queueCapacity" value="25" />
</bean>


<bean class="com.example.Receiver" id="messageListener">
    <property name="taskExecutor" ref="taskExecutor" />
</bean>

そして最後に、私は持っています

    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <version>7.1.1.Final</version>
        <type>pom</type>
    </dependency>

私のポンで

私は何が欠けていますか?スタンドアロンの hornetq には接続できるのに、jboss に組み込まれたものには接続できないのはなぜですか? 依存関係/クラスパスの問題ですか? それとも、ユーザー/セキュリティの問題ですか?

4

2 に答える 2