0

我的 FishEye 插件应该可以访问我们的 Active Directory 并为 FishEye 实现更多功能。该插件应该每隔 X 分钟与目录同步一次,因此它基于 SAL 调度程序。当我尝试使用 com.sun.jndi.ldap.LdapCtxFactory 时,我发现它只适用于 REST 插件,但即使我重新定义了类加载器,与 SAL 一起使用也不会加载这些类。无论如何,我使用 Spring LDAP 重新实现了我的功能,当我尝试将我的插件部署到 FishEye 时,我得到了:

2014-12-03 23:12:03,010 ERROR [ThreadPoolAsyncTaskExecutor::Thread 9 ] org.springframework.osgi.extender.internal.activator.ContextLoaderListener DefaultOsgiBundleApplicationContextListener-onOsgiApplicationEvent - Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.mycompany.fisheye.ldap-restriction-plugin, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi]
Offending resource: URL [bundle://84.0:0/META-INF/spring/atlassian-plugins-component-imports.xml]

好的。我用谷歌搜索并发现https://developer.atlassian.com/docs/faq/troubleshooting/dependency-issues-during-plugin-initialisation 有文字说我必须将依赖范围更改为提供以避免冲突。好的,我做到了。但现在我有另一个例外:

Exception in thread "PluginSchedulerTask-com.mycompany.fisheye.LdapRestrictio    nComponentImpl:job" java.lang.NoClassDefFoundError: org/springframework/ldap/core/support/LdapContextSource        

我试图将 spring-ldap-core-1.3.2.RELEASE.jar 放入 $fisheyeDir/lib 并且没有任何反应 - 引导加载程序没有拾取这个 JAR。

有谁知道在这种情况下可以做什么?我应该使用另一个 LDAP 框架还是可以将这些 ldap 客户端实现推送到类路径?

FishEye 版本 3.6.1(最新),将 jar 放入类路径版本 3.0.5.RELEASE。我的 spring-security-ldap 依赖也是 3.0.5.RELEASE。

提前致谢。

4

1 回答 1

0

内部使用的 Spring 版本 FishEye(3.6.1 中的 3.0.5,3.7 中的 3.1.4)不暴露于插件。

相反,他们从 Atlassian 插件系统 ( https://bitbucket.org/atlassian/atlassian-plugins ) 获得了 Spring 运行时。FishEye 使用插件 3.0.x,因此插件可用的 Spring 版本是 2.5.6。

FishEye、插件系统和任何捆绑插件都不包含 spring-ldap,因此您不能将依赖范围设置为(因为这会导致库不包含在插件 jar 中,而是期望它可以通过 OSGI 使用进口)。

所以我认为你应该尝试捆绑一个与 Spring 2.5.6 兼容的 spring-ldap 版本。要解决 BeanDefinitionParsingException,您可能需要排除插件系统提供的一些传递依赖项(使用 mvn dependency:tree 查找这些依赖项)。

披露:我是开发 FishEye/Crucible 的开发人员

于 2015-02-19T12:32:19.893 回答