Announcement Announcement Module
Collapse
No announcement yet.
system.exit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • system.exit

    For certain exceptions i dont want my application to be running ,under non-osgi environment i was simply making a call to System.exit() .Under dm server ,this will bring the dm server down .Any suggestions for replacement of System.exit in similar case

  • #2
    You could stop the bundle or a collection of bundles that form your application.

    Comment


    • #3
      But how do i do it programmatically.

      Comment


      • #4
        Do have access to the BundleContext? With Spring-DM you could implement the interface BundleContextAware. Another option is to write your own BundleActivator and store the BundleContext for later use.

        Comment


        • #5
          If i try to uninstall the bundle using bundleContext.getBundle().uninstall() in case of web bundle the bundle doesnot get uninstalled gracefully . The status on console shows removing web application '/xyz' but it never completes.

          Comment


          • #6
            Stopping the bundle should be sufficient. I would not uninstall it, because then it is no longer available in your system. I just tried this with dm Server 2.0.M2 and the Eclipse dm Server tools stopping one of my web bundles via the OSGi console and it worked (dm Server returns HTTP 404 for the context path of the bundle that has been stopped).

            Comment


            • #7
              But the console keeps on showing:

              [2009-07-01 12:45:28.629] osgi-console <SPSC1002I> Removing web application '/batch'.

              and never completes can i ignore something like this:

              Comment


              • #8
                Only a single message appearing is as expected in 2.0.0.M2.

                In the recent nightly builds, which use the OSGi web container for their Web support, this has improved such that two messages are generated:
                Code:
                [2009-07-01 09:58:17.104] Thread-20                <SPWE0002I> Stopping web bundle '/foo'.
                [2009-07-01 09:58:17.129] Thread-20                <SPWE0003I> Stopped web bundle '/foo'.

                Comment


                • #9
                  Thanks ,i might not be getting the same result as i am running my app on SDMS 1.0.2 with struts2 for MVC framework .Shall i upgrade

                  Comment


                  • #10
                    An application that works on 1.0.2, should work on 2.0. If it doesn't then we'd love to hear about it so that we can, if possible, fix the problem.

                    The only thing to be aware of when moving from 1.0.2 to 2.0 is that, in the latest 2.0 nightly builds, support for Web Modules has been removed in favour of OSGi Web Container compatible WAR files and Web Bundles. If your 1.0.2 application contains a Web Module, rather than a WAR file, then the programmer guide that's packaged with the nightly builds contains details of the steps to take to perform the necessary migration.

                    Comment

                    Working...
                    X