WebSocket with Spring 4.0 with MessageBroker and WebServers - spring

I've downloaded the latest version of the websocket with spring example from
https://github.com/rstoyanchev/spring-websocket-portfolio.
I'm running the application on Tomcat 8.0 RC5 and using the message broker RabbitMQ 3.1.5.
The simulation runs only 2-3 times after that the simulation doesn't work anymore, due to the below error. I tried also toi run the application on Glassfish 4.0, but the same error occurs. Can you please help what could be the reason?
15:47:35 [BrokerWebSocketChannel-1] ExceptionWebSocketHandlerDecorator - Unhandl
ed error for ExceptionWebSocketHandlerDecorator [delegate=LoggingWebSocketHandle
rDecorator [delegate=org.springframework.messaging.handler.websocket.SubProtocol
WebSocketHandler#1d2bde4]]
java.lang.IllegalStateException: The WebSocket session has been closed and no me
thod (apart from close()) may be called on a closed session
at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:642)
at org.apache.tomcat.websocket.WsSession.getNegotiatedSubprotocol(WsSess
ion.java:297)
at org.springframework.web.socket.adapter.StandardWebSocketSession.getAc
ceptedProtocol(StandardWebSocketSession.java:113)
at org.springframework.web.socket.sockjs.transport.session.WebSocketServ
erSockJsSession.getAcceptedProtocol(WebSocketServerSockJsSession.java:91)
at org.springframework.messaging.handler.websocket.SubProtocolWebSocketH
andler.findProtocolHandler(SubProtocolWebSocketHandler.java:149)
at org.springframework.messaging.handler.websocket.SubProtocolWebSocketH
andler.afterConnectionClosed(SubProtocolWebSocketHandler.java:224)
at org.springframework.web.socket.support.WebSocketHandlerDecorator.afte
rConnectionClosed(WebSocketHandlerDecorator.java:69)
at org.springframework.web.socket.support.LoggingWebSocketHandlerDecorat
or.afterConnectionClosed(LoggingWebSocketHandlerDecorator.java:74)
at org.springframework.web.socket.support.ExceptionWebSocketHandlerDecor
ator.afterConnectionClosed(ExceptionWebSocketHandlerDecorator.java:89)
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJ
sSession.close(AbstractSockJsSession.java:237)
at org.springframework.messaging.simp.stomp.StompProtocolHandler.handleM
essageToClient(StompProtocolHandler.java:183)
at org.springframework.messaging.handler.websocket.SubProtocolWebSocketH
andler.handleMessage(SubProtocolWebSocketHandler.java:194)
at org.springframework.messaging.support.channel.ExecutorSubscribableCha
nnel$1.run(ExecutorSubscribableChannel.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:724)

Related

Zookeeper : java.lang.ClassNotFoundException: org.apache.zookeeper.admin.ZooKeeperAdmin after updating spring boot

I am trying to update an springboot application which uses org.apache.zookeeper.zookeeper.
After updating the spring boot version. I am getting one of the two errors given below depending upon the version used.
Error 1 - (For new version provided below)
Caused by: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /service/**/test/**/************
at org.apache.zookeeper.KeeperException.create(KeeperException.java:106)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1836)
at org.apache.curator.framework.imps.CreateBuilderImpl$16.call(CreateBuilderImpl.java:1131)
at org.apache.curator.framework.imps.CreateBuilderImpl$16.call(CreateBuilderImpl.java:1113)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:93)
at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1110)
at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:593)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:583)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:48)
at org.apache.curator.x.discovery.details.ServiceDiscoveryImpl.internalRegisterService(ServiceDiscoveryImpl.java:237)
at org.apache.curator.x.discovery.details.ServiceDiscoveryImpl.registerService(ServiceDiscoveryImpl.java:192)
at org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistry.register(ZookeeperServiceRegistry.java:71)
... 63 more
or
Error 2 - (For some other versions of zookeeper and curator provided in thread 1 provided below)
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.admin.ZooKeeperAdmin
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 109 more
Old versions: (Working good)
Java - 8
SpringBoot - 2.3.3.RELEASE
Zookeeper - 3.4.12
Curator - 4.0.1
New version: (Spring managed versions)
Java - 8
SpringBoot - 2.7.4
Zookeeper - 3.6.0
Curator - 5.1.0
Many threads mentions that the issue is because of incompatible zookeeper and curator versions.
There are some threads already available regarding the issue
Zookeeper : java.lang.ClassNotFoundException: org.apache.zookeeper.admin.ZooKeeperAdminI tried every solution provided in the this thread and also some other combinations but none seems to work. I tried to use the old version and updating the rest. This too didn't work.
Apache Curator Unimplemented Errors When Trying to Create zNodesI am not accessing the curator directly as provided in this thread and I believe the zookeeper internally uses curator.
Is there any other dependency I need to upgrade? or Do I need to upgrade the java?
Please mention if you need some more info.

