Wildfly - "Netty connector not found in main configuration file"

Asked

Viewed 588 times

2

I added a connection factory to the file standalone-full of Wildfly.:

<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>

And I have the following code to use it:

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");

But I’m having problems. The Widfly You’re saying you can’t find the Nector Netty, and so cannot create the factory.

...
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

Someone knows how to fix this?

  • You have set up the Connection factor and the Connector (and maybe the acceptor also), configured as?

  • No, these are the only modifications I made to this file...?

  • I already include an answer for you.

1 answer

2


This error is due to the fact that you are referencing a non-existent Nector. By default there is no netty-connector configured, but others as http-connectors.

How are you using the standalone-full, I will consider that you already have the module/sub-system of messages enabled (org.jboss.as.messaging).

First we need to include a acceptor, which will be responsible for accepting the connections that will be made to the Hornetq server. For this, in the message subsystem (XML namespace urn:jboss:domain:messaging:2.0) locate the tag acceptors and include the following:

<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>

Then we have to include a connector, which will be responsible for the transport (how to connect) configurations of Hornetq. For this, also in the message subsystem (XML namespace urn:jboss:domain:messaging:2.0), locate the tag connectors and include the following:

<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
    <param key="batch-delay" value="50"/>
</netty-connector>

Finally you must configure the socket Binding. Search for the tag socket-binding-group and include the following in it:

<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>

Check the documentation of Jboss EAP (Note: there are differences in EAP settings for Wildfly/AS community, mainly regarding directories, but in general it is a good reference and is more detailed) and also the Wildfly for more details of the configuration and tunning of the messenger.

EDITION: including explanation of how to connect and do lookup of Factory configured

Considering the same configuration proposed in the reply and its connection-factory, the code below should work:

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");
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");

That’s why, looking more closely, remoting port no longer enabled in Wildfly (I just saw that there is, only in Jboss AS, now it is really necessary to use the protocol http-remoting at door 8080.

This is the log of the lookup (the code above):

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

And this is Wildfly’s log:

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

To run this example you will need in your classpath of the following libraries:

  • Thank you for the answer! After this procedure, however, I faced the following error: "Remote Connection failed: java.io.Ioexception: An established connection was cancelled by the software on the host computer". Any idea what it is?

  • @Mrguliarte already tried to use remote://localhost:4447 as Provider url?

  • I really appreciate your dedication! However, switching the port to 4447 led to the following error: "Exception in thread "main" javax.naming.Communicationexception: Failed to connect to any server. Servers tried: [http-remoting://localhost:4447/ (java.net.Connectexception: Connection refused: no further information)]" just when I try to start Connection Factory...

  • @Mrguliarte is not only changing the port, but also the protocol. Use remote://localhost:4447 in place of http-remoting://localhost:4447, tried this?

  • Forgive me for my inexperience! I made this change here, however, the same error I just commented appears!

  • @Mrguliarte see the response update, I tested it here and it’s OK, see the log.

  • It worked! (even without the libraries, but I added them anyway). Thank you so much for your help, I couldn’t find the answer anywhere!

  • 1

    @Mrguliarte ok, no problem. I saw that you asked on Soen too, then I reply there to be registered there too. Thank you =)

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.