Hi,
I am working on AEM 6.2
As loginAdministrator is depcreated.
So i followed the link: http://adobeaemclub.com/access-to-resourceresolver-in-osgi-services-aem-6-1/
I used following code in osgi-bundle:
I created the service user and mapped as mention above link .
Session session =rr.adaptTo(Session.class);
When osgi-bundles imported in console/bundles:
Following Exception is thrown:-
error.log:
28.04.2017 13:28:39.419 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle com.adobe.connect.osgi.service.connect-osgi-service [475]. Reason: {}. Will retry.
org.osgi.framework.BundleException: Activator start error in bundle com.adobe.connect.osgi.service.connect-osgi-service [475].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2276)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
at org.apache.sling.installer.core.impl.tasks.BundleStartTask.execute(BundleStartTask.java:93)
at org.apache.sling.installer.core.impl.OsgiInstallerImpl.doExecuteTasks(OsgiInstallerImpl.java:847)
at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:689)
at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:265)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
at com.adobe.connect.osgi.service.Activator.start(Activator.java:85)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2226)
... 8 common frames omitted
Any Suggestion?
Thanks
Solved! Go to Solution.
Follow this artilce and watch the video. For AEM 6.1 and 6.2 - you need to use a system user.
http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html
This will show you the proper way.
Views
Replies
Total Likes
Follow this artilce and watch the video. For AEM 6.1 and 6.2 - you need to use a system user.
http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html
This will show you the proper way.
Views
Replies
Total Likes
smacdonald2008 wrote...
Follow this artilce and watch the video. For AEM 6.1 and 6.2 - you need to use a system user.
http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html
This will show you the proper way.
I created system user.
Not able to fix this issue..
Views
Replies
Total Likes
Hi,
Sadly you did not provide the exact line in your code, so it's hard to map Activator.java, line 85 to a statement.
My gut feeling says, that the resource factory is null. Likely you tried to inject this dependency via @Reference. But guessing from the filename "Activator" you try to do that in the bundle activator. And AFAIK this reference does not work in Bundle activators, but only in SCR components.
Can you confirm my assumptions?
Cheers,
Jörg
Views
Replies
Total Likes
That is my code
class Activator{
@Reference private ResourceResolverFactory resourceFactory; public void start(BundleContext context) { String url = null; SlingRepository repository = null; ServiceReference repositoryServiceRef = context.getServiceReference(SlingRepository.class.getName()); Session jcrSession = null; log.info("1 line"); if (repositoryServiceRef != null) { log.info("2 line"); repository = (SlingRepository) context.getService(repositoryServiceRef); log.info("3 line"); try { log.info("4 line"); Map<String,Object> paramMap = new HashMap<String,Object>(); //Mention the subServiceName you had used in the User Mapping paramMap.put(ResourceResolverFactory.SUBSERVICE, "readService"); ResourceResolver rr = null; try{ log.info("5 line"); rr = resourceFactory.getServiceResourceResolver(paramMap); log.info("6 line"); } catch(Exception e){ log.error(e.getMessage()); } jcrSession = rr.adaptTo(Session.class); log.info("7 line"); Node clusterPropertiesNode = jcrSession.getNode("/content/query/c1/jcr:content"); log.info("8 line"); url = clusterPropertiesNode.getProperty("serverUrl").getString(); log.info("9 line"); // Perform Post Install Tasks performPostInstallTasks(jcrSession, context); } catch (RepositoryException e) { log.error("Error retreiving connect cluster configuration node", e); } finally { jcrSession.logout();// this is line no 85 } }
}
In error.log file:
1 line
2 line
3 line
4 line
5 line
then exception...
Views
Replies
Total Likes
Hi,
yes, that's the problem. You try to use the @Reference annotation in the bundle activator, which does not work, because the Activator is not a SCR component. If you follow the documentation at [1] it will work.
Cheers,
Jörg
[1] http://adobeaemclub.com/access-to-resourceresolver-in-osgi-services-aem-6-1/