Apache Nifi Web Server keeps failing to start with Decryption exception

I have a setup in which NiFi Web Server suddenly started failing to start when upgrading from 1.15.3 to 1.16.1 version. The following exception keeps occurring on the Apache NiFi Cluster:
2022-05-11 22:53:40,570 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
org.apache.nifi.encrypt.EncryptionException: Decryption Failed with Algorithm [PBEWITHMD5AND256BITAES-CBC-OPENSSL]
at org.apache.nifi.encrypt.CipherPropertyEncryptor.decrypt(CipherPropertyEncryptor.java:78)
at org.apache.nifi.fingerprint.FingerprintFactory.decrypt(FingerprintFactory.java:931)
at org.apache.nifi.fingerprint.FingerprintFactory.getLoggableRepresentationOfSensitiveValue(FingerprintFactory.java:561)
at org.apache.nifi.fingerprint.FingerprintFactory.addParameter(FingerprintFactory.java:330)
at org.apache.nifi.fingerprint.FingerprintFactory.addParameterContext(FingerprintFactory.java:302)
at org.apache.nifi.fingerprint.FingerprintFactory.addFlowControllerFingerprint(FingerprintFactory.java:210)
at org.apache.nifi.fingerprint.FingerprintFactory.createFingerprint(FingerprintFactory.java:153)
at org.apache.nifi.fingerprint.FingerprintFactory.createFingerprint(FingerprintFactory.java:127)
at org.apache.nifi.controller.inheritance.FlowFingerprintCheck.checkInheritability(FlowFingerprintCheck.java:45)
at org.apache.nifi.controller.XmlFlowSynchronizer.sync(XmlFlowSynchronizer.java:200)
at org.apache.nifi.controller.serialization.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:43)
at org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1524)
at org.apache.nifi.persistence.StandardFlowConfigurationDAO.load(StandardFlowConfigurationDAO.java:104)
at org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:815)
at org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:457)
at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:1086)
at org.apache.nifi.NiFi.<init>(NiFi.java:170)
at org.apache.nifi.NiFi.<init>(NiFi.java:82)
at org.apache.nifi.NiFi.main(NiFi.java:330)
Caused by: javax.crypto.BadPaddingException: pad block corrupted
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher$BufferedGenericBlockCipher.doFinal(Unknown Source)
at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(Cipher.java:2168)
at org.apache.nifi.encrypt.CipherPropertyEncryptor.decrypt(CipherPropertyEncryptor.java:74)
... 18 common frames omitted
relevant nifi.properties:
nifi.sensitive.props.key=<hidden>
nifi.sensitive.props.key.protected=
nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL
nifi.sensitive.props.additional.keys=
I have already tried to tear it all down and re-install 1.15.3 with not any other changes, but the same issue still persists. Can someone please share any ideas if there are any on how to fix this?

Consumer thread error, thread abort on SimpleMessageListenerContainer

I have a application that is running a few months but recently the application is throw a error during receipt message by mq.
When the error is throw the application don't consume more messages. Restarting the application the consume of message is running normaly.
Erro:
4644201:[2018-10-02 10:34:31,068] ERROR [SimpleAsyncTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1473) - Consumer thread error, thread abort.
4644418-java.lang.NoClassDefFoundError: org/springframework/classify/SubclassClassifier$ClassComparator
4644514- at org.springframework.classify.SubclassClassifier.classify(SubclassClassifier.java:115)
4644604- at org.springframework.classify.BinaryExceptionClassifier.classify(BinaryExceptionClassifier.java:104)
4644708- at org.springframework.retry.policy.SimpleRetryPolicy.retryForException(SimpleRetryPolicy.java:191)
4644809- at org.springframework.retry.policy.SimpleRetryPolicy.canRetry(SimpleRetryPolicy.java:143)
4644901- at org.springframework.retry.support.RetryTemplate.canRetry(RetryTemplate.java:357)
4644986- at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:291)
4645072- at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:172)
4645156- at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:98)
4645268- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
4645378- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
4645471- at com.sun.proxy.$Proxy89.invokeListener(Unknown Source)
4645529- at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1238)
4645662- at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:727)
4645799- at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1192)
4645937- at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1176)
4646073- at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1100(SimpleMessageListenerContainer.java:99)
4646201- at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1370)
4646354- at java.lang.Thread.run(Thread.java:748)
4646396-Caused by: java.lang.ClassNotFoundException: org.springframework.classify.SubclassClassifier$ClassComparator
You are missing spring-retry on the class path. What are you using for dependency management? It should be added to the classpath automatically when using Maven or Gradle since it's a transitive dependency of spring-amqp.
Restarting the application the consume of message is running normaly.
That makes no sense; unless you have some kind of weird classloader problem.
Try running with -verbose to get logs for all the class loading.

