0

I have my camel bundle deployed in service mix and it runs well for some times and now after many runs the same bundle tells the below exception.

org.apache.camel.runtimeexception :java.lang.illegalstateexception:  bundlecontext is no longer valid

The same scenario was working fine some runs and suddenly for some consecutive runs it throws the above errors.

Will restart of smx or uninstall of the bundle resolve the issue? this is the third time I am facing this issue and all the time a small restart solved it. Please suggest if this is some other problem.

After My Comment below

I have used in the code i have used like below code.

<choice>
<when>
<simple>some condition</simple>

</when>
<when>
<simple>some other condition</simple>
<stop/>
<when>
</choice>
<!--Still more code and logic exists-->

If I have used here and that is the problem here what should I do to exit when the second condition comes.

Is there any way I can stop the further execution here? that is what is the way to stop the execution for that particular request alone and not stop the route? In this scenario there are other requests which will not be affected by this stop and will work for other requests.

I think in the http://camel.apache.org/intercept.html link it says that to use to stop further execution but will it stop the route any way.

Will this cause the bundle no longer valid scenario. From this there arises a question where what will be the spring config equivalent of CamelContext.stop() ?

After My another Comment below which directs here.

Also we work in an environment where the camel has more customized bundles which ease our development. This has more specifically loading the routes dynamically. Will this be one reason where the routes may not be properly started when we give camelCOntext.Start() etc....?

рüффп
  • 5,172
  • 34
  • 67
  • 113
Naveen Raj
  • 801
  • 11
  • 26
  • How did you deploy the camel route? Did you just deploy a xml or a bundle? – Willem Jiang Jul 10 '14 at 02:15
  • The complete bundle as usual.. It was working for some requests and the same bundle threw this error.A simple restart did solve the issue but curious to know if it because of a specific reason or something. – Naveen Raj Jul 10 '14 at 09:31
  • Can you show us the camel route that you have? – Willem Jiang Jul 11 '14 at 01:05
  • @WillemJiang I have used in my route will that make the bundle no longer invalid? I have added some info on the question to make my requirement clear. – Naveen Raj Jul 13 '14 at 20:10
  • I think you just asked another question here. – Willem Jiang Jul 14 '14 at 00:39
  • I could not add the code as I should not be sharing them.Sorry. though – Naveen Raj Jul 14 '14 at 04:05
  • @WillemJiang I did could not share the code. But it will be great if you could add some generic conditions when this error will occur? – Naveen Raj Jul 22 '14 at 10:53
  • @WillemJiang I am opening this up again as I got the same error on this. Could you let me know what could be other reasons for the above bundle context no longer valid issue? – Naveen Raj Sep 22 '14 at 07:24
  • Did you dig the log for the reason that the bundle is not valid any more? AFAIK, stopping the camel context cannot lead the bundle context to stop. – Willem Jiang Sep 24 '14 at 00:20

1 Answers1

0

From the camel route, I cann't tell anything is wrong. As you just asked another question I just post my answer here:

stop element in the route only works for the exchange, which means the exchange which is routed to this point won't be processed any more. If you want to stop the route or camel context you need call the CamelContext.stop().

If can do it in Spring configuration by using camel-controlbus component.

Willem Jiang
  • 3,291
  • 1
  • 14
  • 14
  • What is the difference between and the CamelCOntext.stop()? – Naveen Raj Jul 14 '14 at 03:55
  • Added more information to the question above . Please can you check them? and help me – Naveen Raj Jul 14 '14 at 04:05
  • I don't think stop the camel context could cause the bundle to be invalid. Can you use osgi command to check the camel application bundle states? – Willem Jiang Jul 22 '14 at 14:57
  • It happens some times but I think I will have to wait for it to occur next time for it to happen and then I will test them. Can you tell me any one scenario where this could happen that will give me some lead? – Naveen Raj Jul 22 '14 at 15:53
  • Did you refresh the bundle context by installing or uninstalling the feature? – Willem Jiang Jul 25 '14 at 01:59
  • This time the stop and start of the bundle did not work and had to restart the smx. Do you have any other thing in mind where this situation could happen. I have a pointer here explained in the question – Naveen Raj Sep 22 '14 at 12:27