- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在 Wildfly 的 standalone-full
文件中添加了一个连接工厂:
<jms-connection-factories>
<connection-factory name="K19Factory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="K19Factory"/>
<entry name="java:jboss/exported/jms/K19Factory"/>
</entries>
</connection-factory>
...
</jms-connection-factories>
我有以下代码来使用它:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jboss.naming.remote.client.InitialContextFactory");
props.setProperty("java.naming.provider.url", "http-remoting://127.0.0.1:8080/");
/*props.setProperty("java.naming.provider.url","remote://localhost:8080");*/
props.setProperty("java.naming.security.principal","k19");
props.setProperty("java.naming.security.credentials","1234");
InitialContext ic = new InitialContext(props);
// factory of JMS connections
ConnectionFactory factory = (ConnectionFactory)ic.lookup("jms/K19Factory");
但是我遇到了问题。 Widfly 说它找不到 Netty
连接器,因此它无法创建连接工厂。
...
17:07:02,316 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 62) JBAS011601: Bound messaging object to jndi name queue/pedidos
17:07:02,331 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 57) HQ221003: trying to deploy queue jms.topic.noticias
17:07:02,347 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 57) JBAS011601: Bound messaging object to jndi name topic/noticias
17:07:02,331 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 61) MSC000001: Failed to start service jboss.messaging.default.jms.connection-factory.K19Factory: org.jboss.msc.service.StartException in service jboss.messaging.default.jms.connection-factory.K19Factory: JBAS011639: Failed to create connection-factory
at org.jboss.as.messaging.jms.ConnectionFactoryService$1.run(ConnectionFactoryService.java:69) [wildfly-messaging-8.2.0.Final.jar:8.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
Caused by: HornetQIllegalStateException[errorType=ILLEGAL_STATE message=HQ129005: Connector 'netty' not found on the main configuration file]
at org.hornetq.jms.server.impl.JMSServerManagerImpl.internalCreateCFPOJO(JMSServerManagerImpl.java:1421) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.server.impl.JMSServerManagerImpl.internalCreateCF(JMSServerManagerImpl.java:1368) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.server.impl.JMSServerManagerImpl.access$1300(JMSServerManagerImpl.java:107) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.server.impl.JMSServerManagerImpl$5.runException(JMSServerManagerImpl.java:1215) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.server.impl.JMSServerManagerImpl.runAfterActive(JMSServerManagerImpl.java:1906) [hornetq-jms-server-2.4.5.Final.jar:]
at org.hornetq.jms.server.impl.JMSServerManagerImpl.createConnectionFactory(JMSServerManagerImpl.java:1201) [hornetq-jms-server-2.4.5.Final.jar:]
at org.jboss.as.messaging.jms.ConnectionFactoryService$1.run(ConnectionFactoryService.java:66) [wildfly-messaging-8.2.0.Final.jar:8.2.0.Final]
... 4 more
17:07:02,347 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 57) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/noticias
17:07:02,347 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 59) HQ221003: trying to deploy queue jms.queue.DLQ
17:07:02,347 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 59) JBAS011601: Bound messaging object to jndi name java:/jms/queue/DLQ
17:07:02,347 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221003: trying to deploy queue jms.queue.ExpiryQueue
17:07:02,347 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 60) JBAS011601: Bound messaging object to jndi name java:/jms/queue/ExpiryQueue
17:07:02,347 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 58) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
17:07:02,472 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-8) JBAS010406: Registered connection factory java:/JmsXA
17:07:02,488 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
17:07:02,545 INFO [org.hornetq.ra] (MSC service thread 1-8) HornetQ resource adaptor started
17:07:02,545 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-8) IJ020002: Deployed: file://RaActivatorhornetq-ra
17:07:02,545 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
17:07:02,545 INFO [org.jboss.as.messaging] (MSC service thread 1-5) JBAS011601: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory
17:07:02,545 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "messaging"),
("hornetq-server" => "default"),
("connection-factory" => "K19Factory")
]) - failure description: {"JBAS014671: Failed services" => {"jboss.messaging.default.jms.connection-factory.K19Factory" => "org.jboss.msc.service.StartException in service jboss.messaging.default.jms.connection-factory.K19Factory: JBAS011639: Failed to create connection-factory
Caused by: HornetQIllegalStateException[errorType=ILLEGAL_STATE message=HQ129005: Connector 'netty' not found on the main configuration file]"}}
17:07:02,623 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.messaging.default.jms.connection-factory.K19Factory: org.jboss.msc.service.StartException in service jboss.messaging.default.jms.connection-factory.K19Factory: JBAS011639: Failed to create connection-factory
有人可以帮助我吗?
最佳答案
此错误是由于您引用了一个不存在的连接器。默认情况下不存在netty-connector
,但其他如http-connector
。
因为您使用的是 standalone-full
,我会认为 org.jboss.as.messaging
模块已启用。
首先,我们必须包含一个acceptor
,负责接受将要与服务器建立的连接。为此,在消息子系统(XML 命名空间 urn:jboss:domain:messaging:2.0
)中找到 acceptors
标签并添加:
<netty-acceptor name="netty" socket-binding="messaging" />
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
在此之后,我们必须包含一个连接器
,负责服务器上的传输配置(如何连接)。为此,在消息传递子系统(XML 命名空间 urn:jboss:domain:messaging:2.0
)中找到 connectors
标签并添加:
<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
最后您必须配置套接字绑定(bind)。找到 socket-binding-group
标签并包含这个:
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
另请参阅 JBoss EAP 的文档(观察:Wildfly/AS 社区的 EAP 设置存在差异,尤其是目录,但总的来说这是一个很好的引用)和 Wildfly消息系统的更详细配置。
鉴于此设置和您的 connection-factory
,此代码应该有效:
final Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");
props.setProperty(Context.SECURITY_PRINCIPAL, "user"); // add an application user before
props.setProperty(Context.SECURITY_CREDENTIALS, "user1234");
final InitialContext ic = new InitialContext(props);
final ConnectionFactory factory = (ConnectionFactory) ic.lookup("jms/K19Factory");
System.out.println(factory != null ? "Factory is not null" : "Factory is null");
这是查找的日志(上面的来源):
Jun 02, 2015 7:18:13 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.0.Final
Jun 02, 2015 7:18:13 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.1.Final
Jun 02, 2015 7:18:13 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.0.Final
Factory is not null
这是 WildFly 中的日志:
19:18:13,731 INFO [org.jboss.as.naming] (default task-35) JBAS011806: Channel end notification received, closing channel Channel ID 24a74dfb (inbound) of Remoting connection 29a8f328 to /127.0.0.1:63595
要运行这个例子,你可能需要在你的类路径中有这些依赖:
jboss-remote-naming
hornetq-jms-client
xnio-nio
关于java - Wildfly - 在主配置文件中找不到 "Connector ' netty”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30551340/
我正在尝试在 Windows 上运行的小于 1GB 的 VM 上设置 YouTrack 和 TeamCity。使用率将非常低(用户和请求)。这是一个 POC 环境,如果它有效,我可能会将它推送到一个超
所以我在尝试使用 FORFILES 解决这个问题时遇到了麻烦。我正在尝试获取不超过 4 天的文件。所以基本上少于 4 天。然而,这似乎不太可能,因为/d -4 获取所有 4 天或更早的项目。 以下是我
如何从下面的 events 表中选择小于 15 分钟前创建的 events? CREATE TABLE events ( created_at timestamp NOT NULL DEFAU
Google Analytics Realtime提供 rt:minutesAgo ,可以过滤查询。 然而,它是一个维度而不是一个度量标准,<=不能在过滤器中使用。 假设我想在最后 n 分钟内获得一些
iOS 核心数据 - 严重的应用程序错误 - 尝试插入 nil 你好, 我的应用程序实际上运行稳定,但在极少数情况下它会崩溃并显示此错误消息... 2019-04-02 20:48:52.437172
我想制作一个 html div 以快速向右移动(例如不到 1 秒)并消失。然后1秒后再次直接出现在这个过程最开始div的位置。此过程将由单击按钮并重复 10 次触发。 我试图在 CSS 中使用过渡属性
我发现使用 TimeTrigger 是 Windows 10 (UWP) 上计划后台任务的方式。但是看起来我们需要给出的最小数字是 15 分钟。只是想知道,即使我们安排它在接下来的 1 分钟内运行,警
我必须在 1 秒内在屏幕上打印 2^20 行整数 printf 不够快,还有其他易于使用的快速输出替代方法吗? 每一行只包含 1 个整数。 我要求它用于竞争性编程问题,我必须将其源代码提交给法官。 最
我是一名优秀的程序员,十分优秀!