Results 1 to 10 of 10

Thread: system.exit

  1. #1
    Join Date
    Nov 2008
    Posts
    232

    Default 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. #2
    Join Date
    Jun 2009
    Location
    Munich, Bavaria
    Posts
    17

    Default

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

  3. #3
    Join Date
    Nov 2008
    Posts
    232

    Default

    But how do i do it programmatically.

  4. #4
    Join Date
    Jun 2009
    Location
    Munich, Bavaria
    Posts
    17

    Default

    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.

  5. #5
    Join Date
    Nov 2008
    Posts
    232

    Default

    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.

  6. #6
    Join Date
    Jun 2009
    Location
    Munich, Bavaria
    Posts
    17

    Default

    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).

  7. #7
    Join Date
    Nov 2008
    Posts
    232

    Default

    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:

  8. #8
    Join Date
    Oct 2008
    Posts
    493

    Default

    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'.
    Andy Wilkinson
    SpringSource

  9. #9
    Join Date
    Nov 2008
    Posts
    232

    Default

    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

  10. #10
    Join Date
    Oct 2008
    Posts
    493

    Default

    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.
    Andy Wilkinson
    SpringSource

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •