Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      Summer 2 2023 May 29, Summer 3 2023 June 12, Summer 4 2023 June 26

      Description

      Situation: This ticket is part of a series of tutorials on OSGI.

      Task: Read and complete this tutorial: https://medium.com/javarevisited/learn-osgi-from-scratch-eclipse-intellij-and-wso2-platform-%EF%B8%8F-bf4c5629e097

      Document how useful this tutorial was and any useful information from the tutorial in the Jira comments below.

        Attachments

          Issue Links

            Activity

            nfreese Nowlan Freese created issue -
            nfreese Nowlan Freese made changes -
            Field Original Value New Value
            Epic Link IGBF-3142 [ 21688 ]
            nfreese Nowlan Freese made changes -
            Link This issue is blocked by IGBF-3357 [ IGBF-3357 ]
            nfreese Nowlan Freese made changes -
            Link This issue blocks IGBF-3359 [ IGBF-3359 ]
            nfreese Nowlan Freese made changes -
            Description Situation: This ticket is part of a series of tutorials on OSGI.

            Task: Read and complete this tutorial: https://medium.com/javarevisited/learn-osgi-from-scratch-eclipse-intellij-and-wso2-platform-%EF%B8%8F-bf4c5629e097
            Situation: This ticket is part of a series of tutorials on OSGI.

            Task: Read and complete this tutorial: https://medium.com/javarevisited/learn-osgi-from-scratch-eclipse-intellij-and-wso2-platform-%EF%B8%8F-bf4c5629e097

            Document how useful this tutorial was and any useful information from the tutorial in the Jira comments below.
            ann.loraine Ann Loraine made changes -
            Sprint Summer 2 2023 May 29 [ 171 ] Summer 2 2023 May 29, Summer 3 2023 June 12 [ 171, 172 ]
            ann.loraine Ann Loraine made changes -
            Rank Ranked higher
            Hide
            kgopu Kaushik Gopu added a comment -

            This is one the best article for learning OSGI in terms of both theoretical and conceptual aspect. This article helped me in creation of OSGI project from scratch. The author covers two examples one is developed on eclipse IDE using MANIFEST.MF file, which is quite older, and the other one is developed on IntelliJ using MAVEN.
            The second example is close to our IGB project in terms of project structure. However, the example is somewhat bigger and it might be difficult to understand in first go. So I recommend to create simple "Hello World" project to understand the basic workflow and configurations of OSGI and then comeback to this example to know how bundles interact with each other in order to deliver end result.

            Show
            kgopu Kaushik Gopu added a comment - This is one the best article for learning OSGI in terms of both theoretical and conceptual aspect. This article helped me in creation of OSGI project from scratch. The author covers two examples one is developed on eclipse IDE using MANIFEST.MF file, which is quite older, and the other one is developed on IntelliJ using MAVEN. The second example is close to our IGB project in terms of project structure. However, the example is somewhat bigger and it might be difficult to understand in first go. So I recommend to create simple "Hello World" project to understand the basic workflow and configurations of OSGI and then comeback to this example to know how bundles interact with each other in order to deliver end result.
            kgopu Kaushik Gopu made changes -
            Status To-Do [ 10305 ] In Progress [ 3 ]
            kgopu Kaushik Gopu made changes -
            Status In Progress [ 3 ] Needs 1st Level Review [ 10005 ]
            ann.loraine Ann Loraine made changes -
            Assignee Kaushik Gopu [ kgopu ] Ann Loraine [ aloraine ]
            ann.loraine Ann Loraine made changes -
            Status Needs 1st Level Review [ 10005 ] First Level Review in Progress [ 10301 ]
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Tutorial update:

            The tutorial mentions four OSGi framework implementations - Equinox, Knopflerfish, Felix, and Concierge. There is another implementation - Apache Karaf.

            Note that the tutorial is relatively recent - 2021.

            Show
            ann.loraine Ann Loraine added a comment - - edited Tutorial update: The tutorial mentions four OSGi framework implementations - Equinox, Knopflerfish, Felix, and Concierge. There is another implementation - Apache Karaf. Note that the tutorial is relatively recent - 2021.
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Github link for the Book Inventory (second) tutorial: https://github.com/nipunaupeksha/osgi-book-inventory.

            Made a fork in my "aloraine" account on github: https://github.com/aloraine/osgi-book-inventory
            Cloned it to my local.
            Built jar files from the cloned project with:

            mvn package
            

            jar files:

            local aloraine$ find . | grep jar
            ./org.wso2.carbon.book.provider/target/org.wso2.carbon.book.provider-1.0-SNAPSHOT.jar
            ./org.wso2.carbon.book.reader/target/org.wso2.carbon.book.reader-1.0-SNAPSHOT.jar
            ./.idea/jarRepositories.xml
            

            Unpacked org.wso2.carbon.book.provider-1.0-SNAPSHOT.jar file.
            Examined descriptor file OSGI-INF org.wso2.carbon.book.provider.internal.BookProviderServiceComponent.xml, with contents:

            <?xml version="1.0" encoding="UTF-8"?>
            <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.wso2.carbon.book.provider" activate="activate" deactivate="deactivate">    
                <implementation class="org.wso2.carbon.book.provider.internal.BookProviderServiceComponent"/>
                </scr:component>
            

            Examined the bundle's MANIFEST.MF file:

            MANIFEST.MF 
            Manifest-Version: 1.0
            Bnd-LastModified: 1688057846042
            Build-Jdk: 11.0.18
            Built-By: aloraine
            Bundle-Description: A book shelf for carbon
            Bundle-ManifestVersion: 2
            Bundle-Name: org.wso2.carbon.book.provider
            Bundle-SymbolicName: org.wso2.carbon.book.provider
            Bundle-Version: 1.0.0.SNAPSHOT
            Created-By: Apache Maven Bundle Plugin
            Export-Package: org.wso2.carbon.book.provider;uses:="org.wso2.carbon.boo
             k.provider.model";version="1.0.0.SNAPSHOT",org.wso2.carbon.book.provide
             r.model;version="1.0.0.SNAPSHOT"
            Import-Package: org.osgi.framework;version="[1.7.0,2.0.0)",org.osgi.serv
             ice.component;version="[1.2.0,2.0.0)"
            Service-Component: OSGI-INF/org.wso2.carbon.book.provider.internal.BookP
             roviderServiceComponent.xml
            Tool: Bnd-2.1.0.20130426-122213
            
            Show
            ann.loraine Ann Loraine added a comment - - edited Github link for the Book Inventory (second) tutorial: https://github.com/nipunaupeksha/osgi-book-inventory . Made a fork in my "aloraine" account on github: https://github.com/aloraine/osgi-book-inventory Cloned it to my local. Built jar files from the cloned project with: mvn package jar files: local aloraine$ find . | grep jar ./org.wso2.carbon.book.provider/target/org.wso2.carbon.book.provider-1.0-SNAPSHOT.jar ./org.wso2.carbon.book.reader/target/org.wso2.carbon.book.reader-1.0-SNAPSHOT.jar ./.idea/jarRepositories.xml Unpacked org.wso2.carbon.book.provider-1.0-SNAPSHOT.jar file. Examined descriptor file OSGI-INF org.wso2.carbon.book.provider.internal.BookProviderServiceComponent.xml, with contents: <?xml version= "1.0" encoding= "UTF-8" ?> <scr:component xmlns:scr= "http: //www.osgi.org/xmlns/scr/v1.1.0" immediate= " true " name= "org.wso2.carbon.book.provider" activate= "activate" deactivate= "deactivate" > <implementation class= "org.wso2.carbon.book.provider.internal.BookProviderServiceComponent" /> </scr:component> Examined the bundle's MANIFEST.MF file: MANIFEST.MF Manifest-Version: 1.0 Bnd-LastModified: 1688057846042 Build-Jdk: 11.0.18 Built-By: aloraine Bundle-Description: A book shelf for carbon Bundle-ManifestVersion: 2 Bundle-Name: org.wso2.carbon.book.provider Bundle-SymbolicName: org.wso2.carbon.book.provider Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: org.wso2.carbon.book.provider;uses:="org.wso2.carbon.boo k.provider.model ";version=" 1.0.0.SNAPSHOT",org.wso2.carbon.book.provide r.model;version= "1.0.0.SNAPSHOT" Import-Package: org.osgi.framework;version= "[1.7.0,2.0.0)" ,org.osgi.serv ice.component;version= "[1.2.0,2.0.0)" Service-Component: OSGI-INF/org.wso2.carbon.book.provider.internal.BookP roviderServiceComponent.xml Tool: Bnd-2.1.0.20130426-122213
            ann.loraine Ann Loraine made changes -
            Status First Level Review in Progress [ 10301 ] Needs 1st Level Review [ 10005 ]
            ann.loraine Ann Loraine made changes -
            Assignee Ann Loraine [ aloraine ]
            nfreese Nowlan Freese made changes -
            Status Needs 1st Level Review [ 10005 ] First Level Review in Progress [ 10301 ]
            nfreese Nowlan Freese made changes -
            Assignee Nowlan Freese [ nfreese ]
            ann.loraine Ann Loraine made changes -
            Sprint Summer 2 2023 May 29, Summer 3 2023 June 12 [ 171, 172 ] Summer 2 2023 May 29, Summer 3 2023 June 12, Summer 4 2023 June 26 [ 171, 172, 173 ]
            ann.loraine Ann Loraine made changes -
            Rank Ranked higher
            nfreese Nowlan Freese made changes -
            Status First Level Review in Progress [ 10301 ] Needs 1st Level Review [ 10005 ]
            ann.loraine Ann Loraine made changes -
            Link This issue relates to IGBF-3371 [ IGBF-3371 ]
            nfreese Nowlan Freese made changes -
            Status Needs 1st Level Review [ 10005 ] First Level Review in Progress [ 10301 ]
            ann.loraine Ann Loraine made changes -
            Comment [ Which version of OSGi service component runtime is being used here?
            I guess: v1.1.0.
            Is the same version as all the other OSGi framework parts and packages?
            Nope.
            From the manifest of above jar file:
            {code}
            Import-Package: org.osgi.framework;version="[1.7.0,2.0.0)",org.osgi.serv
             ice.component;version="[1.2.0,2.0.0)"
            Service-Component: OSGI-INF/org.wso2.carbon.book.provider.internal.BookP
             roviderServiceComponent.xml
            Tool: Bnd-2.1.0.20130426-122213
            {code} ]
            ann.loraine Ann Loraine made changes -
            Comment [ As noted above, I built the project using "mvn install", which copies the artifacts into my local .m2 maven repository.

            I then installed the karaf OSGi framework and attempted to install the bundles. However, the bundles failed to be resolved.

            See errors below:

            {code}
            karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT
            Bundle ID: 53
            Error executing command: Error installing bundles:
            Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [53](R 53.0): missing requirement [org.wso2.carbon.book.provider [53](R 53.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [53](R 53.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))]
            karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.reader/1.0-SNAPSHOT
            Bundle ID: 54
            Error executing command: Error installing bundles:
            Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.reader/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.reader [54](R 54.0): missing requirement [org.wso2.carbon.book.reader [54](R 54.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.reader [54](R 54.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))]
            karaf@root()>
            {code}



            ]
            ann.loraine Ann Loraine made changes -
            Comment [ I am using latest version of Apache karaf. Maybe I need to downgrade to a lower version of the framework.
            Trying 4.0.10 which supports OSGi release 5. ]
            ann.loraine Ann Loraine made changes -
            Comment [ I could load both the reader and provider bundles after loading org.osgi.service.component, with:

            {code}
            bundle:install -s mvn:org.osgi/org.osgi.service.component/1.5.1
            {code}

            This bundle is mentioned in the "import packages" section of the manifest.
            This bundle was present in my system, in my .m2 directory. Why didn't karaf load it automatically? ]
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Decided to try load these bundles into karaf.
            Downloaded and installed the latest version of karaf: 4.3.9
            Unpacked karaf "tarball" to a local directory and adding its "bin" directory to my path.
            Started karaf using JDK11 with:

            karaf debug
            

            This launches a command-line interface to the karaf environment.

            Next, I attempted to start the project bundles with:

            bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT
            karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT
            Bundle ID: 52
            Error executing command: Error installing bundles:
            	Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [52](R 52.0): missing requirement [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))]
            

            Note: the "-s" option also starts the bundle.

            Show
            ann.loraine Ann Loraine added a comment - - edited Decided to try load these bundles into karaf. Downloaded and installed the latest version of karaf: 4.3.9 Unpacked karaf "tarball" to a local directory and adding its "bin" directory to my path. Started karaf using JDK11 with: karaf debug This launches a command-line interface to the karaf environment. Next, I attempted to start the project bundles with: bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT Bundle ID: 52 Error executing command: Error installing bundles: Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [52](R 52.0): missing requirement [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring. package ; (&(osgi.wiring. package =org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring. package ; (&(osgi.wiring. package =org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))] Note: the "-s" option also starts the bundle.
            Hide
            ann.loraine Ann Loraine added a comment -

            As shown in the preceding comment, the framework lacks the required package org.osgi.service.component.

            Within karaf, I can check all the exported and available packages with:

            karaf@root()> exports | grep org.osgi  
            

            This lists 41 packages, including org.osgi.framework version 1.9.0, which satisfies the first import requirement listed in the bundle MANIFEST for org.wso2.carbon.book.provider.

            Show
            ann.loraine Ann Loraine added a comment - As shown in the preceding comment, the framework lacks the required package org.osgi.service.component. Within karaf, I can check all the exported and available packages with: karaf@root()> exports | grep org.osgi This lists 41 packages, including org.osgi.framework version 1.9.0, which satisfies the first import requirement listed in the bundle MANIFEST for org.wso2.carbon.book.provider.
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            I restart the karaf container, getting rid of any and all bundles and packages except the karaf framework's bundles and packages with:

            karaf clean 
            

            I check the number of packages with:

             
            karaf@root()> exports | wc -l
            807
            

            and the number of bundles with:

            karaf@root()> la | wc -l
            55
            

            and the number of user-installed (by me) bundles with:

            karaf@root()> list
            

            I then try to install the "provider" bundle again with:

            karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT                                                     
            Bundle ID: 52
            Error executing command: Error installing bundles:
            	Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [52](R 52.0): missing requirement [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))]
            

            and check the exported packages count again:

            karaf@root()> exports | wc -l
            809
            

            After trying to install this new bundle, I see there are two more packages being exported.

            They are from our project: org.wso2.carbon.book.provider.model and org.wso2.carbon.book.provider.

            However, the bundles are not started. I guess the packages are available for use? That's interesting.

            Let's check the imports for the "provider" bundle:

            karaf@root()> imports -b 52 --no-format
            org.osgi.framework        	[1.7.0,2.0.0)	        	52	org.wso2.carbon.book.provider
            org.osgi.service.component	[1.2.0,2.0.0)	        	52	org.wso2.carbon.book.provider
            

            Let's use "diag" to assess the problem:

            karaf@root()> diag
            org.wso2.carbon.book.provider (52)
            ----------------------------------
            Status: Installed
            Unsatisfied Requirements:
            [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))
            
            Show
            ann.loraine Ann Loraine added a comment - - edited I restart the karaf container, getting rid of any and all bundles and packages except the karaf framework's bundles and packages with: karaf clean I check the number of packages with: karaf@root()> exports | wc -l 807 and the number of bundles with: karaf@root()> la | wc -l 55 and the number of user-installed (by me) bundles with: karaf@root()> list I then try to install the "provider" bundle again with: karaf@root()> bundle:install -s mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT Bundle ID: 52 Error executing command: Error installing bundles: Unable to start bundle mvn:org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT: org.osgi.framework.BundleException: Unable to resolve org.wso2.carbon.book.provider [52](R 52.0): missing requirement [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring. package ; (&(osgi.wiring. package =org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring. package ; (&(osgi.wiring. package =org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))] and check the exported packages count again: karaf@root()> exports | wc -l 809 After trying to install this new bundle, I see there are two more packages being exported. They are from our project: org.wso2.carbon.book.provider.model and org.wso2.carbon.book.provider. However, the bundles are not started. I guess the packages are available for use? That's interesting. Let's check the imports for the "provider" bundle: karaf@root()> imports -b 52 --no-format org.osgi.framework [1.7.0,2.0.0) 52 org.wso2.carbon.book.provider org.osgi.service.component [1.2.0,2.0.0) 52 org.wso2.carbon.book.provider Let's use "diag" to assess the problem: karaf@root()> diag org.wso2.carbon.book.provider (52) ---------------------------------- Status: Installed Unsatisfied Requirements: [org.wso2.carbon.book.provider [52](R 52.0)] osgi.wiring. package ; (&(osgi.wiring. package =org.osgi.service.component)(version>=1.2.0)(!(version>=2.0.0)))
            Hide
            ann.loraine Ann Loraine added a comment -

            I located this package / artifact in my ".m2" directory and looked at its POM:

            local aloraine$ more org.osgi.service.component-1.5.1.pom
            <?xml version="1.0" encoding="UTF-8"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>org.osgi</groupId>
              <artifactId>org.osgi.service.component</artifactId>
              <version>1.5.1</version>
              <description>OSGi Companion Code for org.osgi.service.component Version 1.5.1</description>
              <name>org.osgi:org.osgi.service.component</name>
              <url>https://docs.osgi.org/</url>
              <organization>
                <name>Eclipse Foundation</name>
              </organization>
            ...
            
            Show
            ann.loraine Ann Loraine added a comment - I located this package / artifact in my ".m2" directory and looked at its POM: local aloraine$ more org.osgi.service.component-1.5.1.pom <?xml version= "1.0" encoding= "UTF-8" ?> <project xmlns= "http: //maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>org.osgi</groupId> <artifactId>org.osgi.service.component</artifactId> <version>1.5.1</version> <description>OSGi Companion Code for org.osgi.service.component Version 1.5.1</description> <name>org.osgi:org.osgi.service.component</name> <url>https: //docs.osgi.org/</url> <organization> <name>Eclipse Foundation</name> </organization> ...
            Hide
            ann.loraine Ann Loraine added a comment -

            Next, I installed this into my karaf session with:

            karaf@root()> bundle:install mvn:org.osgi/org.osgi.service.component
            Bundle ID: 55
            
            Show
            ann.loraine Ann Loraine added a comment - Next, I installed this into my karaf session with: karaf@root()> bundle:install mvn:org.osgi/org.osgi.service.component Bundle ID: 55
            Hide
            ann.loraine Ann Loraine added a comment -

            Summarizing the findings thus far:

            • karaf has many commands that help with detecting and solving errors, such as "import" and "export", which list packages being exported from or imported into various bundles
            • unix commands such as "grep" and "wc -l" are supported, making debugging faster and easier
            • the framework does not appear to contain service component infrastructure needed by this project
            Show
            ann.loraine Ann Loraine added a comment - Summarizing the findings thus far: karaf has many commands that help with detecting and solving errors, such as "import" and "export", which list packages being exported from or imported into various bundles unix commands such as "grep" and "wc -l" are supported, making debugging faster and easier the framework does not appear to contain service component infrastructure needed by this project
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            In the previous comment, I said "the framework does not appear to contain service component infrastructure needed by this project."

            This seems very strange!

            I found a Web page on karaf that mentioned some useful commands, include "feature:list".

            There are 174 "features" listed! One of these is "scr", with Description "Declarative Service support." Its current "State" is "Uninstalled."

            Maybe, if I somehow "install" this feature, I would not need to install the "org.osgi:org.osgi.service.component" bundle from my local "mvn" repository?

            So, I tried to install it with:

            karaf@root()> feature:install scr
            

            After this, the "scr" feature State changed to "Started."

            Show
            ann.loraine Ann Loraine added a comment - - edited In the previous comment, I said "the framework does not appear to contain service component infrastructure needed by this project." This seems very strange! I found a Web page on karaf that mentioned some useful commands, include "feature:list". There are 174 "features" listed! One of these is "scr", with Description "Declarative Service support." Its current "State" is "Uninstalled." Maybe, if I somehow "install" this feature, I would not need to install the "org.osgi:org.osgi.service.component" bundle from my local "mvn" repository? So, I tried to install it with: karaf@root()> feature:install scr After this, the "scr" feature State changed to "Started."
            Hide
            ann.loraine Ann Loraine added a comment -

            I then uninstalled the previously installed bundles. Freshly attempting to re-install and re-start bundle org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT succeeded without any error.

            I then quit and restarted karaf with a fresh, clean environment with "karaf clean".
            I confirmed that the "scr" feature was not active. I then activated it as before with "feature:install scr" and then tried to load the "provider" bundle.

            This time, it loaded without any error.

            Thus, karaf actually does contain support declarative services. You just have to install that feature within the framework to activate it, I guess.

            Show
            ann.loraine Ann Loraine added a comment - I then uninstalled the previously installed bundles. Freshly attempting to re-install and re-start bundle org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT succeeded without any error. I then quit and restarted karaf with a fresh, clean environment with "karaf clean". I confirmed that the "scr" feature was not active. I then activated it as before with "feature:install scr" and then tried to load the "provider" bundle. This time, it loaded without any error. Thus, karaf actually does contain support declarative services. You just have to install that feature within the framework to activate it, I guess.
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Trying now to figure out which version of declarative services / scr is used in this tutorial.

            I was able to build it using JDK 11 and run it in the latest version (4.3.9) of karaf, also running in JDK 11. This suggests that maybe the most up-to-date system for declarative services is being used?

            Upon consultation with Nowlan Freese, we realized that the only way to be truly sure about this is to look at the package import statements in the code.

            Investigating the code:

            package org.wso2.carbon.book.provider.internal;
            
            import org.osgi.framework.BundleContext;
            import org.osgi.service.component.ComponentContext;
            import org.osgi.service.component.annotations.Activate;
            import org.osgi.service.component.annotations.Component;
            import org.osgi.service.component.annotations.Deactivate;
            import org.wso2.carbon.book.provider.BookProvider;
            import org.wso2.carbon.book.provider.BookProviderImpl;
            
            import java.util.logging.Logger;
            
            @Component(
                    name = "org.wso2.carbon.book.provider",
                    immediate = true
            )
            
            Show
            ann.loraine Ann Loraine added a comment - - edited Trying now to figure out which version of declarative services / scr is used in this tutorial. I was able to build it using JDK 11 and run it in the latest version (4.3.9) of karaf, also running in JDK 11. This suggests that maybe the most up-to-date system for declarative services is being used? Upon consultation with Nowlan Freese , we realized that the only way to be truly sure about this is to look at the package import statements in the code. Investigating the code: package org.wso2.carbon.book.provider.internal; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.wso2.carbon.book.provider.BookProvider; import org.wso2.carbon.book.provider.BookProviderImpl; import java.util.logging.Logger; @Component( name = "org.wso2.carbon.book.provider" , immediate = true )
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Now, looking at Component imports in an IGB project (master branch, jdk 1.8 build):

            • ./core/igb-services-api/src/main/java/org/lorainelab/igb/services/search/SearchModeRegistry.java

            imports and Component annotation:

            import aQute.bnd.annotation.component.Component;
            import aQute.bnd.annotation.component.Reference;
            ...
            @Component(name = SearchModeRegistry.COMPONENT_NAME, immediate = true, provide = SearchModeRegistry.class)
            

            Our project (IGB) does not appear to be using felix scr but instead is using something perhaps even older - annotations from package aQute.bnd.annotation.component.

            Show
            ann.loraine Ann Loraine added a comment - - edited Now, looking at Component imports in an IGB project (master branch, jdk 1.8 build): ./core/igb-services-api/src/main/java/org/lorainelab/igb/services/search/SearchModeRegistry.java imports and Component annotation: import aQute.bnd.annotation.component.Component; import aQute.bnd.annotation.component.Reference; ... @Component(name = SearchModeRegistry.COMPONENT_NAME, immediate = true , provide = SearchModeRegistry.class) Our project (IGB) does not appear to be using felix scr but instead is using something perhaps even older - annotations from package aQute.bnd.annotation.component.
            nfreese Nowlan Freese made changes -
            Assignee Nowlan Freese [ nfreese ] Ann Loraine [ aloraine ]
            ann.loraine Ann Loraine made changes -
            Status First Level Review in Progress [ 10301 ] Ready for Pull Request [ 10304 ]
            ann.loraine Ann Loraine made changes -
            Status Ready for Pull Request [ 10304 ] Pull Request Submitted [ 10101 ]
            ann.loraine Ann Loraine made changes -
            Status Pull Request Submitted [ 10101 ] Reviewing Pull Request [ 10303 ]
            ann.loraine Ann Loraine made changes -
            Status Reviewing Pull Request [ 10303 ] Merged Needs Testing [ 10002 ]
            ann.loraine Ann Loraine made changes -
            Status Merged Needs Testing [ 10002 ] Post-merge Testing In Progress [ 10003 ]
            ann.loraine Ann Loraine made changes -
            Resolution Done [ 10000 ]
            Status Post-merge Testing In Progress [ 10003 ] Closed [ 6 ]
            ann.loraine Ann Loraine made changes -
            Assignee Ann Loraine [ aloraine ] Kaushik Gopu [ kgopu ]

              People

              • Assignee:
                kgopu Kaushik Gopu
                Reporter:
                nfreese Nowlan Freese
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: