我正在尝试建立JMS队列连接。
但我遇到错误的代码是
try {
context = initialContext.getInitialContext();
queueConnectionFactory = (QueueConnectionFactory) context.lookup("jms/TestQueueConnectionFactory");
queue = (Queue) context.lookup("queue/"+userName);
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
queueConnection.start();
queueSender = queueSession.createSender(queue);
TextMessage textMessage = queueSession.createTextMessage(userName+": "+enterTextText.getText());
queueSender.send(textMessage);
receiveTextText.insert("Me : "+enterTextText.getText()+"\n");
enterTextText.setText("");
enterTextText.setFocus();
queueSender.close();
} catch (JMSException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
我收到错误的行是 queueConnection = queueConnectionFactory.createQueueConnection();
connection-factories-service.xml将如下所示
<server>
<mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
name="jboss.messaging.connectionfactory:service=TestQueueConnectionFactory"
xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
<constructor>
<arg type="java.lang.String" value="TestQueueConnectionFactory"/>
</constructor>
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="PrefetchSize">150</attribute>
<attribute name="DupsOKBatchSize">5000</attribute>
<attribute name="SupportsFailover">false</attribute>
<attribute name="SupportsLoadBalancing">false</attribute>
<attribute name="SlowConsumers">false</attribute>
<attribute name="JNDIBindings">
<bindings>
<binding>jms/TestQueueConnectionFactory</binding>
</bindings>
</attribute>
</mbean>
</server>
我得到的例外是
java.lang.RuntimeException: Failed to download and/or install client side AOP stack
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:199)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:101)
at org.jboss.jms.client.JBossConnectionFactory.createQueueConnection(JBossConnectionFactory.java:95)
at com.techm.jms.ChatWindow.sendMessageToQueue(ChatWindow.java:425)
at com.techm.jms.ChatWindow$2.handleEvent(ChatWindow.java:184)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Decorations.closeWidget(Unknown Source)
at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.callWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.DefWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.callWindowProc(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at com.techm.jms.ChatWindow.open(ChatWindow.java:165)
at com.techm.jms.ChatWindow.main(ChatWindow.java:129)
Caused by: org.jboss.jms.exception.MessagingNetworkFailureException: Failed to connect client
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createClient(ClientConnectionFactoryDelegate.java:313)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:232)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
... 36 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:453)
at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:352)
at org.jboss.remoting.Client.connect(Client.java:512)
at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createClient(ClientConnectionFactoryDelegate.java:309)
... 40 more
Caused by: java.lang.NoSuchMethodError: org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(Ljava/lang/Object;Ljava/util/Properties;Z)V
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.mapJavaBeanProperties(MicroSocketClientInvoker.java:1280)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.setup(MicroSocketClientInvoker.java:496)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.<init>(MicroSocketClientInvoker.java:275)
at org.jboss.remoting.transport.socket.SocketClientInvoker.<init>(SocketClientInvoker.java:78)
at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.<init>(BisocketClientInvoker.java:164)
at org.jboss.remoting.transport.bisocket.TransportClientFactory.createClientInvoker(TransportClientFactory.java:44)
... 48 more
有人请让我知道,为什么我无法创建连接