I'm trying to use a reference to CugSupport service into an osgi component, like these:
import com.day.cq.auth.impl.CugSupport; ... @Component @Service public class MyComponentImpl implements MyComponent { @Reference private CugSupport cugSupport; ... private String getCugRootLoginPage(final HttpServletRequest request) { // check for a CUG final CugSupport cugSupport = this.cugSupport; if (cugSupport != null) { return cugSupport.getLoginPage(request); } return null; } }
I added this maven dependency to my pom:
<dependency>
<groupId>com.adobe.granite</groupId>
<artifactId>com.adobe.granite.auth.authhandler</artifactId>
<version>5.6.2</version>
<scope>provided</scope>
</dependency>
which is the only one I found on Adobe maven repository.
When I try to install my bundle into my AEM instance I have this exception:
05.02.2015 09:10:53.173 *WARN* [OsgiInstallerImpl] Failure loooking up method bindResourceResolverFactory(org.osgi.framework.ServiceReference) Assuming no such method. (java.lang.NoClassDefFoundError: com/day/cq/auth/impl/CugSupport) java.lang.NoClassDefFoundError: com/day/cq/auth/impl/CugSupport
I am using AEM 6 + SP2.
Do you know how can I fix this error?
Solved! Go to Solution.
Views
Replies
Total Likes
This will not work, as this interface is not exported by the OSGI bundle. In AEM 6.0 (the version I have handy right here) I have the bundle com.day.cq.auth.authhandler exporting nothing. And I really doubt, that this has changed with SP1.
Where have you the reference to this service? It isn't a public API.
kind regards,
Jörg
Views
Replies
Total Likes
boser87 wrote...
I'm trying to use a reference to CugSupport service into an osgi component, like these:
import com.day.cq.auth.impl.CugSupport;
...
@Component
@Service
public class MyComponentImpl implements MyComponent {
@Reference
private CugSupport cugSupport;
...
private String getCugRootLoginPage(final HttpServletRequest request) {
// check for a CUG
final CugSupport cugSupport = this.cugSupport;
if (cugSupport != null) {
return cugSupport.getLoginPage(request);
}
return null;
}
}
I added this maven dependency to my pom:
<dependency>
<groupId>com.adobe.granite</groupId>
<artifactId>com.adobe.granite.auth.authhandler</artifactId>
<version>5.6.2</version>
<scope>provided</scope>
</dependency>
which is the only one I found on Adobe maven repository.
When I try to install my bundle into my AEM instance I have this exception:
05.02.2015 09:10:53.173 *WARN* [OsgiInstallerImpl] Failure loooking up method bindResourceResolverFactory(org.osgi.framework.ServiceReference) Assuming no such method. (java.lang.NoClassDefFoundError: com/day/cq/auth/impl/CugSupport)
java.lang.NoClassDefFoundError: com/day/cq/auth/impl/CugSupport
I am using AEM 6 + SP2.
Do you know how can I fix this error?
Your code not giving any issue during build in AEM6+SP1 as i executed. But your error seem missing dependency. Check .m2 folder whether it exists. Try Re-Import maven dependencies using IDE.
Views
Replies
Total Likes
This will not work, as this interface is not exported by the OSGI bundle. In AEM 6.0 (the version I have handy right here) I have the bundle com.day.cq.auth.authhandler exporting nothing. And I really doubt, that this has changed with SP1.
Where have you the reference to this service? It isn't a public API.
kind regards,
Jörg
Views
Replies
Total Likes
I can resolve the dependency both locally and while deploying on the AEM instance.
Maybe the problem is that the service I'm trying to use is declared as private into the bundle POM?
<Private-Package>com.day.cq.auth.impl.*</Private-Package>
The strange thing here is that the service interface is placed under impl package and thus not exported...
But how am I supposed to rertrieve the CUG's login page without this?
Views
Replies
Total Likes
Can you point to the online resource that you are following to perform this task? I assume that you are following some content posted somewhere.
Views
Replies
Total Likes
Views
Likes
Replies