You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by e9...@seznam.cz on 2015/04/20 00:51:50 UTC

plexusContainer.lookup fail when looking for Wagon.class

Hello could somebody tell me what I am doing wrong?



this is my code>





PlexusContainer plexusContainer;

Indexer indexer;

IndexUpdater indexUpdater;

IndexingContext indexingContext;

Wagon httpWagon;




try {

DefaultContainerConfiguration config = new DefaultContainerConfiguration();

config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);

plexusContainer = new DefaultPlexusContainer(config);




ClassWorld world = new ClassWorld();

ClassRealm classRealm = new ClassRealm(world, "myWorld", getClass().
getClassLoader());

config.setRealm(classRealm);




plexusContainer = new DefaultPlexusContainer(config);

indexer = plexusContainer.lookup(Indexer.class);

indexUpdater = plexusContainer.lookup(IndexUpdater.class);

httpWagon = plexusContainer.lookup(Wagon.class, "http");




} catch (Exception e) {

logger.error("Error initializing Plexus container.", e);

throw new IllegalStateException(e);

}










indexer, and indexUpdater is resolved...but I will got exception on 
httpWagon>





org.codehaus.plexus.component.repository.exception.ComponentLookupException:
java.util.NoSuchElementException

      role: org.apache.maven.wagon.Wagon

  roleHint: http

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.
java:266) ~[org.eclipse.sisu.plexus_0.2.1.jar:na]

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.
java:254) ~[org.eclipse.sisu.plexus_0.2.1.jar:na]





any ideas why??? It will will on looking for Indexer.class if I will remove 
the ClassWorld and ClassRealm....




but in MavenIndexer examples...it works as charm even without ClassWorlds 
and ClassRealm..

Re: plexusContainer.lookup fail when looking for Wagon.class

Posted by e9...@seznam.cz.
SOLVED




- the problem was in missing Embed-Dependency:  wagon-http-lightweight




 in  osgi.bnd file




Regards

MB



---------- Původní zpráva ----------
Od: e92-330cd@seznam.cz
Komu: users@maven.apache.org
Datum: 20. 4. 2015 0:51:49
Předmět: plexusContainer.lookup fail when looking for Wagon.class

"
Hello could somebody tell me what I am doing wrong?



this is my code>





PlexusContainer plexusContainer;

Indexer indexer;

IndexUpdater indexUpdater;

IndexingContext indexingContext;

Wagon httpWagon;




try {

DefaultContainerConfiguration config = new DefaultContainerConfiguration();

config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);

plexusContainer = new DefaultPlexusContainer(config);




ClassWorld world = new ClassWorld();

ClassRealm classRealm = new ClassRealm(world, "myWorld", getClass().
getClassLoader());

config.setRealm(classRealm);




plexusContainer = new DefaultPlexusContainer(config);

indexer = plexusContainer.lookup(Indexer.class);

indexUpdater = plexusContainer.lookup(IndexUpdater.class);

httpWagon = plexusContainer.lookup(Wagon.class, "http");




} catch (Exception e) {

logger.error("Error initializing Plexus container.", e);

throw new IllegalStateException(e);

}










indexer, and indexUpdater is resolved...but I will got exception on 
httpWagon>





org.codehaus.plexus.component.repository.exception.ComponentLookupException:
java.util.NoSuchElementException

      role: org.apache.maven.wagon.Wagon

  roleHint: http

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.
java:266) ~[org.eclipse.sisu.plexus_0.2.1.jar:na]

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.
java:254) ~[org.eclipse.sisu.plexus_0.2.1.jar:na]





any ideas why??? It will will on looking for Indexer.class if I will remove 
the ClassWorld and ClassRealm....




but in MavenIndexer examples...it works as charm even without ClassWorlds 
and ClassRealm..

"