I see the following error during the login process while calling REST methods with JSON response. Please advise what would be causing this issue in simulator.
java.net.SocketException: Connection reset
[Network Thread] 0:5:5,328 - Exception during JSON parsing at row: 1 column: 32593 buffer: /9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
SxZN3Hpvl3GnzbbeF920jPJ4wfXrUlxrU1/rkc1k0djqWMROQCOevtWJceIrGzidmVWjYcKGz81MHiXSXtoWv1mJjOUAUjP4ivr5YqkqTUmjxsLRqc6bTPuL/g3Lik0n/gr5pNtqzLdam+4rMowB+
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:593)
at sun.security.ssl.InputRecord.read(InputRecord.java:532)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
fD+TxB46uLjwiftXlGxu2aCfy8ZyFNfL5txNh6MXFSVz6rLMkqStKorH0B/wQT/4JUfCn9vn9hm81zxNDdLf2utGISwBdxATOCTX20/8AwbcfAkhfk1LKjByE5/Svoz/gnD+wZ4f/AOCeP7PFn4F0GSSRVYT3MjEZklxgmvoDdk
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.MeteredStream.read(MeteredStream.java:134)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3393)
at com.codename1.io.BufferedInputStream.read1(BufferedInputStream.java:338)
at com.codename1.io.BufferedInputStream.read(BufferedInputStream.java:445)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at com.codename1.io.JSONParser$ReaderClass.read(JSONParser.java:124)
/Xn4dkY6DZbuW+zx5PvtFVhsT7VXPHz7JXl1VUpF0fLnnNAfJpucE0K2UrqPCJK/MH/g6wH/ABrus/bWV/8AQDX6eb8ivzD/AODrP/lHfY5bH/E5X8fkNZ1PgZ15ev8AaYep/OXpQVdN0/d/zwU1aYrJJ7ZrNspN2k2OG+byV/K
at com.codename1.io.JSONParser.parse(JSONParser.java:194)
Related
Apache camel stops consuming messages from events hubs after some time. It requires a restart to start receiving the messages again.
Is there any option to reestablish the connection in apache camel?
We are using the below apache camel dependency to send/receive event messages from event hubs.
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-azure-eventhubs-starter</artifactId>
<version>3.18.2</version>
</dependency>
Please find the stack trace here
ERROR c.a.c.a.i.ReactorSession.performLogging - {"az.sdk.message":"","exception":"Cannot create receive link from a closed session., errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A, PATH: checksservicedev/ConsumerGroups/opasconsumer/Partitions/10]","connectionId":"connection_id","sessionName":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/10","entityPath":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/10","linkName":"link_name"}
16-09-2022 06:24:40.929 [reactor-executor-4] ERROR c.a.c.a.i.ReactorSession.performLogging - {"az.sdk.message":"","exception":"Cannot create receive link from a closed session., errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A, PATH: checksservicedev/ConsumerGroups/opasconsumer/Partitions/5]","connectionId":"connection_id","sessionName":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/5","entityPath":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/5","linkName":"link_name"}
16-09-2022 06:24:41.112 [reactor-executor-3] ERROR c.a.c.a.i.ReactorSession.performLogging - {"az.sdk.message":"","exception":"Cannot create receive link from a closed session., errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A, PATH: checksservicedev/ConsumerGroups/opasconsumer/Partitions/13]","connectionId":"connection_id","sessionName":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/13","entityPath":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/13","linkName":"link_name"}
16-09-2022 06:24:42.473 [reactor-executor-5] ERROR c.a.c.a.i.ReactorSession.performLogging - {"az.sdk.message":"","exception":"Cannot create receive link from a closed session., errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A, PATH: checksservicedev/ConsumerGroups/opasconsumer/Partitions/29]","connectionId":"connection_id","sessionName":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/29","entityPath":"checksservicedev/ConsumerGroups/opasconsumer/Partitions/29","linkName":"link_name"}
16-09-2022 06:24:44.880 [reactor-executor-2] ERROR reactor.core.publisher.Operators.error - Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: com.azure.core.amqp.exception.AmqpException: connection aborted, errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A]
Caused by: com.azure.core.amqp.exception.AmqpException: connection aborted, errorContext[NAMESPACE: <event_hub_name>. ERROR CONTEXT: N/A]
at com.azure.core.amqp.implementation.ExceptionUtil.toException(ExceptionUtil.java:85)
at com.azure.core.amqp.implementation.handler.ConnectionHandler.notifyErrorContext(ConnectionHandler.java:332)
at com.azure.core.amqp.implementation.handler.ConnectionHandler.onTransportError(ConnectionHandler.java:235)
at org.apache.qpid.proton.engine.BaseHandler.handle(BaseHandler.java:191)
at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:108)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.dispatch(ReactorImpl.java:324)
at org.apache.qpid.proton.reactor.impl.ReactorImpl.process(ReactorImpl.java:291)
at com.azure.core.amqp.implementation.ReactorExecutor.run(ReactorExecutor.java:91)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
I try to encrypt my secure data with EncryptedStorage described in EncryptedStorage
I add the code below
EncryptedStorage.install("weejgrieqjgewgjwerrgjerwgmwe 9");
It shows error messages when my program makes a https request.
org.bouncycastle.crypto.DataLengthException: last block incomplete in decryption
[Network Thread] 0:0:0,2 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption
[Network Thread] 0:0:0,648 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption
[Network Thread] 0:0:0,749 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption
[Network Thread] 0:0:1,252 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption
at org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher.doFinal(PaddedBufferedBlockCipher.java:281)
at com.codename1.crypto.EncryptedStorage.createInputStream(EncryptedStorage.java:63)
at com.codename1.io.Storage.readObject(Storage.java:265)
at com.codename1.impl.CodenameOneImplementation.getCookiesForURL(CodenameOneImplementation.java:4700)
at com.codename1.io.ConnectionRequest.performOperationComplete(ConnectionRequest.java:830)
at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:341)
How do I solve this problem?
The cookies file isn't encrypted. I'm assuming it was written before you applied the encryption everything.
So just before applying the encryption delete the cookies file:
deleteStorageFile("Cookies");
I have the following piece of code, I've built for connecting to a "https" REST end point using Apache Camel. The problem is that I get 401 error if this is run.
from("timer:learnTimer?period=100s")
.to("log:?level=INFO&showBody=true")
.setHeader("currentTime", simple(currentTime))
.setHeader(Exchange.CONTENT_TYPE,constant("application/json"))
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setHeader(Exchange.HTTP_URI, simple("https://xxxxxx/api/siem/offenses?filter=status%20%3D%20%22OPEN%22%20and%20start_time%20%3E%201543647979000?&authMethod=Basic&authUsername=xxxxx&authPassword=xxxxx"))
.to("https://xxxxxxx/api/siem/offenses?filter=status%20%3D%20%22OPEN%22%20and%20start_time%20%3E%201543647979000?&authMethod=Basic&authUsername=xxxx&authPassword=xxxx").convertBodyTo(String.class)
.to("log:?level=INFO&showBody=true");
The error I am receiving is:
Stacktrace
org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking https://xx.xx.xx.xx/api/siem/offenses?filter=status+%3D+%22OPEN%22+and+start_time+%3E+1543647979000%3F with statusCode: 401
at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:243)
at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:165)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
15:16| WARN | CamelLogger.java 213 | Error processing exchange. Exchange[ID-zabbixproxy-node2-1544019394005-0-1]. Caused by: [org.apache.camel.http.common.HttpOperationFailedException - HTTP operation failed invoking https://xx.xx.xx.xx/api/siem/offenses?filter=status+%3D+%22OPEN%22+and+start_time+%3E+1543647979000%3F with statusCode: 401]
org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking https://10.96.40.66/api/siem/offenses?filter=status+%3D+%22OPEN%22+and+start_time+%3E+1543647979000%3F with statusCode: 401
at org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:243)
at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:165)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
Are you sure you should set these header before making an rest call?
un necessary request headers in IN Message may cause some issue.
Exchange exchange = ExchangeBuilder.anExchange(camelContext)
.withHeader("").withProperty("")
.withPattern(ExchangePattern...)
.withHeader(Exchange.HTTP_METHOD, HttpMethod.GET)
.build();
producer.send("the end point to rest",exchange);
// producer is ProducerTemaplte
In above code you can set The ExchangePattern and required Headers and property (if only needed).
Hope this helps.
I'm building a HL7 listener using netty4 and processing HL7 messages. Once succesfully processed an ACK is sent back.
from("hl7NettyListener")
.routeId("route_hl7listener")
.startupOrder(997)
.unmarshal()
.hl7(false)
.to("direct:a");
from("direct:a")
.doTry()
.to("bean:processHL7?method=process")
.doCatch(HL7Exception.class)
.to("direct:ErrorACK")
//.transform(ack())
.stop()
.end()
.transform(ack())
.wireTap("direct:b");
This is working fine in my local eclipse. I fire a HL7 message and I get a ACk back.
But i package this application into a jar and put it on my server and then try doing a
cat example.hl7 | netcat localhost 4444 (to fire a HL7 message to port 4444 on linux env)
I dont get an ACK back. I get a closedconnection exception.
DEBUG NettyConsumer - Channel: [id: 0xdf13b06b, L:0.0.0.0/0.0.0.0:4444] writing body: MSH|^~\&|Karisma||Kestral|Kestral|20180309144109.827+1300||ACK^R01|701||2.3.1
2018-03-09 14:41:09,838 [ad #3 - WireTap] DEBUG WireTapProcessor - >>>> (wiretap) direct:b Exchange[]
2018-03-09 14:41:09,839 [ServerTCPWorker] DEBUG NettyConsumer - Caused by: [org.apache.camel.CamelExchangeException - Cannot write response to null. Exchange[ID-annan06-56620-1520559639101-0-2]. Caused by: [java.nio.channels.ClosedChannelException - null]]
org.apache.camel.CamelExchangeException: Cannot write response to null. Exchange[ID-annan06-56620-1520559639101-0-2]. Caused by: [java.nio.channels.ClosedChannelException - null]
at org.apache.camel.component.netty4.handlers.ServerResponseFutureListener.operationComplete(ServerResponseFutureListener.java:54)
at org.apache.camel.component.netty4.handlers.ServerResponseFutureListener.operationComplete(ServerResponseFutureListener.java:36)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)
at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:34)
at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:438)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(...)(Unknown Source)
That worked. It was failing because netcat was immediately closing the connection. Had put a ”netcat -i 5 localhost” for netcat to wait for 5 secs and successfully received the ACK back.
I am trying to get the list of emails by Message msg[] = folder.getMessages();. After that I am getting the details of each message, meanwhile I am getting javax.mail.MessagingException: Failed to load IMAP envelope exception for some message.
This is protocol trace for the one message which producing error -
A7 FETCH 2 (ENVELOPE INTERNALDATE RFC822.SIZE)
* 2 FETCH (RFC822.SIZE 2567 INTERNALDATE "29-Apr-2011 13:49:01 +0000" ENVELOPE ("Fri, 29 Apr 2011 19:19:01 +0530" "I NEES YOUR ASSISANCE?????" (("Mr Leung Cheung" NIL "info" "milium.com.br")) (("Mr Leung Cheung" NIL "info" "milium.com.br")) ((NIL NIL "mr.leung_cheung" "live.hk")) () NIL NIL NIL "<20110429134718.70333732030A#mail2.milium.com.br>"))
A7 OK FETCH Completed
Stacktrace of error is-
Failed to load IMAP envelope stacktrace: javax.mail.MessagingException: Failed to load IMAP envelope
at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1276)
at com.sun.mail.imap.IMAPMessage.getSentDate(IMAPMessage.java:377)
at com.my.main.model.TestMail.showAllMails(TestMail.java:95)
at com.my.main.model.TestMail.main(TestMail.java:45)
I am using JavaMail-1.5.
How can I resolve this error, is there any way or settings to solve it and get details of message without skipping that message?
Thanks,
Neelam Sharma
Your server is broken. Please report this error to the server vendor. What server are you using?
In the response, the message's "To" value must meet this syntax defined in the spec:
env-to = "(" 1*address ")" / nil
address = "(" addr-name SP addr-adl SP addr-mailbox SP addr-host ")"
Instead, the server has returned "()". It should've returned "NIL" if there is no To header.
You can work around server bugs using the technique described in the JavaMail FAQ.