Closing session as an exception was thrown from MINA - apache-camel

I keep getting this message
[Mina2Consumer] Closing session as an exception was thrown from MINA
but no other information or exception is logged - the mina2 code suggests it is throwing a Camel Exception but is not getting logged anywhere.
I am using Camel 2.11.0 and Mina2 2.0.7
any help will be great.

There was this improvement recently in camel-mina2 to ensure the root cause is included in the exception if a write failure happened: https://issues.apache.org/jira/browse/CAMEL-6970
Maybe applying that patch to your Camel to see if that helps you. Or wait for that fix to be released and upgrade Camel etc.

Related

Flink not giving full reason as to why job submission failed

After upgrading Flink to 1.7.2, when I try to submit a job from the dashboard and there's some issue with the job, the job submission fails with the following error.
Exception occurred in REST handler: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.
There's no other reason given as to why the job failed to submit. This was not the case in 1.4.2. Is there a way to see the full reason why the job failed to deploy? I see the same error in the logs too with no additional information.
This is a known issue in version 1.7.2. It has been fixed in 1.8.0.
Jira ticket - https://issues.apache.org/jira/browse/FLINK-11902

CAMEL - Channel Closed exception not caught using onException

I am opening this question as I didn't find any answer to problem in the web.
I have used camel to implement a TCP/IP server and I have defined a route like this:
from("netty4:tcp://0.0.0.0:3510")
.to("file:target/outbox");
and I have a client which sends data to this server. When I disconnect this client I can see in my logs this exception:
[Camel (camel-client) thread #0 - NettyEventExecutorGroup] WARN o.a.c.component.netty4.NettyConsumer - Closing channel as an exception was thrown from Netty. Caused by: [java.io.IOException - an existing connection was forcibly closed by the remote host]
My problem is that I am not able to catch this exception using onException clause.
onException(IOException.class)
.log("Exception: ${body}")
.handled(true)
.process(new ExceptionProcessor());
The program does not stop but I want to catch it to handle when the client is disconnected.
Note that I can catch other exceptions which are thrown inside my route.
You cannot handle it as exception, because exception is already catched in netty and logged. This exception is not propagated from netty to netty component.
The solution is a bit tricky. You can extend SimpleChannelInboundHandler and override method channelInactive as described in How can I detect network disconnection in Apache Camel?.
In this custom handler you can set custom properties on exchange with additional information, which is relevant in your application.

OSB - JMS - Error Handler

I'm having some troubles trying to catch an error on OSB when I put a message on queue and JMS Server is down, I have a proxy service calling a business service that have a jms configured.
My proxy service already have Transaction Required and Same Transaction For Response enabled.
The error on Admin log:
Destination unreachable; nested exception is:
java.net.ConnectException: Connection refused: connect; No available
router to destination
But the exception don't catch on ErrorHandler :(
I found the error, the problem is that I was using Publish instead of Routing, after I changed everything worked.
Yes that correct , Publish thread is like fire and forget(completely asynchronous) while a Route or ServiceCallout will latch on to the exception in ErrorHandler
Publish is fire-and-forget, by default with no wait for an answer. This comes from the fact, that default QualityOfService=BestEffort for publish action. You can change that, by using RoutingOptions block, and setting QualityOfService=ExactlyOnce. OSB will then wait for action to execute, hence will be also able to catch potential errors.

Camel route does not log when deployed in ServiceMix

I referred below article and created dependencies and log4j properties
http://camel.apache.org/how-do-i-use-log4j.html
Here is my simple route
from("direct:start")
.routeId("LogEipInfoLevelRoute")
.log(LoggingLevel.INFO, "Displaying Something - ${body}")
.to("mock:result");
Once i deploy my route in servicemix, im checking service mix log. I couldnt find any such message logged. except the route creation message with specified id.
Am i checking it in the wrong place?
You need to send a message to the direct:start endpoint for anyting to happen.
If you just want to see something going on, then you can use a timer instead of direct, eg
from("timer:foo?period=5000")
to figure a new message every 5 seconds. Notice the message body is null from a timer.
I assume that you are using OSGI Based ServiceMix version
Please execute following command in karaf console:
karaf#root> log:display | grep Displaying
More about ServiceMix logging systems can be found under http://servicemix.apache.org/docs/4.4.x/users-guide/logging-system.html
You must pass something to direct:start for something to happen. You can read more here about using direct : http://camel.apache.org/direct.html
I would just suggest using a timer to kick off your route. Once your route is kicked off by the timer your log will be written out to your log file.

Camel with rabbitmq - Misspelt queue name

Today, I tried to simulate a scenario where in the camel "to" tag I supplied a mis-spelt queue name(which was not there) Camel or RabbitMq instead of throwing an exception back continued to finish the route flow.
Intrgigued I did write a sample program to send a message using "channel.basicPublish" with a wrong queue name. I never got any exception thrown back from rabbit mq client.
however if the exchange name was wrong, I did get an exception back. Is this expected behaviour?
I tried adding return listener, confirm listener,exception handler, etc., but none of them got invoked.
Any clues?
Messages are published to exchanges, so the exchange must be there when publishing messages. At publish time RabbitMQ doesn't care about queues, unless the mandatory flag is provided, or the channel is in confirm mode.

Resources