gpt4 book ai didi

java - JMS + Wildfly 8.2.0 最终版 : The following keys are invalid for configuring a connector: http-upgrade-endpoint

转载 作者:太空宇宙 更新时间:2023-11-04 14:11:27 31 4
gpt4 key购买 nike

我正在尝试在 Wildfly 8.2.0 上使用 JMS。我使用默认的远程连接工厂创建了一个名为 GrinderRemoteQueue 的队列,其 jndi 名称为 java:jboss/exported/jms/queue/grinderRemote。下面是用于 jms 配置的standalone-full.xml 配置文件部分。

<subsystem xmlns="urn:jboss:domain:messaging:2.0">
<hornetq-server>
<journal-file-size>102400</journal-file-size>

<connectors>
<http-connector name="http-connector" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor"/>
</http-connector>
<http-connector name="http-connector-throughput" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
<param key="batch-delay" value="50"/>
<param key="host" value="127.0.0.1"/>
<param key="port" value="5445"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>

<acceptors>
<http-acceptor http-listener="default" name="http-acceptor"/>
<http-acceptor http-listener="default" name="http-acceptor-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
<param key="host" value="127.0.0.1"/>
<param key="port" value="5445"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>

<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>

<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<max-size-bytes>10485760</max-size-bytes>
<page-size-bytes>2097152</page-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>

<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="http-connector"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
<entry name="java:jboss/DefaultJMSConnectionFactory"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>

<jms-destinations>
<jms-queue name="ExpiryQueue">
<entry name="java:/jms/queue/ExpiryQueue"/>
</jms-queue>
<jms-queue name="DLQ">
<entry name="java:/jms/queue/DLQ"/>
</jms-queue>
<jms-queue name="GrinderRemoteQueue">
<entry name="java:jboss/exported/jms/queue/grinderRemote"/>
<durable>true</durable>
</jms-queue>
</jms-destinations>
</hornetq-server>
</subsystem>

为了测试此配置,我使用以下类在 Eclipse Luna 中创建了一个新的动态 Web 项目:

import java.util.Properties;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;


import org.hornetq.jms.client.HornetQConnectionFactory;


public class TestJMS {




public void Test() throws NamingException, JMSException {


HornetQConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
MessageProducer producer = null;
MessageConsumer consumer = null;
Destination destination = null;
TextMessage message = null;
Context context = null;


try {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
env.put(Context.SECURITY_PRINCIPAL, "jmsuser");
env.put(Context.SECURITY_CREDENTIALS, "*********");
context = new InitialContext(env);


connectionFactory = (HornetQConnectionFactory) context.lookup("jms/RemoteConnectionFactory");


System.out.println("lookup: jms/GrinderRemoteConnectionFactory success!");


destination = (Destination) context.lookup("jms/queue/grinderRemote");


System.out.println("lookup: java:/jms/queue/grinderRemote success!");


JMSContext createContext = connectionFactory.createContext("jmsuser", "Logitech550!", JMSContext.AUTO_ACKNOWLEDGE);


System.out.println("connectionFactory.createContext success!");


createContext.createConsumer(destination);


System.out.println("createContext.createConsumer success!");


connection = connectionFactory.createConnection("jmsuser", "your password");


System.out.println("connectionFactory.createConnection success!");


session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
producer = session.createProducer(destination);


System.out.println("session.createProducer success!");


connection.start();


int count = Integer.parseInt("1");
String content = "Hello, World!";


// Send the specified number of messages
for (int i = 0; i < count; i++) {
message = session.createTextMessage(content);
producer.send(message);


System.out.println("Message sent successfully: " + message);
}


} catch (Exception e) {


e.printStackTrace();


} finally {
if (context != null) {
context.close();
}


// closing the connection takes care of the session, producer, and consumer
if (connection != null) {
connection.close();
}
}

}


}

运行这个类我得到了这个输出:

18:23:50,323 INFO  [stdout] (default task-2) lookup: jms/GrinderRemoteConnectionFactory success!
18:23:50,341 INFO [stdout] (default task-2) lookup: java:/jms/queue/grinderRemote success!
18:23:50,374 ERROR [stderr] (default task-2) javax.jms.JMSRuntimeException: Failed to create session factory
18:23:50,374 ERROR [stderr] (default task-2) at org.hornetq.jms.client.JmsExceptionUtils.convertToRuntimeException(JmsExceptionUtils.java:86)
18:23:50,375 ERROR [stderr] (default task-2) at org.hornetq.jms.client.HornetQConnectionFactory.createContext(HornetQConnectionFactory.java:152)
18:23:50,375 ERROR [stderr] (default task-2) at it.vr.pms.TestJMS.Test(TestJMS.java:62)
18:23:50,375 ERROR [stderr] (default task-2) at it.vr.pms.Base.doGet(Base.java:81)
18:23:50,375 ERROR [stderr] (default task-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
18:23:50,376 ERROR [stderr] (default task-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
18:23:50,376 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
18:23:50,376 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
18:23:50,376 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
18:23:50,377 ERROR [stderr] (default task-2) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
18:23:50,377 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
18:23:50,377 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
18:23:50,378 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
18:23:50,378 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
18:23:50,378 ERROR [stderr] (default task-2) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
18:23:50,379 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
18:23:50,379 ERROR [stderr] (default task-2) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
18:23:50,379 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
18:23:50,379 ERROR [stderr] (default task-2) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
18:23:50,380 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
18:23:50,380 ERROR [stderr] (default task-2) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
18:23:50,380 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
18:23:50,381 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
18:23:50,381 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
18:23:50,381 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
18:23:50,381 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
18:23:50,382 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
18:23:50,382 ERROR [stderr] (default task-2) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
18:23:50,382 ERROR [stderr] (default task-2) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
18:23:50,382 ERROR [stderr] (default task-2) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
18:23:50,383 ERROR [stderr] (default task-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
18:23:50,383 ERROR [stderr] (default task-2) at java.lang.Thread.run(Unknown Source)
18:23:50,383 ERROR [stderr] (default task-2) Caused by: javax.jms.JMSException: Failed to create session factory
18:23:50,384 ERROR [stderr] (default task-2) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:676)
18:23:50,384 ERROR [stderr] (default task-2) at org.hornetq.jms.client.HornetQConnectionFactory.createContext(HornetQConnectionFactory.java:142)
18:23:50,384 ERROR [stderr] (default task-2) ... 30 more
18:23:50,385 ERROR [stderr] (default task-2) Caused by: java.lang.IllegalStateException: The following keys are invalid for configuring a connector: http-upgrade-endpoint
18:23:50,385 ERROR [stderr] (default task-2) at org.hornetq.core.client.impl.ClientSessionFactoryImpl.checkTransportKeys(ClientSessionFactoryImpl.java:1507)
18:23:50,385 ERROR [stderr] (default task-2) at org.hornetq.core.client.impl.ClientSessionFactoryImpl.<init>(ClientSessionFactoryImpl.java:207)
18:23:50,385 ERROR [stderr] (default task-2) at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:867)
18:23:50,386 ERROR [stderr] (default task-2) at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:672)

我认为主要问题是java.lang.IllegalStateException:以下键对于配置连接器无效:http-upgrade-endpoint,但我不明白我错在哪里。

提前感谢您的回复。

恩里科

最佳答案

更新客户端上的所有库以使用 Wildfly 库,但不使用 jbossAS'-大黄蜂(模块)-jboss-client(位于 bin/client 目录)-远程处理(模块)-etc(模块)

关于java - JMS + Wildfly 8.2.0 最终版 : The following keys are invalid for configuring a connector: http-upgrade-endpoint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28273960/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com