I'm getting this error running from the new Scheduler API from JIRA 6.3, when running scheduled tasks, but not when running ordanary requests.
[INFO] [talledLocalContainer] 2014-08-06 10:08:00,148 atlassian-scheduler-quartz1.clustered_Worker-3 ERROR [services.ldap.LDAPIntegrationServiceImpl] Error in ldap connection: [INFO] [talledLocalContainer] javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory] ..
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory [INFO] [talledLocalContainer] ... 12 more
Anyone got the same error or have an idé how to solve it? I don't wont to put the JRE (rt.jar) classes in the classpath, thats also causes other problems..
The old PluginScheduler worked fine both ways....
New info, it doesn't work even in the depreceted PluginScheduler in JIRA 6.3, it's the JIRA version that is the difference. Before JIRA 6.3, it worked fine, in JIRA 6.3 the scheduler doesn't work with com.sun classes, neither in the new Scheduler API or the old PluginScheduler.
Using the same components from an REST-API it works fine, even in JIRA 6.3
My main case for LDAP us in JIRA scheduled job for mail handling, that is a once-per-cluster job, would assume without digging that its using the scheduler api somehow. I dont see a similar problem in LDAP InitialContext creation or usage, guess Im lucky ;)
The only suggestion I have is that you should only access LDAP via a registered Component, as this is then initialized by OSGi, the classloader restrictions in place for scheduled jobs then do not apply.
I am only accessing LDAP from a registered component. And it works fine even in JIRA 6.3. The problem occures when accessing the same (working) component from the Scheduler API. I have manage to get it to work by manipilating the classloaders but I don't feel comfortable about it. But it's better then putting internal com.sun classes in the plugin classloader directly.
The last thing you wrote about "classloader restrictions don't apply", doesn't seems to be correct because I'm getting the error anyway. Strange...
I am facing the same issue where i am trying to connect to LDAP from a scheduled plugin Job.
Jira : 7.2.9
JRE : 1.8
I am using the "PluginAccessor.class.getClassLoader()" but still encounter the same issue of class not found.
2017-09-26 05:35:15,875 Caesium-1-4 INFO Querying LDAP for user details ...
2017-09-26 05:35:15,880 Caesium-1-4 INFO Old classloader is - com.atlassian.sal.jira 
2017-09-26 05:35:15,881 Caesium-1-4 INFO New classloader is - WebappClassLoader
----------> Parent Classloader:
2017-09-26 05:35:15,884 Caesium-1-4 ERROR problem querying LDAP to get details for user XXXXXXXX
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory [Root exception is java.lang.ClassNotFoundException: com.sun.jndi.ldap.LdapCtxFactory not found by com.atlassian.sal.jira ]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674) [?:1.8.0_131]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) [?:1.8.0_131]
at javax.naming.InitialContext.init(InitialContext.java:244) [?:1.8.0_131]
at javax.naming.InitialContext.<init>(InitialContext.java:216) [?:1.8.0_131]
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot