Topic
16 replies Latest Post - ‏2012-10-02T13:33:25Z by Emily Jiang
SystemAdmin
SystemAdmin
153 Posts
ACCEPTED ANSWER

Pinned topic OSGI in application versioning in WAS

‏2012-06-06T02:02:13Z |
Hi,

I have two different version of open source application installed in WAS v7, which is Liferay(LR).
The older version LR is installed as a plugin portlet of the newer version LR.
However, I bumped into ClassCastException, think of that it might be some versioning classes problem.
So, I come to OSGI, built OSGI bundle with standard OSGI framework, not Equinox, and my question is :

I deploy this bundle into WAS v7, like maybe into the internal repository of admin console, and how do I associate my older LR with the OSGI bundle ? (attached MANIFEST.MF for the bundle i made)

And what is this .eba and this .WAB file, are them OSGI bundle ?

Searched into few articles on these, but I need someone to compile these facts in a simple and understandable way please.

Thanks,
Anson.Y
Updated on 2012-10-02T13:33:25Z at 2012-10-02T13:33:25Z by Emily Jiang
  • Emily Jiang
    Emily Jiang
    73 Posts
    ACCEPTED ANSWER

    Re: OSGI in application versioning in WAS

    ‏2012-06-11T08:42:08Z  in response to SystemAdmin
    Hi Anson,

    Sorry for the late response. For turning a jar into a bundle, you can use bnd tool. Have you googled to see whether Liferay bundle already exists?

    The .eba file is an Enterprise Bundle Archive which is effectively an archive. WAB is Web Archive Bundle, which is a war bundle. By the way, there is no .wab file extension. Here has more details about EBA.

    For using the OSGi feature in WAS, you need to develop an OSGi application. Uploading any bundles to internal bundle repository won't get them being loaded to an OSGi framework unless it is directly or indirectly used by an OSGi application. Refer to here for developing OSGi applications.

    Hope this helps.
    Thanks
    Emily
    • SystemAdmin
      SystemAdmin
      153 Posts
      ACCEPTED ANSWER

      Re: OSGI in application versioning in WAS

      ‏2012-06-13T07:23:24Z  in response to Emily Jiang
      Hi Emily,

      Currently did some example bundle of OSGI application through RAD v8.03, kinda messed up.
      After I have done all the example like creating client bundle, service bundle and OSGI application, I tried to run it at WAS v7, and I see its working from the log files.
      From what I found, .eba is installed as Asset in WAS v7, correct ?
      OSGI bundle is installed in internal bundle repository ?
      Correct me if I'm wrong, is OSGI application = .eba (Enterprise Bundle Archive) ?

      I need to convert the older version of LR to OSGI application or .eba to use OSGI ? And how to do that ?
      Thanks,
      Anson.Y
      • Emily Jiang
        Emily Jiang
        73 Posts
        ACCEPTED ANSWER

        Re: OSGI in application versioning in WAS

        ‏2012-06-15T11:32:54Z  in response to SystemAdmin
        Hi Anson,
        Your questions are answered below.
        1. From what I found, .eba is installed as Asset in WAS v7, correct ?
        <ej> Yes. </ej>

        2. OSGI bundle is installed in internal bundle repository ?
        <ej> You can put your bundles in the .eba or install them in internal bundle repository. Installing them to bundle repostiory is recommended approach as the bundles can be reused by multiple applications. You can also put your bundle in a configured external bundle repository such as Rational Asset Manager. </ej>

        3. Correct me if I'm wrong, is OSGI application = .eba (Enterprise Bundle Archive) ?
        <ej> Correct. The .eba file means Enterprise Bundle Archive. It is just a zip file.</ej>
        4. I need to convert the older version of LR to OSGI application or .eba to use OSGI ? And how to do that ?
        <ej> I am not familiar with LR. Is it a jar or ear file?
        You can automatically convert an enterprise application that contains only web applications. An EAR file that contains only web application archive (WAR) files can be converted to an EBA file. When you import the EBA file as an asset, the WAR files are automatically converted to web application bundles (WABs).
        You cannot automatically convert an enterprise application that contains utility JAR files. You can use a tool called bnd to convert a jar to a bundle.
        </ej>

        Regards,
        Emily
        • SystemAdmin
          SystemAdmin
          153 Posts
          ACCEPTED ANSWER

          Re: OSGI in application versioning in WAS

          ‏2012-06-18T05:52:06Z  in response to Emily Jiang
          Hi Emily,

          Thanks for your kind response, LR is war file originally from their official repository.
          Up to my understanding, .war file is a module of .ear file, correct ?
          What I did is installing LR war file into WAS v7, and when its done, it appears to be .ear file located at "InstalledApp" folder.
          Should I export this LR war as .ear file from Eclipse and rename it to .eba file, and deploy it as asset into WAS v7 ?
          In this case, it will convert my LR war file in the .ear file into .wabs file, correct ?
          Thanks,
          Anson.Y
          • Emily Jiang
            Emily Jiang
            73 Posts
            ACCEPTED ANSWER

            Re: OSGI in application versioning in WAS

            ‏2012-06-18T10:14:43Z  in response to SystemAdmin
            Hi Anson,

            To get you started, you can simply put the .war file in a zip and name the zip .eba and then import .eba as an asset by following the infocenter instruction about install .eba files. The WAS runtime will automatically convert you .war to a web bundle archive.

            Once you get it working, you can then follow the link I mentioned in my previous response to manually convert .war to a web bundle archive to have a better control of bundle symbolic name, version, context root etc.

            Hope this helps.
            Regards
            Emily
            • SystemAdmin
              SystemAdmin
              153 Posts
              ACCEPTED ANSWER

              Re: OSGI in application versioning in WAS

              ‏2012-06-19T10:06:37Z  in response to Emily Jiang
              Hi Emily,

              Thanks for the quick response.
              I am now imported my .eba accordingly to your reply as asset in WAS v7 and as well created a new BLA and pointed the asset to it.

              Happened to get some error during the pointing of asset to new BLA :
              
              Exception:java.util.MissingResourceException SourceId:com.ibm.ws.management.deploy.util.Util.getMessage ProbeId:159 java.util.MissingResourceException: Can
              't find resource for bundle java.util.PropertyResourceBundle, key EbaDetailsStep.deploymentNewExists.title
              


              And error encountered during starting up the BLA :
              
              WSVR0190I: Starting composition unit WebSphere:cuname=IDDM_0001.eba in BLA WebSphere:blaname=IDDM. AriesApplicat E   CWSAI0001E: Unable to locate the bundle IDDM.eba.IDDM;version=
              "[1.0.0,1.0.0]". WSVR0194E: Composition unit WebSphere:cuname=IDDM_0001.eba in BLA WebSphere:blaname=IDDM failed to start. StepStartBLA  A   CWWMH0197E: Problems were encountered 
              
              while attempting to start business-level application 
              "WebSphere:blaname=IDDM".  It is possible that the business-level application is not running or is only partially running.  Please refer to FFDC log entries 
              
              for details on any failures which were encountered.
              


              Am I missing anything ?

              Thanks,
              Anson.Y
              • Emily Jiang
                Emily Jiang
                73 Posts
                ACCEPTED ANSWER

                Re: OSGI in application versioning in WAS

                ‏2012-06-19T16:04:42Z  in response to SystemAdmin
                Hi Anson,

                As for your first exception, was it a ffdc? It is a benign exception.

                You mentioned a bundle with the symbolic name of IDDM.eba.IDDM at version 1.0.0. Do you have such a bundle installed in your internal bundle repository or included in your eba file?
                If you need further assistance, please attach your bundle's manifest.mf and your eba's application.mf.

                Hope this helps.
                Emily
                • SystemAdmin
                  SystemAdmin
                  153 Posts
                  ACCEPTED ANSWER

                  Re: OSGI in application versioning in WAS

                  ‏2012-06-20T02:21:24Z  in response to Emily Jiang
                  Hi Emily,

                  No, I did not install any bundle in my internal repository.
                  As my understanding, OSGI bundle only need to be install in internal repository if the bundle is shared and used by multiple OSGI application. For my case, the jars only used by older LR version, which also not usable for newer version of LR.

                  Attached my APPLICATION.MF.
                  Thanks,
                  Anson.Y
                • SystemAdmin
                  SystemAdmin
                  153 Posts
                  ACCEPTED ANSWER

                  Re: OSGI in application versioning in WAS

                  ‏2012-06-20T03:44:16Z  in response to Emily Jiang
                  Hi Emily,

                  Attached manifest.mf in my .wab file reside inside my .eba file.

                  Am I missing something ?

                  Thanks,
                  Anson.Y

                  Attachments

                  • Emily Jiang
                    Emily Jiang
                    73 Posts
                    ACCEPTED ANSWER

                    Re: OSGI in application versioning in WAS

                    ‏2012-06-20T10:18:24Z  in response to SystemAdmin
                    Hi Anson,

                    If you have imported the asset successfully, the eba is happy with its content. On starting it, the bundle cannot be located.

                    Did you use .wab as the file extension for the WAB? If you do, change the file extension to .jar. If possible, can you attache your eba file here?

                    Thanks
                    Emily
                    • SystemAdmin
                      SystemAdmin
                      153 Posts
                      ACCEPTED ANSWER

                      Re: OSGI in application versioning in WAS

                      ‏2012-06-21T03:18:38Z  in response to Emily Jiang
                      Hi Emily,

                      Maybe I should list down what I did.
                      Steps that I did :
                      1. Create Dynamic Web Project in Eclipse, import my old LR to it, export as .ear.
                      2. Add in application.xml into .war located inside the .ear.
                      3. Rename extension of .ear to .eba, proceed upload as asset into WAS v7.
                      4. Create new BLA in Admin Console, assign asset uploaded to it.
                      5. Start BLA, and it hits error.

                      "Did you use .wab as the file extension for the WAB?"
                      <anson>No, I did not change the .war inside the .eba</anson>

                      My .eba file is too big for attachment, it has nearly 140MB.
                      Is there any way to get it to you ?
                      Thanks,
                      Anson.Y
                    • SystemAdmin
                      SystemAdmin
                      153 Posts
                      ACCEPTED ANSWER

                      Re: OSGI in application versioning in WAS

                      ‏2012-06-21T06:19:07Z  in response to Emily Jiang
                      Hi Emily,

                      Attached with my .eba file in chunks.
                      To join them back together, http://www.filesplitter.org/
                      Thanks,
                      Anson.Y
  • SystemAdmin
    SystemAdmin
    153 Posts
    ACCEPTED ANSWER

    Re: OSGI in application versioning in WAS

    ‏2012-06-25T02:22:44Z  in response to SystemAdmin
    Hi,

    Anyone kind to point me the way on attaching large size file ?
    Are there any steps that I missed out working on OSGI ?

    Thanks,
    Anson.Y
  • Emily Jiang
    Emily Jiang
    73 Posts
    ACCEPTED ANSWER

    Re: OSGI in application versioning in WAS

    ‏2012-06-25T10:32:17Z  in response to SystemAdmin
    Hi Anson,

    You can Email: emijiang@uk.ibm.com me the file.
    Thanks
    Emily
  • SystemAdmin
    SystemAdmin
    153 Posts
    ACCEPTED ANSWER

    Re: OSGI in application versioning in WAS

    ‏2012-08-30T09:08:04Z  in response to SystemAdmin
    Hi Emily,

    After working on it for nearly a month plus, I manage start the eba. with some errors.

    
    [8/30/12 4:31:47:812 SGT] 0000004a WebModuleExte E   CWSAH0011E: An internal error occurred. The runtime environment could not start the Web bundle IDDM.eba.IDDM_1.0.0 because of exception java.lang.RuntimeException: Unable to start a Web Application: IDDM.eba.IDDM_1.0.0 at com.ibm.ws.osgi.web.extender.BundleHandler.startBundle(BundleHandler.java:586) at com.ibm.ws.osgi.web.extender.WebModuleExtender.processBundle(WebModuleExtender.java:144) at com.ibm.ws.osgi.web.extender.WebModuleExtender.bundleChanged(WebModuleExtender.java:184) at com.ibm.ws.osgi.web.extender.WebModuleExtender$WebBundleTrackerCustomizer.addingBundle(WebModuleExtender.java:212) at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:440) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:413) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:919) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:338) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280) at com.ibm.ws.app.container.aries.AriesApplication.findAndStartBundles(AriesApplication.java:775) at com.ibm.ws.app.container.aries.AriesApplication.install(AriesApplication.java:455) at com.ibm.ws.app.container.aries.AriesApplicationEventHandler.handleEvent(AriesApplicationEventHandler.java:141) at com.ibm.ws.event.internal.adapter.OSGiHandlerAdapter.handleEvent(OSGiHandlerAdapter.java:46) at com.ibm.ws.event.internal.dispatcher.DefaultEventDispatcher.invoke(DefaultEventDispatcher.java:47) at com.ibm.ws.event.internal.HandlerHolder.fireSynchronousEvent(HandlerHolder.java:342) at com.ibm.ws.event.internal.EventEngineImpl.publishEvent(EventEngineImpl.java:272) at com.ibm.ws.event.internal.EventEngineImpl.publishOsgiEvent(EventEngineImpl.java:210) at com.ibm.ws.event.internal.EventEngineImpl.sendEvent(EventEngineImpl.java:179) at com.ibm.ws.eba.app.framework.fep.EBAAppFramework.startApplication(EBAAppFramework.java:496) at com.ibm.ws.eba.internal.framework.EBALauncherImpl.startApplication(EBALauncherImpl.java:526) at com.ibm.ws.eba.external.framework.LauncherImpl.startApplication(LauncherImpl.java:689) at com.ibm.ws.eba.bla.EbaOperationHandler.executeOperation(EbaOperationHandler.java:109) at com.ibm.ws.management.bla.runtime.ControlOperationHelper.invokeControlOperationHandler(ControlOperationHelper.java:733) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$ControlOpHandler.invokeControlOperationHandler(CompositionUnitMgrImpl.java:973) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$ControlOpHandler.start(CompositionUnitMgrImpl.java:922) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:385) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:328) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:599) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:561) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1074) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1331) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1224) at com.ibm.ws.management.bla.runtime.ControlOperationHelper.execControlOpViaRuntimeMBean(ControlOperationHelper.java:1046) at com.ibm.ws.management.bla.runtime.ControlOperationHelper.execControlOpOnLocalServer(ControlOperationHelper.java:533) at com.ibm.wsspi.management.bla.runtime.CompUnitControlOpDispatcher.dispatchCompUnitControlOpToTarget(CompUnitControlOpDispatcher.java:258) at com.ibm.wsspi.management.bla.runtime.CompUnitControlOpDispatcher.dispatch(CompUnitControlOpDispatcher.java:181) at com.ibm.ws.management.bla.steps.StepStartBLA.execute(StepStartBLA.java:157) at com.ibm.wsspi.management.bla.op.compound.Phase.execute(Phase.java:151) at com.ibm.wsspi.management.bla.op.compound.CompoundOperation._doPhaseExecute(CompoundOperation.java:102) at com.ibm.wsspi.management.bla.op.compound.CompoundOperation.doExecute(CompoundOperation.java:85) at com.ibm.wsspi.management.bla.op.Operation.execute(Operation.java:158) at com.ibm.wsspi.management.bla.op.compound.CompoundOperation.execute(CompoundOperation.java:68) at com.ibm.ws.management.bla.commands.ADTCommand$OperationScheduler.run(ADTCommand.java:563) at java.lang.Thread.run(Thread.java:736) Caused by: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Failed to process bindings 
    
    for metadata at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:382) at com.ibm.ws.osgi.web.extender.application.VirtualEnclosingApplication.start(VirtualEnclosingApplication.java:504) at com.ibm.ws.osgi.web.extender.BundleHandler.startBundle(BundleHandler.java:577) ... 64 more Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Failed to process bindings 
    
    for metadata at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:742) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:617) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:376) ... 66 more Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to process bindings 
    
    for metadata at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:173) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:732) ... 68 more Caused by: com.ibm.wsspi.injectionengine.InjectionException: Failed to process bindings 
    
    for metadata at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:529) at com.ibm.ws.injectionengine.InjectionEngineImpl.processInjectionMetaData(InjectionEngineImpl.java:322) at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:806) at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:745) at com.ibm.ws.webcontainer.webapp.WebAppImpl.scanListeners(WebAppImpl.java:656) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:250) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166) ... 69 more Caused by: com.ibm.wsspi.injectionengine.InjectionException: CWNEN0044E: A resource reference binding could not be found 
    
    for the following resource references [jdbc/LiferayPool, mail/MailSession], defined 
    
    for the 0 component. at com.ibm.wsspi.injectionengine.InjectionProcessor.collectInjectionNBindingData(InjectionProcessor.java:1042) at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:516) ... 76 more
    


    But at the end, from the Admin Console, it stated that my application was started successfully.
    In my .eba, I have used Struts 1.0 bridge to link my Liferay 3.6.1 to Liferay 5.2.3 like :

    
    <portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
    


    After I able to start my .eba it seems like the bridge isnt working well. I can no longer see my Application from Liferay 5.2.3 portal.
    Is there any steps that I missed out ?
    Thanks,
    Anson.Y
  • Emily Jiang
    Emily Jiang
    73 Posts
    ACCEPTED ANSWER

    Re: OSGI in application versioning in WAS

    ‏2012-10-02T13:33:25Z  in response to SystemAdmin
    Hi Anson,

    Sorry for the late response. Are you using @Resource annotion to look up the resource of jdbc/LiferayPool, mail/MailSession. If yes, you need to make sure relevant datasource being created in the server. By the way, as you are using WAS7, which service pack level are your server at?

    Thanks
    Emily