Tried with :
private void doPackaging(List<String> pagePaths) throws IOException, JSONException, RepositoryException, LoginException {
List<org.apache.jackrabbit.vault.fs.api.PathFilterSet> pathFilterSets = new ArrayList<org.apache.jackrabbit.vault.fs.api.PathFilterSet>();
final Map<String, String> packageDefinitionProperties = new HashMap<String, String>();
// ACL Handling
packageDefinitionProperties.put(JcrPackageDefinition.PN_AC_HANDLING,
AccessControlHandling.OVERWRITE.toString());
// Package Description
packageDefinitionProperties.put(
JcrPackageDefinition.PN_DESCRIPTION,
"package" + new Date().getTime());
final JcrPackage jcrPackage = packageHelper.createPackageForPaths(pagePaths,
resourceResolverFactory.getAdministrativeResourceResolver(null).adaptTo(Session.class),
"PackageGroup",
"PackageName",
"1.0.0",
PackageHelper.ConflictResolution.valueOf(PackageHelper.ConflictResolution.IncrementVersion.toString()),
packageDefinitionProperties
);
try {
ProgressTrackerListener listener = new DefaultProgressListener();
JcrPackageManager jcrPackageManager = packaging.getPackageManager(resourceResolverFactory.getAdministrativeResourceResolver(null).adaptTo(Session.class));
jcrPackageManager.assemble(jcrPackage, listener);
} catch (Exception e) {
log.error("ErrorHere : "+e.getMessage());
}
log.debug("Successfully created JCR package");
}
Error :
ErrorHere : JcrFS is not mounted anymore."
Any suggestions ?
Solved! Go to Solution.
Views
Replies
Total Likes
This code will work:
public JcrPackage buildPackage()
{
JcrPackage jcrPackage = null;
try
{
Packaging packaging = // GET the Packaging service reference
JcrPackageManager m_jcrPkgMgr = packaging.getPackageManager(session); // You need a session here. You can pass the session to this method or you can use system user to get the session. Make sure this user hams permissions to create the package under /etc/packages.
jcrPackage = m_jcrPkgMgr.create("my_packages",
"testpkg",
"1");
JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition();
DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
workspaceFilter.add(new PathFilterSet("/content/geometrixx-media/en"));
workspaceFilter.add(new PathFilterSet("/content/geometrixx/en/company");
boolean autoSave = true;
jcrPackageDefinition.setFilter(workspaceFilter, autoSave);
ProgressTrackerListener listener = new DefaultProgressListener();
m_jcrPkgMgr.assemble(jcrPackage, listener);
}
catch(Exception e)
{
// Catch exception here
}
return jcrPackage;
}
Views
Replies
Total Likes
Hi Phani,
Did you tried this below approach, it may help your use case:
Creating Adobe Experience Manager Packages using the JcrPackageManager.API
//https://helpx.adobe.com/experience-manager/using/dynamic_aem_packages.html
~ Ratna.
Views
Replies
Total Likes
Yes , already tried it.
It’s just creating the package but not building it.
Views
Replies
Total Likes
Hi,
Error indicates the attached session is not live. Is it happening intermediately when you build a large content?
Thanks,
Views
Replies
Total Likes
Hi, Phani
Hope this Helps...
And, try avoiding getAdministrativeResourceResolver. Instead use getServiceResourceResolver.
I've been facing issues previously with session while handling huge number of nodes. Try this and see.
Thanks!
Views
Replies
Total Likes
This code will work:
public JcrPackage buildPackage()
{
JcrPackage jcrPackage = null;
try
{
Packaging packaging = // GET the Packaging service reference
JcrPackageManager m_jcrPkgMgr = packaging.getPackageManager(session); // You need a session here. You can pass the session to this method or you can use system user to get the session. Make sure this user hams permissions to create the package under /etc/packages.
jcrPackage = m_jcrPkgMgr.create("my_packages",
"testpkg",
"1");
JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition();
DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();
workspaceFilter.add(new PathFilterSet("/content/geometrixx-media/en"));
workspaceFilter.add(new PathFilterSet("/content/geometrixx/en/company");
boolean autoSave = true;
jcrPackageDefinition.setFilter(workspaceFilter, autoSave);
ProgressTrackerListener listener = new DefaultProgressListener();
m_jcrPkgMgr.assemble(jcrPackage, listener);
}
catch(Exception e)
{
// Catch exception here
}
return jcrPackage;
}
Views
Replies
Total Likes
Views
Likes
Replies