IBM Websphere MQ: Failed to connect queue manager and queue with 2009 error code

Error detail as following: (stacktrace)
Caused by: com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2009'.
at com.ibm.mq.MQDestination.open(MQDestination.java:310)
at com.ibm.mq.MQQueue.<init>(MQQueue.java:261)
at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:2751)
at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:2779)
at com.citi.sh.h2h.service.adapter.H2hMqSendReceiveAdapter.connect(H2hMqSendReceiveAdapter.java:79)
... 17 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009
at com.ibm.mq.jmqi.remote.internal.RemoteHconn.getConnection(RemoteHconn.java:884)
at com.ibm.mq.jmqi.remote.internal.RemoteHconn.getCmdLevel(RemoteHconn.java:2698)
at com.ibm.mq.MQDestination.open(MQDestination.java:302)
... 21 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9213: A communications error for 'TCP' occurred. [1=java.net.SocketException[Unrecognized Windows Sockets error: 0: recv failed],4=TCP,5=sockInStream.read]
at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1515)
at com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveBuffer(RemoteRcvThread.java:804)
at com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.receiveOneTSH(RemoteRcvThread.java:768)
at com.ibm.mq.jmqi.remote.internal.RemoteRcvThread.run(RemoteRcvThread.java:158)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 0: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at com.ibm.mq.jmqi.remote.internal.RemoteTCPConnection.receive(RemoteTCPConnection.java:1505)
... 4 more
In windows 2003 server, my application running as a service to connect MQ to execute message. Some process executed successfully, but some are failed. The above error occurred.
My Java application use JDK1.7 and MQ version is 7.0.1.11
Could you give me some solution to fix this issue? Thank your very much for your help!
IBM MQ v7.0 went out of support on September 30th 2015.
I would suggest that you move to a supported version of IBM MQ. I'm leaving 7.1 out of the list below since it will go out of support on April 30 2017. Note that 7.5 will go out of support on April 30 2018.
MQ 7.5 client
MQ 8.0 client
MQ 9.0 client
If you must continue to use a out of support version I did find some references to the cause of your problem being that the Windows server supports both a IPv4 and IPv6 stacks. The solution was to force the JRE to use IPv4 only by adding the following setting to your Java startup.
-Djava.net.preferIPv4Stack=true

log4j2 shutdownHook="disable" not working

I have the shutdownhook error in my Spring boot application in which i use log4j2.
I saw that it was a bug in log4j2 and shutdownHook="disable" was suppossed to resolve it. But inspite of using the same i still get the same error.
I am using spring boot version 1.3.7.RELEASE and the dependecy for log4j2 is
spring-boot-starter-log4j2 .
Error which i get whetry to close the session using Ctrl-C
2016-08-23 13:38:56,098 Thread-7 ERROR No log4j2 configuration file found. Using
default configuration: logging only errors to the console.
2016-08-23 13:38:56,105 Thread-7 FATAL Unable to register shutdown hook because
JVM is shutting down. java.lang.IllegalStateException: Cannot add new shutdown h
ook as this is not started. Current state: STOPPED
at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.ad
dShutdownCallback(DefaultShutdownCallbackRegistry.java:113)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.addShutdownCal
lback(Log4jContextFactory.java:271)
at org.apache.logging.log4j.core.LoggerContext.setUpShutdownHook(LoggerC
ontext.java:256)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:
216)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log
4jContextFactory.java:146)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log
4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:185)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(Abstrac
tLoggerAdapter.java:103)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFac
tory.java:43)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(Abstract
LoggerAdapter.java:42)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFact
ory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at com.worldline.frm.dataloader.policy.CustomQueueRoutePolicy.onStop(Cus
tomQueueRoutePolicy.java:90)
at org.apache.camel.impl.RouteService.doStop(RouteService.java:249)

Resources