rxue / dictionary

Practice in Java EE
1 stars 0 forks source link

sub-task of #30 : add a queue for data export task #31

Closed rxue closed 1 year ago

rxue commented 2 years ago

Now that standalone-full.xml is copied from local to the Docker container

=>

TODO: add the queue in standalone-full.xml

rxue commented 2 years ago

Now that DataExportQueue is added to the standalone-full.xml, TODO: a user with guest role is needed to send messages:

Learning reference: https://github.com/rxue/learning-diary/tree/master/programming/java/ee/server/Wildfly/jms_configuration

rxue commented 2 years ago

the added user works with the test, but encountered the following error:

javax.naming.NameNotFoundException: jms/queue -- service jboss.naming.context.java.jboss.exported.jms.queue
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
    at org.wildfly.naming.client.remote.RemoteServerTransport.handleLookup(RemoteServerTransport.java:203)
    at org.wildfly.naming.client.remote.RemoteServerTransport$1.handleMessage(RemoteServerTransport.java:123)
    at org.jboss.remoting3.remote.RemoteConnectionChannel.lambda$handleMessageData$3(RemoteConnectionChannel.java:432)
    at org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:991)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
    at java.lang.Thread.run(Thread.java:834)

=> TODO: make the DataExportQueue queue visible

rxue commented 2 years ago

The client side calling with http-remoting://localhost:8081 encounters the following error:

08:56:35.985 [main] ERROR org.apache.activemq.artemis.core.client - AMQ214016: Failed to create netty connection
java.net.UnknownHostException: b2f3fd82791e
    at java.net.InetAddress.getAllByName0(InetAddress.java:1281) ~[?:1.8.0_312]
    at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[?:1.8.0_312]
    at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[?:1.8.0_312]
    at java.net.InetAddress.getByName(InetAddress.java:1077) ~[?:1.8.0_312]
    at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:156) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:153) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_312]
    at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:153) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:41) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:61) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:53) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:55) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:31) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:106) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:206) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:180) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:166) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:552) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:605) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:1012) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:516) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:387) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-all-4.1.65.Final.jar:4.1.65.Final]
    at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) ~[artemis-commons-2.16.0.jar:2.16.0]
08:56:35.989 [main] DEBUG org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl - Connector towards NettyConnector [host=b2f3fd82791e, port=8081, httpEnabled=false, httpUpgradeEnabled=true, useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true, activemqServerName=default, httpUpgradeEndpoint=http-acceptor] failed
08:56:35.991 [main] DEBUG org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl - Backup is not active, trying original connection configuration now.
Exception in thread "main" javax.jms.JMSRuntimeException: Failed to create session factory
    at org.apache.activemq.artemis.jms.client.JmsExceptionUtils.convertToRuntimeException(JmsExceptionUtils.java:88)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContext(ActiveMQConnectionFactory.java:326)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContext(ActiveMQConnectionFactory.java:309)
    at rx.practice.advanced.javax.naming.InitialContextLookupMDBDemo.main(InitialContextLookupMDBDemo.java:27)
Caused by: javax.jms.JMSException: Failed to create session factory
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:886)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContext(ActiveMQConnectionFactory.java:321)
    ... 2 more
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
    at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:703)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:884)
    ... 3 more
rxue commented 2 years ago

TODO: assign a static IP address to the Wildfly Docker container and bind this address by assigning the -b argument, i.e. jboss.bind.address