Topic
7 replies Latest Post - ‏2013-03-11T16:23:20Z by JoeChacko
SystemAdmin
SystemAdmin
590 Posts
ACCEPTED ANSWER

Pinned topic Load Classes from WAS shared library in OSGi bundle

‏2013-03-05T07:08:32Z |
Is it possible to use classes that are in a websphere application server shared library from within an OSGi bundle?

I did some research and found this http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.was_v8/was/8.5/ProgrammingModel/WAS85_LP_Class_Loading.pdf which indicates that it ispossible to load OSGi classes from standard java, however, there is no indication whether the opposite is possible. Any help would be appreciated!
  • JoeChacko
    JoeChacko
    15 Posts
    ACCEPTED ANSWER

    Re: Load Classes from WAS shared library in OSGi bundle

    ‏2013-03-05T15:01:27Z  in response to SystemAdmin
    No, it isn't possible to access classes in a shared library from within an OSGi application. The shared library facility is for Java EE apps only.

    There is a separate mechanism called the bundle repository for making code available to OSGi applications. You can read about that here: http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_dep_commonbundles.html

    Unsurprisingly, the things in the bundle repository are bundles rather than just jars.

    There is another approach that can be used to make code available to Java EE applications and to OSGi applications, but this is currently in beta only. If you are on the recent V8.5.Next beta you can try writing a user feature to house the shared function if you need something.

    --
    Joe
    WebSphere Application Server Liberty Profile development
    • SystemAdmin
      SystemAdmin
      590 Posts
      ACCEPTED ANSWER

      Re: Load Classes from WAS shared library in OSGi bundle

      ‏2013-03-05T15:10:33Z  in response to JoeChacko
      You can make use of SCA to consume shared libraries since from an OSGi implementation.
    • hampe98
      hampe98
      12 Posts
      ACCEPTED ANSWER

      Re: Load Classes from WAS shared library in OSGi bundle

      ‏2013-03-06T09:14:42Z  in response to JoeChacko
      Hi Joe,

      That sounds really interesting.
      Do you mean that the user feature would implement the common function or are there any other ways of sharing modules between OSGi and JEE? We´re currently heavy on JEE modules but dependencies and different versions of dependencies are getting more and more complex so I would like to try the OSGi approach. The prolem is that there´s no way of doing a big bang switch so if there´s a way of starting with framework modules as OSGi bundles and then gradually move utility jars, EJBs and WEB apps? It would be like the JEE EARs would run on top of the OSGi runtime with access to classes loaded by the OSGi runtime (our framework bundles).

      Regards,
      Hampus
      • JoeChacko
        JoeChacko
        15 Posts
        ACCEPTED ANSWER

        Re: Load Classes from WAS shared library in OSGi bundle

        ‏2013-03-06T13:27:05Z  in response to hampe98
        Hi Hampus,

        I mean that the user feature would implement the common function, and export the necessary packages as API so they could be accessed from Java EE apps and from OSGi apps.

        Regards,
        Joe
    • SystemAdmin
      SystemAdmin
      590 Posts
      ACCEPTED ANSWER

      Re: Load Classes from WAS shared library in OSGi bundle

      ‏2013-03-08T22:34:35Z  in response to JoeChacko
      Hi Joe, that sounds like it could help with migration of our application to OSGi. Is there some documentation somewhere? So I can get a bit of an idea exactly how the feature works?
      • SystemAdmin
        SystemAdmin
        590 Posts
        ACCEPTED ANSWER

        Re: Load Classes from WAS shared library in OSGi bundle

        ‏2013-03-08T22:35:38Z  in response to SystemAdmin
        The "user feature" feature that is :-)
        • JoeChacko
          JoeChacko
          15 Posts
          ACCEPTED ANSWER

          Re: Load Classes from WAS shared library in OSGi bundle

          ‏2013-03-11T16:23:20Z  in response to SystemAdmin
          Yes, please check out the documentation for our recent beta here: https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/resource/doc/liberty_v85next_beta.pdf
          In particular, take a look at Chapter 8.
          --Joe