Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Can't get P2 to load remote repository(works Fine for local repo)
Can't get P2 to load remote repository [message #895326] Thu, 12 July 2012 13:00 Go to next message
abadamcd1 abadamcd1 is currently offline abadamcd1 abadamcd1
Messages: 40
Registered: December 2011
Member
So I can load a locally generated repository just fine with the code below. However, using an http uri, it will always fail whenever I try the manager.loadRepository method. Why is this? Note, I've also tried loading eclipse repos and get the same sorts of errors.

//updateURI = new URI("http://localhost/wupdate/");
updateURI = new URI("file:/var/www/wupdate/");


ServiceReference<?> sr = Activator.getContext().getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
IProvisioningAgentProvider agentProvider = null;
if (sr == null)
  return;
agentProvider = (IProvisioningAgentProvider) Activator.getContext().getService(sr);
final IProvisioningAgent agent = agentProvider.createAgent(new URI("file:/home/adam/Desktop/wunderNet444/Wunderkind/p2/"));


//get the repository managers and define our repositories
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
manager.addRepository(updateURI);
artifactManager.addRepository(updateURI);

//Load and query the metadata
IMetadataRepository metadataRepo = manager.loadRepository(updateURI, new NullProgressMonitor());
System.out.println("IU LIST");
Collection<IInstallableUnit> toInstall = metadataRepo .query(QueryUtil.createIUAnyQuery(),
	   new NullProgressMonitor()).toUnmodifiableSet();
java.util.List<IInstallableUnit> list = new ArrayList<IInstallableUnit>(toInstall);
Collections.sort(list);

for(IInstallableUnit iu : list){
   if(true /*iu.toString().contains("com.mnet")*/){
	   System.out.println(iu.getId());
   }
}



First part of the error I get
Caused by: java.lang.NullPointerException
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadIndexFile(AbstractRepositoryManager.java:721)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:640)
	at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96)
	at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92)
	at com.mnet.wunderkind.updatemanager.UpdateManager.update(UpdateManager.java:54)

[Updated on: Thu, 12 July 2012 13:09]

Report message to a moderator

Re: Can't get P2 to load remote repository [message #895399 is a reply to message #895326] Thu, 12 July 2012 17:15 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal Rapicault
Messages: 290
Registered: July 2009
Location: Ottawa
Senior Member
Make sure to have the bundle org.eclipse.equinox.p2.transport.ecf as part of the system you are starting.
Re: Can't get P2 to load remote repository [message #895413 is a reply to message #895399] Thu, 12 July 2012 18:46 Go to previous message
abadamcd1 abadamcd1 is currently offline abadamcd1 abadamcd1
Messages: 40
Registered: December 2011
Member
Hmm, I figured out out. When I added that package above to my feature I realized that my p2 feature group wasn't added to my runtime (even though it was added to my product configuration).

On another note, I can add the package you mentioned, but I can't seem to find it on the indigo api documentation site. Be nice to know what it's for, but I can't see anything about it.
Previous Topic:Running update manager from command line in Juno
Next Topic:DBTools and P2
Goto Forum:
  


Current Time: Thu Oct 30 16:48:33 GMT 2014

Powered by FUDForum. Page generated in 0.01558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software