5 Replies Latest reply on Oct 24, 2012 9:02 PM by ffang

    Moving security from normal Java to OSGi

    ranajitjana

      I am not able to solve the below issue and running out of options.

      We are using Ingrian for all our security requirement. thus some jars are provided by Ingrian. This is woking find in normal java environment but does not work as soon as I am in OSGi environment.

       

      One of the error is coming while trying to set the provider is "no manifiest section for signature file entry" . Looking where the error is coming from I realise that this is coming from rt.jar file or from sun.security.util.SignatureFileVerifier.

       

      The Meta-INF file is OSGi specific manifest file and have all the entries for signature too. Not sure if it is conflicting.

       

      I am also facing problems as the Security provider jar has references where it is trying to load the properties with help of the jar path found.

      int index = file.lastIndexOf("IngrianNAE.jar");

          if (index > 0)

          {

            parseConfig(file.substring(5, index) + "IngrianNAE.properties");

          }

          else

          {

            index = file.lastIndexOf("IngrianProvider.class");

            if (index > 0)

              parseConfig(file.substring(0, index) + "IngrianNAE.properties");

            else

              parseConfig(null);

          }

       

      clearly I am getting the path as maven path like mvn:artifactid:groupid/version( as per other program in OSGi) thus its failing.

       

      So there are two issues I have no control over the jars as they are given by the provider. Anybody have faced the issue. Any solutions ?

        • 1. Re: Moving security from normal Java to OSGi
          ranajitjana

          I have put all the jars given by the provider to jre location i.e jre/lib/ext and compiling the bundles with these . This way jars are normal jar file and not OSGi bundle.

           

          I hoped this could have resolved the issues as it will start behaving like normal java files without wiring or OSGi environment.

           

          It is still not able to load the properties files as per the same code above.Error as below

          (java.lang.NoClassDefFoundError: Could not initialize class com.ingrian.internal.config.Config)

           

          I have no way to debug this code to know what is going on. I tried decompiling the jars and put it in the attach source in eclipse if it could help.

           

          Jre classes are not loaded as bundles (at least what i see from web console) . Any idea how the JRE classes behaves in FUSEESB server. Is it like normal java or a wired environment.

          These provider jars work perfectly ok from normal JVM or Tomcat etc. only does not run in OSGi environment

          • 2. Re: Moving security from normal Java to OSGi
            ranajitjana

            Found that JRE packages are exposed by System Bundle (0) (org.apache.felix.framework) thus everything is wrapped in bundle in Karaf. That infers that all the path will be represened as Mvn:artifact:grp:version.

            • 3. Re: Moving security from normal Java to OSGi
              ffang

              Hi,

               

              For the security providers in OSGi/Karaf, please take a look at[1], the "Deploying security providers" chapter.

               

              http://karaf.apache.org/manual/latest-2.3.x/users-guide/security.html

               

              Freeman

              • 4. Re: Moving security from normal Java to OSGi
                ranajitjana

                Actually my question will be as simple as how do i pick up properties in OSGi bundle.

                 

                blueprint/OSGi/Spring properties gets picked by the container. If i have custom plain properties which I want to read . Is there a way?

                 

                On similar grounds how do i access any other resources in java code.

                 

                one way of putting that is put it in the etc directory and read via blueprint tags with the namespace(http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0) That way I just cannot run the bnd too to make the osgi bundle. There are other resources what are the key files . may be everything needs to go to etc folder.

                 

                I hope there was a easier solution for external jars

                 

                Regards

                • 5. Re: Moving security from normal Java to OSGi
                  ffang

                  Hi,

                   

                  Yeah, you hit the point, I'd say in OSGi world, using ConfigAdmin OSGi service to manage the properties is the standard and recommended way.

                   

                  Freeman