NoClassDefFoundError com.day.crx.security.ldap.jmx.LDAPUserMBean - JMX TOOL | Community
Skip to main content
cqlearner
Level 2
October 16, 2015
Solved

NoClassDefFoundError com.day.crx.security.ldap.jmx.LDAPUserMBean - JMX TOOL

  • October 16, 2015
  • 9 replies
  • 1676 views

Hi,

I getting NoClassDefFoundError when trying to use com.day.crx.security.ldap.jmx.LDAPUserMBean class to connect to LDAP from OSGI Scheduler. 

I have placed <Import-Packagecom.day.crx.security.ldap.jmx.LDAPUserMBean;resolution:=optional,  </Import-Package> in maven but in bundle I see it could not resolve it.

     
Imported Packagescom.adobe.cq.launches.api from com.adobe.cq.cq-launches-api (238)
com.day.cq.audit from com.day.cq.cq-audit (165)
com.day.cq.commons from com.day.cq.cq-commons (178)
com.day.cq.commons.jcr from com.day.cq.cq-commons (178)
com.day.cq.replication from com.day.cq.cq-replication (88)
com.day.cq.search from com.day.cq.cq-search (200)
com.day.cq.security from com.day.cq.cq-security-api (205)
com.day.cq.tagging from com.day.cq.cq-tagging (208)
com.day.cq.wcm.api from com.day.cq.wcm.cq-wcm-api (271)
com.day.cq.wcm.api.components from com.day.cq.wcm.cq-wcm-api (271)
com.day.cq.wcm.api.designer from com.day.cq.wcm.cq-wcm-api (271)
com.day.crx.security.ldap.jmx -- Cannot be resolved
com.day.crx.security.ldap.jmx.LDAPUserMBean -- Cannot be resolved but is not required

com.day.crx.security.ldap.sync,version=[2.4,3) from com.day.crx.sling.server (60)
com.day.durbo,version=[2.1,3) from day-commons-durbo (106)
com.day.image from day-commons-gfx (107)
com.day.text,version=[1.1,2) from com.day.commons.da

 

Any pointer to resolve this would be greatly appreciated. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

Hi,

You can't reference this class. As I said, the containing package isn't exported and it isn't considered an API. You should be able to use the standard JMX API to invoke MBean operations, but you cannot use this class. The only CRX LDAP-related package which is exported is com.day.crx.security.ldap.sync.

Regards,

Justin

9 replies

Adobe Employee
October 16, 2015

This package (com.day.crx.security.ldap.jmx) is not exported. Also, you can only import packages, not classes.

cqlearner
cqlearnerAuthor
Level 2
October 16, 2015

Justin, 

Do you mean i add <Export-Package>com.day.crx.security.ldap.jmx</Export-Package> ? That did not work.

Adobe Employee
October 16, 2015

I most definitely did not mean to add an Export-Package header for a package your bundle doesn't contain.

You were asking, as far as I can tell, why your two imports aren't resolved. I'm telling you it is because (1) the package isn't exported and (2) because you can only import a package, not a class.

cqlearner
cqlearnerAuthor
Level 2
October 16, 2015

Ok.

I got the bundle to resolve by adding "com.day.crx.security.ldap.*" instead of "com.day.crx.security.ldap.jmx.*"  in <Import-Package>. However, when the scheduler run and executes the task I am still seeing NoClassDefFoundError:

08.03.2014 21:40:00.003 *ERROR* [pool-5-thread-1] org.apache.sling.commons.scheduler.impl.QuartzScheduler Exception during job execution of com.test.wcm.core.scheduler.LDAPSyncupTask@5f0639b5 : com/day/crx/security/ldap/jmx/LDAPUserMBean java.lang.NoClassDefFoundError: com/day/crx/security/ldap/jmx/LDAPUserMBean

Thanks again for the prompt response.

Adobe Employee
October 16, 2015

I think you're missing the point. This package (com.day.crx.security.ldap.jmx) isn't exported. This effectively means you can't use it. No amount of header manipulation in your bundle is going to change this.

cqlearner
cqlearnerAuthor
Level 2
October 16, 2015

Yes I think I am missing the point. I saw this post "http://forums.adobe.com/thread/1073347" where it looks like someone is getting access to LDAPUserMBean successfully. Is it because it was not reference from bundle? 
What are my alternatives here? Do I need to use CURL/POST programmatically in the scheduler?

curl -u <UID>:<PASSWORD> -X POST http://<HOST>:<PORT>/system/console/jmx/com.adobe.granite.ldap:host=<ldaphost>,port=<ldapport>,type=Tools/op/listOrphanedUsers/

Any suggestion is greatly appreciated. 

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

You can't reference this class. As I said, the containing package isn't exported and it isn't considered an API. You should be able to use the standard JMX API to invoke MBean operations, but you cannot use this class. The only CRX LDAP-related package which is exported is com.day.crx.security.ldap.sync.

Regards,

Justin

smacdonald2008
Level 10
October 16, 2015

You are missing these packages in CQ:

com.day.crx.security.ldap.jmx -- Cannot be resolved
com.day.crx.security.ldap.jmx.LDAPUserMBean

WHen CQ is missing libs like this - you typically have to wrap the missing packages (which are located in a given JAR) into an OSGi bundle fragment and put that bundle fragment in an active state. For example -- take a look at this article:

http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

 We used a JSON lib (org.json.simple) in OSGi bundle that contained a sling servlet.

Therefore we needed to put the JAR file that contained the org.json.simple package into a bundle fragment and put that bundle fragment into an active state. Otherwise - we would get the same error - the missing dependency error. 

As shown in the article -- you can use the Eclipse plug-in project to create an OSGi bundle fragment that wraps the JAR file you need to export. 

cqlearner
cqlearnerAuthor
Level 2
October 16, 2015

Thanks.