4 Replies Latest reply on Feb 13, 2013 6:36 AM by jrantav

    Specify maven repository for OSGI capability resolution?

    jye.tucker Newbie

      We are using Maven coordinates for installing additional OSGI subsystem capabilities.


      For example...


      <capability name="org.eclipse.persistence:javax.persistence:2.0.3" startlevel="2"/>


      This resolves from the local maven repository perfectly, but is there any way to specify a remote repository URL/username/password where the artifacts should be resolved from?


      Including a profile with the repositories in settings.xml doesn't appear to have any effect.




        • 1. Re: Specify maven repository for OSGI capability resolution?
          jye.tucker Newbie

          It looks like the local repo, central and the JBoss repo are hardcoded in org.jboss.osgi.repository.core.MavenArtifactProvider.

          I can't think of a logical place where additional repos could be defined. If someone can give me some direction on how this should be implemented, I'm happy to do a patch.

          • 2. Re: Specify maven repository for OSGI capability resolution?
            Eran Kazula Newbie



            I seem to be facing an issue "of the same neighborhood". I'm trying to add the following 2 "pax-web" OSGI capabilities (in the 'standalone.xml'):


                            <capability name="org.ops4j.pax.web:pax-web-jsp:1.1.2"/>

                            <capability name="org.ops4j.pax.web:pax-web-jetty-bundle:1.1.2"/>


            When JBoss AS starts-up, the "org.jboss.osgi.repository.core.MavenArtifactProvider" tries to resolve the location of these capabilities from my local repository (c:\Documents and Settings\eran\.m2\...). For some reason, although the JAR resource files of these capabilities DO exist in my local repository, I'm seeing that the resolution is attempted twice - first the tries to read the resource files from the actual local repository location "c:\Documents and Settings\eran\.m2" and immidiately after it attempts to escape the spaces from the URI and re-read the resources files from "c:\Documents%20and%20Settings\eran\.m2" (putting the percent-sign20 instead of the actual spaces). This causes the following exception:


            15:14:19,796 INFO  [org.jboss.osgi.repository.core.RepositoryImpl] (MSC service thread 1-3) find providers for: AbstractRequirement[maven.identity,attributes={maven.identity=org.ops4j.pax.web:pax-web-jsp:jar:1.1.2}]

            15:14:19,843 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jbosgi.AutoInstallProvider: org.jboss.msc.service.StartException in service jbosgi.AutoInstallProvider: JBAS011964: Failed to create auto install list

                      at org.jboss.as.osgi.service.AutoInstallIntegration.start(AutoInstallIntegration.java:190)

                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_22]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_22]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_22]

            Caused by: org.jboss.osgi.repository.RepositoryResolutionException: java.lang.IllegalStateException: java.io.FileNotFoundException: C:\Documents%20and%20Settings\eran\.m2\repository\org\ops4j\pax\web\pax-web-jsp\1.1.2\pax-web-jsp-1.1.2.jar (The system cannot find the path specified)

                      at org.jboss.osgi.repository.core.MavenArtifactProvider.findProviders(MavenArtifactProvider.java:95)

                      at org.jboss.osgi.repository.core.TrackingArtifactProvider.findProviders(TrackingArtifactProvider.java:56)

                      at org.jboss.osgi.repository.core.RepositoryImpl.findProviders(RepositoryImpl.java:62)

                      at org.jboss.as.osgi.service.AutoInstallIntegration.installModule(AutoInstallIntegration.java:225)

                      at org.jboss.as.osgi.service.AutoInstallIntegration.start(AutoInstallIntegration.java:155)


            The funny thing is that if I delete these resource files from my local repository, the everything works fine! (which I'm assuming means that the resolution of these capabilities gets done from JBoss' repository).


            Is this a bug of some sort or is there a work-around (aside from perhaps changing my local repository to a location that does not contain spaces)?




            • 3. Re: Specify maven repository for OSGI capability resolution?
              Ranis MK Newbie

              Thanks Eran for sharing your findings. I was also suffering from the same problem ( FileNotFoundException in maven repos). I could resolve it by deleting those files from maven repos, as you said.



              Ranis MK

              • 4. Re: Specify maven repository for OSGI capability resolution?
                jrantav Novice

                I wonder is there documentation about this feature? I waasn't able to find any. I seem to recollect faintly that this autoinstall would not actally install the stuff permanently (in the module structure or deployments), but haven't seen info on that either.