13 Replies Latest reply on Jan 4, 2013 12:32 PM by komododave

    Newly added Maven artifact not found

    komododave

      Thanks to Stan Lewis we've just had our first FAB successfully installed - well, almost successfully.

       

      One of the dependencies for it was missing from our Maven repo in Sonatype Nexus. We've deployed this, but having stopped and started the relevant Fabric container to re-provision it we now receive the following:

       

      2013-01-04 11:46:28,747 | WARN  | agent-1-thread-1 | MavenResolverImpl                | rce.fabric.fab.MavenResolverImpl  422 | 67 - org.fusesource.fabric.fabric-agent - 7.1.0.fuse-047 | Failed to resolve dependency of com.anon:the-artifact:jar:1.0-SNAPSHOT. Failed to collect dependencies for com.anon:the-artifact:jar:1.0-SNAPSHOT (compile)

       

      This is followed by:

       

      Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.anon:the-artifact:pom:1.0-SNAPSHOT from repos1 (http://fabric-host:8181/maven/download/): Error transferring file: Connection refused

       

      Question 1

       

      Would this indicate that something in fabric needs refreshing, and it's looking in http://fabric-host:8181/maven/download/ as a fallback?

       

      My best guess as to what's occurring is: fabric's grabbing the artifact we specified successfully, as well as its dependencies, from our Sonatype Nexus repo. These are cached in ~/.m2/repository as is the Maven standard. Then it OSGi-fies the JARs, and because the artifact signature (groupId, artifactId, version, packaging) is the same, fabric uses a separate location to store these bundles. Then the host:8181/maven/download URI refers to this non-standard location, and for some reason our configuration means this is inaccessible.

       

      If you could confirm/deny the above and suggest what might be wrong, I'd be very grateful.

       

      Question 2

       

      Where can we find documentation for this /maven/download URI? We've seen mention of it in the forums for uploading artifacts to install them into the fabric host's local Maven repo, but would like to understand the specifics of what's providing it and what filesystem location it should enable access to.

       

      I've searched most of the Fuse ESB 7.1 docs and all of the FMC docs for it and can find no mention.

        • 1. Re: Newly added Maven artifact not found
          komododave

          Regarding Question 1 above:

           

          Since we use Virtual IPs we configured a custom $/etc/jetty.xml which specifies a host that is the VIP.

           

          We've temporarily eliminated this custom configuration and now we receive the error printed at the bottom of this post.

           

          Looking in file:/home/our-VIP/.m2/repository/the/groupId/the-artifactId/1.0-SNAPSHOT we see just one file called resolver-status.properties.

           

          This contains:

           

          maven-metadata-repos1.xml.error=

          maven-metadata-repos0.xml.error=

          maven-metadata-repos1.xml/default-http\://fabric-host\:8181/maven/download/.lastUpdated=1357295801640

          maven-metadata-repos1.xml.lastUpdated=1357298894987

          maven-metadata-repos0.xml.lastUpdated=1357295302142

          maven-metadata-ocado-maven-snapshots.xml.lastUpdated=1357295302548

          maven-metadata-repos2.xml.error=

          maven-metadata-repos2.xml.lastUpdated=1357295321954

          maven-metadata-ocado-maven-snapshots.xml.error=

          load/)\: Error transferring file\: Connection refused

          maven-metadata-ocado-maven-snapshots.xml.error=

          maven-metadata-repos2.xml.error=

           

          Any suggestions what's going wrong? As mentioned in the OP these errors we see relate to a dependency of the FAB we specify, therefore we know that is resolved successfully and retrieved from Nexus. The Connection refused mentioned in the above file refers to the http://fabric-host:8181/maven/download URI so some configuration is still amiss and causing this URI to be inaccessible.

           

          In case it's relevant, our test container setup is simply a lone ensemble node root which has the fmc profile applied to it. The container we attempt to provision with our FAB is a child container of root.

           

          Here's the error we see in FMC, mentioned at the top of this post:

           

          Provision Exception Trace: java.io.IOException: Could not find artifact the.groupId:the-artifactId:jar:1.0-SNAPSHOT in repos0 (file:/home/our-VIP/.m2/repository/)

              at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.getInfo(FabResolverFactoryImpl.java:260)

              at org.fusesource.fabric.agent.DeploymentAgent.updateDeployment(DeploymentAgent.java:517)

              at org.fusesource.fabric.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:428)

              at org.fusesource.fabric.agent.DeploymentAgent$1.run(DeploymentAgent.java:238)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

              at java.util.concurrent.FutureTask.run(FutureTask.java:138)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(Thread.java:662)

          Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact the.groupId:the-artifactId:jar:1.0-SNAPSHOT in repos0 (file:/home/our-VIP/.m2/repository/)

              at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:488)

              at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:190)

              at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:250)

              at org.fusesource.fabric.fab.MavenResolverImpl.resolveFile(MavenResolverImpl.java:187)

              at org.fusesource.fabric.fab.DependencyTree.newInstance(DependencyTree.java:139)

              at org.fusesource.fabric.fab.DependencyTree.newInstance(DependencyTree.java:131)

              at org.fusesource.fabric.fab.DependencyTreeResult.getTree(DependencyTreeResult.java:49)

              at org.fusesource.fabric.fab.MavenResolverImpl.collectDependencies(MavenResolverImpl.java:383)

              at org.fusesource.fabric.fab.MavenResolverImpl.collectDependenciesFromPom(MavenResolverImpl.java:291)

              at org.fusesource.fabric.fab.MavenResolverImpl.collectDependencies(MavenResolverImpl.java:263)

              at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.collectDependencyTree(FabResolverFactoryImpl.java:149)

              at org.fusesource.fabric.fab.osgi.internal.FabClassPathResolver.resolve(FabClassPathResolver.java:136)

              at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.configureInstructions(FabResolverFactoryImpl.java:283)

              at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.createInstructions(FabResolverFactoryImpl.java:275)

              at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.getInfo(FabResolverFactoryImpl.java:245)

              ... 9 more

          Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact the.groupId:the-artifactId:jar:1.0-SNAPSHOT in repos0 (file:/home/our-VIP/.m2/repository/)

              at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:854)

              at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:849)

              at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:602)

              at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:596)

              at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.get(WagonRepositoryConnector.java:355)

              at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:407)

              ... 23 more

          • 2. Re: Newly added Maven artifact not found
            davsclaus

            We have some Maven Proxy docs at

            http://fuse.fusesource.org/fabric/docs/fabric-maven-proxy.html

             

            Maybe there is some help there?

             

            Though I guess maybe Ioannis or Stan may know more about how FAB does its runtime provision and which maven repos are in play.

            • 3. Re: Newly added Maven artifact not found
              komododave

              Thank you davsclaus - we're aware of this documentation and have followed it. We know that the maven proxy setup is correct (at the very least mostly correct) because as mentioned the original FAB artifact we specify must be resolved correctly from our Maven proxy, since this error we see relates to a dependency of it that can only be known by fabric from the FAB's POM.

               

              EDIT: We searched the page you linked for maven/download and found nothing so dismissed it - however upon further inspection it mentions an analagous maven/upload URI so we'll now read it more carefully. Thank you. I don't recall this information being on the page when I've visited it previously, I wonder whether we missed it or whether it's been updated.

              • 4. Re: Newly added Maven artifact not found
                komododave

                Another update: the VIP's home directory .m2/repository location contains a directory tree for the FAB we specify, but not the JAR or POM. Instead, this artifact's folder also contains a resolver-status.properties equivalent to that we see for its dependency.

                 

                It contains some other files as well:

                 

                    maven-metadata-repos1.xml

                    maven-metadata-repos1.xml.sha1

                    maven-metadata-repos2.xml

                    maven-metadata-repos2.xml.sha1

                 

                These contain metadata which could only have been identified from Nexus, namely the snapshot versions. For example, the second XML file listed above contains:

                 

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <metadata modelVersion="1.1.0">

                  <groupId>com.anon</groupId>

                  <artifactId>the-artifact</artifactId>

                  <version>1.0-SNAPSHOT</version>

                  <versioning>

                    <snapshot>

                      <timestamp>20121231.142650</timestamp>

                      <buildNumber>1</buildNumber>

                    </snapshot>

                    <lastUpdated>20121231142650</lastUpdated>

                    <snapshotVersions>

                      <snapshotVersion>

                        <extension>jar</extension>

                        <value>1.0-20121231.142650-1</value>

                        <updated>20121231142650</updated>

                      </snapshotVersion>

                      <snapshotVersion>

                        <extension>pom</extension>

                        <value>1.0-20121231.142650-1</value>

                        <updated>20121231142650</updated>

                      </snapshotVersion>

                    </snapshotVersions>

                  </versioning>

                </metadata>

                 

                We'd really appreciate help with this, since as mentioned we can't find any documentation on the maven/download URI nor how it's configured. As well as searching the doc PDFs I mentioned in a previous post I've run a find . | xargs -n 1 grep 'maven/download' in the Fabric installation directory and nothing was found besides messages in the logs.

                 

                EDIT: Well some Googling has finally  turned up the /maven/download URI. We'll now inspect this class to glean what we can.

                 

                EDIT2: Not much that helps us in there unfortunately. We can see what the class is doing but it sheds no light on our problem.

                • 5. Re: Newly added Maven artifact not found
                  stlewis

                  Hmm, off the top of my head am not sure.  the maven/download URL used by the fabric agent is from our fabric maven proxy.  Best doc for configuration is it's own blueprint XML file, namely the entries under the propery placeholder.  The interesting bit here is the "remoteRepositories" setting.  Now this is set out of the box using a placeholder so that the fabric maven proxy inherits the same settings as the fabric agent does, if you have a look at the "fabric" profile in FMC and go to "Configuration" you should see org.fusesource.fabric.maven.properties in there, and you'll also see the placeholder.

                   

                  Have you tried just deleting that file to see if a re-attempt is made to download that artifact?  Also, did you ensure that the root container's resolver is set appropriately to your VIP address?  This would affect the URL that the agent uses to download artifacts from our proxy.

                  • 6. Re: Newly added Maven artifact not found
                    komododave

                    Thanks for replying, Stan.

                     

                    We tried changing the resolver on root to the VIP's IP address through FMC and re-provisioning the FAB container to no avail. We also tried this after deleting the artifact in the VIP's ~/.m2/repository local repo but again it didn't work.

                     

                    As a failsafe we're going to try recreating the fabric from scratch (it's a breeze with our Puppet + Cucumber setup) and set the resolver as params to fabric:create

                     

                    Quick question about this:

                     

                    There are two params available on fabric:create - one is --global-resolver and the other is --resolver.

                     

                    We want to specify the manualip for each of these.

                     

                    Does this require a --manual-ip argument for both parameters? The help documentation for fabric:create is unclear.

                     

                    So I'm asking if this is correct:

                     

                    --global-resolver manualip --manual-ip 1.2.3.4 --resolver manualip 1.2.3.4

                     

                    UPDATE:

                     

                    Well we've tried the above and the parameter construction is correct it seems.

                     

                    The resolver appears correctly in FMC as manualip and the Manual IP entry is what we've specified, which is certainly the VIP's current IP address.

                     

                    Sadly we receive the same error as before, indicating the FAB's dependency can't be found in the VIP's ~/.m2/repository. Once again this local repo contains a directory tree for both the FAB artifact and this dependency, yet each only contains a resolver-status.properties under it along with the XML metadata I mentioned earlier for the FAB:

                     

                    Provision Exception Trace: java.io.IOException: Could not find artifact com.anon:FAB-dependency-artifactId:jar:1.0-SNAPSHOT in repos0 (file:/home/theVIP/.m2/repository/)

                        at org.fusesource.fabric.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.getInf

                    <snip>...</snip>

                    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact com.anon:FAB-dependency-artifactId:jar:1.0-SNAPSHOT in repos0 (file:/home/theVIP/.m2/repository/)

                    • 7. Re: Newly added Maven artifact not found
                      komododave

                      Ok so we may be making progress.

                       

                      When we redeployed the fabric with the VIP's IP manually specified as the resolver, we hadn't deleted the local artifact directory trees under the VIP's ~/.m2/repository.

                       

                      We tried this before recreating the fabric and it made no difference.

                       

                      However, with this fresh fabric deployment with the manual IP specified (which initially made no difference as mentioned in my previous post) we've just deleted the maven local repo dir trees for the FAB artifact and its dependency, and now we see the following.

                       

                      It looks like we've reached the next stage and this is stating that it can't find appropriate versions of these dependencies, correct?

                       

                      These listed packages aren't dependencies of our FAB, but may be transitive dependencies; I'll have a look now.

                       

                      Provision Exception Trace: java.lang.Exception: Can not resolve feature:

                      Unsatisfied requirement(s):

                      -


                      package:(&(package=javax.transaction.xa)(version>=5.5.1)(!(version>=6.0.0)))

                      com.anon.our-fab

                      package:(&(package=org.apache.activemq)(version>=5.5.1)(!(version>=6.0.0)))

                      com.anon.our-fab

                      package:(&(package=javax.jms)(version>=5.5.1)(!(version>=6.0.0)))

                      com.anon.our-fab

                       

                          at org.fusesource.fabric.agent.ObrResolver.resolve(ObrResolver.java:200)

                          at org.fusesource.fabric.agent.DeploymentAgent.updateDeployment(DeploymentAgent.java:554)

                          at org.fusesource.fabric.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:428)

                          at org.fusesource.fabric.agent.DeploymentAgent$1.run(DeploymentAgent.java:238)

                          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

                          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                          at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                          at java.lang.Thread.run(Thread.java:662)

                      • 8. Re: Newly added Maven artifact not found
                        stlewis

                        So the "global" resolver is the default value to be used for all containers, i.e. it sets the default resolver policy that will be used if you don't specify one.

                         

                        The "local" resolver is a per-container setting.  In the case of manualip you really can't set the "global" resolver to manualip, as that would mean all containers whether local or on remote machines would try and advertise whatever the manualip setting is.

                         

                        Now, child containers are a special case.  They'll use the same resolver policy as the parent.  So if you set the global policy to localhostname but then set the local resolver to manualip, the child container will inherit the root container's local resolver setting and use the same IP address.

                         

                        Did you maybe try bumping up the logging on both the root and child container to see if it yeilds any more information?

                         

                        Also, might be worth taking a step back and see if you can get the FAB to deploy alright in a standalone non-fabric container just to validate that it should deploy alright...

                        • 9. Re: Newly added Maven artifact not found
                          stlewis

                          Yeah, that's a good sign I think.  Looks like you could make your profile a child of the activemq-client profile as well which should pull in those feature repositories, though maybe check and make sure you're building your bundle against the same version of activemq that we ship in the ESB.

                          • 10. Re: Newly added Maven artifact not found
                            komododave

                            Great, thank you for confirming this Stan, and for giving us the missing link! What would we do without you... cry in a corner probably.

                             

                            Is it the case that each OSGi-fied dependency of the FAB is translated to a feature by Fabric?

                             

                            We'll consider what you've kindly informed us regarding resolvers below, and respond once we've digested this.

                            • 11. Re: Newly added Maven artifact not found
                              stlewis

                              Yes, exactly.  Basically FAB tries to map maven dependencies to ESB features.  I think if you have a bundle that's a dependency that has no feature definition then you just need to ensure it's installed, or add it to the profile and the agent's OBR resolver figures out that it needs to be installed.

                              • 12. Re: Newly added Maven artifact not found
                                komododave

                                Thank you for this explanation, Stan. We've now removed the global resolver parameter and left only the local one.

                                 

                                We'll try bumping the log level now and see what information it provides. Presumably as you say in your other post, all we need is the missing feature repos now. We'll try to find these and add them to the default profile, this seems more sensible than adding other profiles since there's no overhead from additional features running. Please let me know if you think otherwise.

                                 

                                The FAB is an existing application JAR we have running in Production, so is known to deploy successfully, thank you for the suggestion though.

                                 

                                EDIT: Ah, given your comment above "..maps to ESB features... I'll try with the ESB profile as you recommended instead

                                • 13. Re: Newly added Maven artifact not found
                                  komododave

                                  Ok so there's no difference with the fuse-esb-minimal profile added, however with fuse-esb-medium added (which has one additional features repo in it compared with ..-minimal) one of the dependency errors disappears. This is good news, it's evidence we're close to getting the FAB installed! There are no additional feature repos in fuse-esb-full compared to ..-medium hence why we didn't try it.

                                   

                                  We'll now seek public feature/bundle repositories containing the dependencies we need, or else manually install them as you've said.

                                   

                                  Do you know of a list of such feature/bundle repositories? I've read somewhere that bundle repos exist for many common Java dependencies, but a quick Google search for 'karaf feature repositories' hasn't turned up anything useful.

                                   

                                  We'd like to reserve the manual installation route as a last resort, since we'll be creating unnecessary work for ourselves in the future if we're missing many dependency features which are available in a public repository we're unaware of.

                                   

                                  Presumably all those you know about have been added to the fuse-esb profiles.

                                   

                                  EDIT: We seem to be finding a few OBRs from Googling at least. One of the best is on the Apache Felix site.

                                   

                                  EDIT2: Ah, it seems a "virtual OBR" is the way forward. See  here.