gpt4 book ai didi

java - 将 添加到我的 Atlassian 插件的 pom.xml 会导致 Spring BundleException 并违反约束

转载 作者:行者123 更新时间:2023-11-30 03:42:02 27 4
gpt4 key购买 nike

我正在为 Atlassian Confluence 编写一个插件。我已经让它在开发环境中工作了一段时间了。但是,当我打包插件并将其部署到测试系统中时,插件无法启用。我在堆栈跟踪中看到以下原因/错误消息(完整包含在本问题的末尾)。我对其进行了格式化以便于阅读:

Caused by: org.osgi.framework.BundleException: 
Constraint violation for package 'org.springframework.transaction' when resolving module 200.0 between existing import 0.org.springframework.transaction
BLAMED ON
[
[200.0] package;
(&(package=org.springframework.transaction)(version>=0.0.0)(version<=0.0.0))
]
and uses constraint 4.0.org.springframework.transaction
BLAMED ON
[
[200.0] package;
(package=org.springframework.jms.connection)
]

我无法理解这想告诉我什么。 Confluence OSGi 容器调试信息针对所提到的包指示以下内容:

0 - 系统包

4 - Spring框架

200 - com.foo.ConflunceJMSIntegration(我的插件)

我怀疑这与各个模块使用的类加载器有关,但我只是不知道如何解释该消息或如何解决该问题。

新信息:

  • 该插件适用于 Confluence 5.5.4,但在 5.6.4 上失败。

  • 我制作了一个新的空生成插件(atlas-create-confluence-plugin),并小心地将我的每个依赖项添加到 pom.xml 中,直到我能够产生失败。当我添加此依赖项时,显然会导致失败:

    com.foo JMS工具 1.0-快照 org.slf4j slf4j-api javax.mail 邮件 日志4j 日志4j

这是我写的一个库。虽然它本身不使用 Spring 进行配置,但某些对象实现 org.springframework.beans.factory.DisposableBean 并使用 org.springframework.util.StringUtils,因此 Spring 是一个合法的要求。

这是 JMSTools 中的依赖项:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>2.5.6.SEC02</version>
<scope>provided</scope>
</dependency>

而且...现在我输入此内容,我看到 Confluence 5.6.4 使用 org.springframework:spring-core:jar:2.5.6.SEC03-atlassian-6:compile。

我刚刚尝试将 JMSTools 使用的版本更改为 2.5.6.SEC03,但仍然没有解决问题。即使确实如此,我也会担心 future 的更新 Confluence 可能会更新 Spring 并再次破坏一些东西。我的库不依赖于特定版本的 Spring,它只需要实现/使用我之前提到的类和接口(interface)。

我目前的怀疑是 org.apache.activemq:activemq-all (JMSTools 的依赖项)可能出于某种原因引用 org.springframework.jms.connection,从而以某种方式导致冲突。但是......我只是不知道(还)。

对 Scott Dudley 问题的回答:

(a) Confluence 版本:

5.6.4

(b) pom.xml 中的依赖项列表(由“atlas-mvn dependency:tree”打印):

com.foo:ConflunceJMSIntegration:atlassian-plugin:1.0-SNAPSHOT
+- junit:junit:jar:4.10:test
| \- org.hamcrest:hamcrest-core:jar:1.1:test
+- com.atlassian.confluence:confluence:jar:5.6.4:provided
| +- com.atlassian.security:atlassian-secure-xml:jar:3.2.3:provided
| +- com.atlassian.crowd:embedded-crowd-api:jar:2.7.1:provided
| | +- org.apache.commons:commons-lang3:jar:3.1:provided
| | \- com.google.code.findbugs:jsr305:jar:2.0.1:provided
| +- com.atlassian.crowd:crowd-core:jar:2.7.1:provided
| | +- com.atlassian.crowd:crowd-api:jar:2.7.1:provided
| | +- com.atlassian.crowd:crowd-persistence-file:jar:2.7.1:provided
| | +- com.atlassian.crowd:crowd-events:jar:2.7.1:provided
| | \- com.atlassian.security:atlassian-secure-random:jar:3.2:provided
| +- com.atlassian.crowd:crowd-integration-api:jar:2.7.1:provided
| | \- com.atlassian.ip:atlassian-ip:jar:3.1:provided
| +- com.atlassian.crowd:crowd-integration-seraph25:jar:2.7.1:provided
| | \- com.atlassian.crowd:crowd-integration-client-common:jar:2.7.1:provided
| +- com.atlassian.crowd:embedded-crowd-spi:jar:2.7.1:provided
| +- com.atlassian.crowd:crowd-password-encoders:jar:2.7.1:provided
| | +- com.atlassian.security:atlassian-password-encoder:jar:3.2:provided
| | \- org.springframework.security:spring-security-core:jar:3.1.4.RELEASE:provided
| +- com.atlassian.crowd:atlassian-embedded-crowd-atlassian-user:jar:1.7.3:provided
| +- com.atlassian.crowd:embedded-crowd-core:jar:2.7.1:provided
| | \- com.atlassian.crowd:crowd-remote:jar:2.7.1:provided
| | \- com.atlassian.crowd:crowd-integration-client-rest:jar:2.7.1:provided
| +- com.atlassian.crowd:crowd-persistence:jar:2.7.1:provided
| +- com.atlassian.crowd:crowd-ldap:jar:2.7.1:provided
| +- org.springframework.ldap:spring-ldap-core:jar:1.3.1.RELEASE:provided
| +- com.atlassian.confluence:confluence-upgrade:jar:5.6.4:provided
| +- com.atlassian.gzipfilter:atlassian-gzipfilter:jar:1.23:provided
| | +- javax.servlet:servlet-api:jar:2.3:provided
| | \- com.atlassian.gzipfilter:atlassian-flushable-gzipoutputstream:jar:1.1:provided
| +- com.atlassian.analytics:analytics-api:jar:3.37:provided
| +- com.atlassian.applinks:applinks-api:jar:4.2.3:provided
| +- com.atlassian.applinks:applinks-spi:jar:4.2.3:provided
| +- com.atlassian.applinks:applinks-host:jar:4.2.3:provided
| +- com.atlassian.dragonfly:dragonfly-api:jar:1.1:provided
| +- com.atlassian.dragonfly:dragonfly-spi:jar:1.1:provided
| +- com.atlassian.dragonfly:dragonfly-core:jar:1.1:provided
| +- com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.1:provided
| +- com.atlassian.modzdetector:modz-detector:jar:0.8.1:provided
| +- com.atlassian.mail:atlassian-mail:jar:2.5.0:provided
| +- com.atlassian.velocity:atlassian-velocity:jar:1.3:provided
| +- com.atlassian.core:atlassian-core:jar:4.6.11:provided
| | +- org.apache.sanselan:sanselan:jar:0.97-incubator:provided
| | +- com.atlassian.image:atlassian-image-consumer:jar:1.0.1:provided
| | \- javax.media:jai-core:jar:1.1.3:provided
| +- com.atlassian.config:atlassian-config:jar:0.21:provided
| +- com.atlassian.spring:atlassian-spring:jar:2.0.0:provided
| +- com.atlassian.spring:atlassian-spring-hibernate2:jar:2.0.0:provided
| +- com.atlassian.event:atlassian-event:jar:2.3.5:provided
| +- com.atlassian.confluence:confluence-bucket:jar:5.6.4:provided
| +- com.atlassian.hibernate:atlassian-hibernate2-extras:jar:4.1.1:provided
| +- com.atlassian.xwork:atlassian-xwork-10:jar:1.17:provided
| +- com.atlassian.xwork:atlassian-xwork-core:jar:1.17:provided
| +- com.atlassian.profiling:atlassian-profiling:jar:1.9:provided
| +- com.atlassian.threadlocal:atlassian-threadlocal:jar:1.4:provided
| +- com.atlassian.trackback:atlassian-trackback:jar:0.10:provided
| +- com.atlassian.extras:atlassian-extras-core:jar:3.2:provided
| | +- com.atlassian.extras:atlassian-extras-api:jar:3.2:provided
| | +- com.atlassian.extras:atlassian-extras-common:jar:3.2:provided
| | +- com.atlassian.extras:atlassian-extras-legacy:jar:3.2:provided
| | | \- com.atlassian.extras:atlassian-extras-decoder-api:jar:3.2:provided
| | \- com.atlassian.extras:atlassian-extras-decoder-v2:jar:3.2:provided
| +- com.atlassian.johnson:atlassian-johnson:jar:0.10:provided
| +- com.atlassian.json:atlassian-json-jsonorg:jar:0.9:provided
| | \- com.atlassian.json:atlassian-json-api:jar:0.9:provided
| +- com.atlassian.plugins:atlassian-plugins-core:jar:3.2.8:provided
| | \- com.atlassian.annotations:atlassian-annotations:jar:0.7:provided
| +- com.atlassian.plugins:atlassian-plugins-servlet:jar:3.2.8:provided
| +- com.atlassian.plugins:atlassian-plugins-webfragment:jar:3.0.1:provided
| +- com.atlassian.plugins:atlassian-plugins-webresource:jar:3.1.1-PLUGWEB-85-m05:provided
| | +- com.atlassian.plugins:atlassian-plugins-webresource-common:jar:3.0.0:provided
| | +- com.atlassian.plugins:atlassian-plugins-webresource-api:jar:3.1.1-PLUGWEB-85-m05:provided
| | \- com.atlassian.html:atlassian-html-encoder:jar:1.4:provided
| +- com.atlassian.plugins:atlassian-plugins-osgi:jar:3.2.8:provided
| | +- com.atlassian.plugins:atlassian-plugins-osgi-events:jar:3.2.8:provided
| | +- biz.aQute:bndlib:jar:1.43.0-atlassian-1:provided
| | +- org.apache.felix:org.apache.felix.framework:jar:3.0.2:provided
| | \- org.twdata.pkgscanner:package-scanner:jar:0.9.5:provided
| +- com.atlassian.plugins:atlassian-plugins-schema:jar:3.2.8:provided
| +- com.atlassian.plugins:atlassian-plugins-spring:jar:3.2.8:provided
| +- com.atlassian.plugins:atlassian-spring-interceptor-adapter-spi:jar:1.1:provided
| +- com.atlassian.bandana:atlassian-bandana:jar:3.1:provided
| +- com.atlassian.user:atlassian-user:jar:3.0:provided
| | \- org.springframework:spring-dao:jar:2.0.6:provided
| +- com.atlassian.renderer:atlassian-renderer-legacy:jar:6.2.10:provided
| | \- net.sourceforge.nekohtml:nekohtml:jar:1.9.7:provided
| +- com.atlassian.bonnie:atlassian-bonnie:jar:6.1.2:provided
| | +- com.atlassian.bonnie:lucene-upgrader:jar:lucene36:1.0:provided
| | +- org.apache.pdfbox:pdfbox:jar:1.7.1:provided
| | | +- org.apache.pdfbox:fontbox:jar:1.7.1:provided
| | | \- org.apache.pdfbox:jempbox:jar:1.7.1:provided
| | \- com.ibm.icu:icu4j:jar:3.8:provided
| +- org.bouncycastle:bcprov-jdk15on:jar:1.50:provided
| +- org.bouncycastle:bcmail-jdk15on:jar:1.50:provided
| | \- org.bouncycastle:bcpkix-jdk15on:jar:1.50:provided
| +- com.atlassian.jdk.utilities:atlassian-jdk-utilities:jar:0.4:provided
| +- joda-time:joda-time:jar:2.3:provided
| +- com.atlassian.seraph:atlassian-seraph:jar:3.0.0:provided
| | \- com.atlassian.security:atlassian-cookie-tools:jar:3.2.3:provided
| +- com.atlassian.security.auth.trustedapps:atlassian-trusted-apps-core:jar:3.0.8:provided
| +- com.atlassian.security.auth.trustedapps:atlassian-trusted-apps-seraph-integration:jar:3.0.8:provided
| +- log4j:log4j:jar:1.2.15:provided
| +- org.slf4j:slf4j-api:jar:1.7.7:provided
| +- org.slf4j:slf4j-log4j12:jar:1.7.7:provided
| +- org.slf4j:jul-to-slf4j:jar:1.7.7:provided
| +- commons-lang:commons-lang:jar:2.6:provided
| +- commons-logging:commons-logging:jar:1.1.3:compile
| +- commons-io:commons-io:jar:1.4:provided
| +- commons-beanutils:commons-beanutils:jar:1.8.3:provided
| +- commons-fileupload:commons-fileupload:jar:1.3.1:provided
| +- hibernate:hibernate:jar:2.1.8-atlassian-27:provided
| +- cglib:cglib:jar:2.1_3:provided
| | \- asm:asm:jar:1.5.3:provided
| +- dom4j:dom4j:jar:1.4-full:provided
| +- odmg:odmg:jar:3.0:provided
| +- c3p0:c3p0:jar:0.9.1.2:provided
| +- javax.transaction:jta:jar:1.0.1B:provided
| +- com.sun:jai_core:jar:1.1.3:provided
| +- com.sun:jai_codec:jar:1.1.3:provided
| +- opensymphony:webwork:jar:2.1.5-atlassian-2:provided
| +- opensymphony:xwork:jar:1.0.3.6:provided
| +- ognl:ognl:jar:2.6.5-atlassian-2:provided
| +- opensymphony:oscore:jar:2.2.7-atlassian-1:provided
| +- oscache:oscache:jar:2.2:provided
| +- osuser:osuser:jar:atl.user:provided
| +- opensymphony:propertyset:jar:1.3-21Nov03:provided
| +- org.apache.velocity:velocity:jar:1.6.4-atlassian-1:provided
| +- com.atlassian.soy:soy-template-renderer-api:jar:2.8.0:provided
| +- commons-pool:commons-pool:jar:1.5.4:provided
| +- javax.mail:mail:jar:1.4.5:provided
| +- org.springframework:spring-core:jar:2.5.6.SEC03-atlassian-6:compile
| +- org.springframework:spring-web:jar:2.5.6.SEC03:provided
| +- org.springframework:spring-aop:jar:2.5.6.SEC03:provided
| | \- aopalliance:aopalliance:jar:1.0:provided
| +- org.springframework:spring-hibernate2:jar:2.5.6-atlassian-1:provided
| | \- org.springframework:spring-orm:jar:2.5.6:provided
| +- org.springframework:spring-beans:jar:2.5.6.SEC03:compile
| +- org.springframework:spring-jdbc:jar:2.5.6.SEC03:provided
| +- org.springframework:spring-context:jar:2.5.6.SEC03:provided
| +- org.springframework:spring-tx:jar:2.5.6.SEC03:provided
| +- org.springframework:spring-context-support:jar:2.5.6.SEC03:provided
| +- com.atlassian.paddle:atlassian-paddle:jar:5:provided
| +- org.aspectj:aspectjweaver:jar:1.6.0:provided
| +- net.sf.ldaptemplate:ldaptemplate:jar:1.0.1:provided
| +- opensymphony:sitemesh:jar:2.5-atlassian-6:provided
| +- velocity-tools:velocity-tools:jar:view-1.1:provided
| +- radeox:radeox:jar:1.0b2-forked-22Apr2004:provided
| +- org.apache.lucene:lucene-core:jar:4.4.0:provided
| +- org.apache.lucene:lucene-analyzers-common:jar:4.4.0:provided
| +- org.apache.lucene:lucene-analyzers-kuromoji:jar:4.4.0:provided
| +- org.apache.lucene:lucene-misc:jar:4.4.0:provided
| +- org.apache.lucene:lucene-highlighter:jar:4.4.0:provided
| | +- org.apache.lucene:lucene-memory:jar:4.4.0:provided
| | \- org.apache.lucene:lucene-queries:jar:4.4.0:provided
| +- org.apache.lucene:lucene-queryparser:jar:4.4.0:provided
| | \- org.apache.lucene:lucene-sandbox:jar:4.4.0:provided
| | \- jakarta-regexp:jakarta-regexp:jar:1.4:provided
| +- commons-digester:commons-digester:jar:1.5:provided
| +- net.sourceforge.cssparser:cssparser:jar:0.9.5:provided
| | \- org.w3c.css:sac:jar:1.3:provided
| +- org.hibernate:jtidy:jar:r8-20060801:provided
| +- org.quartz-scheduler:quartz:jar:1.8.0:provided
| +- org.hsqldb:hsqldb:jar:2.3.0:provided
| +- com.atlassian.hsqldb:atlassian-hsqdlb-server-integration:jar:1.1.0:provided
| +- rome:rome:jar:1.0:provided
| +- jdom:jdom:jar:1.0:provided
| +- commons-jrcs:commons-jrcs:jar:diff-0.1.7:provided
| +- commons-httpclient:commons-httpclient:jar:3.1:provided
| +- xerces:xercesImpl:jar:2.11.0:provided
| +- xmlrpc:xmlrpc:jar:2.0+xmlrpc61.1+sbfix:provided
| +- com.atlassian.xmlrpc:xmlrpc-supplementary-character-support:jar:0.2:provided
| +- commons-discovery:commons-discovery:jar:0.2:provided
| +- commons-codec:commons-codec:jar:1.8:provided
| +- oro:oro:jar:2.0.8:provided
| +- slide:slide:jar:2.1:provided
| +- com.thoughtworks.xstream:xstream:jar:1.1.1:provided
| | \- xpp3:xpp3_min:jar:1.1.3.4.O:provided
| +- jfree:jfreechart:jar:1.0.0:provided
| | \- jfree:jcommon:jar:1.0.0:provided
| +- xalan:xalan:jar:2.7.1:provided
| | \- xalan:serializer:jar:2.7.1:provided
| +- com.octo.captcha:jcaptcha-all:jar:1.0-RC6:provided
| | \- concurrent:concurrent:jar:1.3.4:provided
| +- org.tuckey:urlrewritefilter:jar:4.0.4:provided
| +- commons-collections:commons-collections:jar:3.2.1:provided
| +- javax.xml.stream:stax-api:jar:1.0-2:provided
| +- org.codehaus.woodstox:wstx-asl:jar:3.2.9-atlassian-1:provided
| +- org.codehaus.xfire:xfire-core:jar:1.2.6:provided
| | +- wsdl4j:wsdl4j:jar:1.6.1:provided
| | \- org.apache.ws.commons:XmlSchema:jar:1.1:provided
| +- org.codehaus.xfire:xfire-aegis:jar:1.2.6:provided
| | \- net.java.dev.stax-utils:stax-utils:jar:20040917:provided
| +- net.jcip:jcip-annotations:jar:1.0:provided
| +- com.atlassian.cache:atlassian-cache-api:jar:2.3.4:provided
| +- com.atlassian.cache:atlassian-cache-memory:jar:2.3.4:provided
| | \- com.atlassian.cache:atlassian-cache-common-impl:jar:2.3.4:provided
| +- com.atlassian.beehive:beehive-api:jar:0.1.3:provided
| +- com.atlassian.sal:sal-spi:jar:2.12.1:provided
| +- com.atlassian.sal:sal-spring:jar:2.12.1:provided
| +- com.atlassian.sal:sal-api:jar:2.12.1:provided
| +- com.atlassian.confluence:confluence-java-api:jar:5.6.4:provided
| +- com.atlassian.confluence:confluence-rest-api:jar:5.6.4:provided
| +- com.atlassian.confluence:confluence-rest-serialization:jar:5.6.4:provided
| +- org.codehaus.jackson:jackson-core-asl:jar:1.9.1:provided
| +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.1:provided
| +- com.atlassian.activeobjects:activeobjects-dbex:jar:0.28.2:provided
| | \- com.atlassian.activeobjects:activeobjects-spi:jar:0.28.2:provided
| +- org.owasp.antisamy:antisamy:jar:1.4.2-atlassian-13:provided
| | \- org.apache.xmlgraphics:batik-css:jar:1.7:provided
| | +- org.apache.xmlgraphics:batik-ext:jar:1.7:provided
| | \- org.apache.xmlgraphics:batik-util:jar:1.7:provided
| +- org.outerj.daisy:daisydiff:jar:1.1-atlassian-5:provided
| | \- org.eclipse.core:runtime:jar:20070801:provided
| +- com.atlassian.velocity.htmlsafe:velocity-htmlsafe:jar:1.2-fixedscm:provided
| +- com.atlassian.botocss:botocss-core:jar:4.3:provided
| | +- org.jsoup:jsoup:jar:1.7.2:provided
| | +- net.sourceforge.cssbox:jstyleparser:jar:1.13-atlassian-2:provided
| | \- org.antlr:antlr-runtime:jar:3.4:provided
| | +- org.antlr:stringtemplate:jar:3.2.1:provided
| | \- antlr:antlr:jar:2.7.7:provided
| +- com.google.guava:guava:jar:11.0.2:provided
| +- com.atlassian.fugue:fugue:jar:1.1:provided
| +- com.google.code.gson:gson:jar:1.6:provided
| +- com.atlassian.http:atlassian-http:jar:0.0.8.8:provided
| +- org.javasimon:javasimon-core:jar:3.4.0:provided
| \- com.atlassian.tenancy:atlassian-tenancy-api:jar:1.4.1:provided
+- com.atlassian.confluence.plugins:confluence-rpc-plugin:jar:5.6.4:provided
+- com.atlassian.plugins:atlassian-plugins-osgi-testrunner:jar:1.2.0:test
+- javax.ws.rs:jsr311-api:jar:1.1.1:provided
+- javax.xml.bind:jaxb-api:jar:2.2:provided
+- org.mockito:mockito-all:jar:1.8.5:test
+- com.foo:JMSTools:jar:1.0-SNAPSHOT:compile
| +- org.apache.activemq:activemq-all:jar:5.10.0:compile
| \- org.apache.activemq:activemq-jaas:jar:5.10.0:compile
+- com.atlassian.confluence.plugins:confluence-space-ia:jar:8.3:provided
+- com.atlassian.activeobjects:activeobjects-core:jar:0.25.2:provided
| \- net.java.dev.activeobjects:activeobjects:jar:0.25.2:provided
+- com.atlassian.confluence.plugins:doctheme:jar:5.6.3:provided
+- com.atlassian.applinks:applinks-core:jar:2.5.12:provided
+- com.atlassian.applinks:applinks-plugin:jar:4.1.2:provided
+- com.atlassian.plugins.rest:atlassian-rest-common:jar:1.0.2:provided
| +- com.atlassian.plugins.rest:com.atlassian.jersey-library:pom:1.0.2:provided
| | +- com.sun.jersey:jersey-server:jar:1.0.3:provided
| | | \- com.sun.jersey:jersey-core:jar:1.0.3:provided
| | \- com.sun.jersey:jersey-json:jar:1.0.3:provided
| | +- org.codehaus.jettison:jettison:jar:1.0.1:provided
| | \- org.codehaus.jackson:jackson-asl:jar:0.9.4:provided
| \- net.sourceforge.findbugs:jsr305:jar:1.3.2:provided
+- org.apache.wink:wink-client:jar:1.1.3-incubating:test
| +- org.apache.wink:wink-common:jar:1.1.3-incubating:test
| | \- org.apache.geronimo.specs:geronimo-annotation_1.1_spec:jar:1.0:test
| +- com.sun.xml.bind:jaxb-impl:jar:2.2.1.1:test
| \- javax.activation:activation:jar:1.1:provided
+- org.apache.httpcomponents:httpclient:jar:4.1.1:test
| \- org.apache.httpcomponents:httpcore:jar:4.1:test
+- org.powermock:powermock-module-junit4:jar:1.4.9:test
| \- org.powermock:powermock-module-junit4-common:jar:1.4.9:test
| +- org.powermock:powermock-core:jar:1.4.9:test
| | \- org.javassist:javassist:jar:3.14.0-GA:test
| \- org.powermock:powermock-reflect:jar:1.4.9:test
| \- org.objenesis:objenesis:jar:1.2:test
\- org.powermock:powermock-api-mockito:jar:1.4.9:test
\- org.powermock:powermock-api-support:jar:1.4.9:test

(c) 组件导入:

来自 atlassian-plugin.xml:

<component-import key="transactionTemplate" 
interface="com.atlassian.sal.api.transaction.TransactionTemplate"/>
<component-import key="sidebar-link-service"
interface="com.atlassian.confluence.plugins.ia.service.SidebarLinkService"/>
<component-import key="userManager"
interface="com.atlassian.user.UserManager"/>
<component-import key="systemTemplateManager"
interface="com.atlassian.confluence.spaces.SystemTemplateManager"/>
<component-import key="fileUploadManager"
interface="com.atlassian.confluence.pages.FileUploadManager"/>
<component-import key="entityLinkService"
interface="com.atlassian.applinks.spi.link.MutatingEntityLinkService"/>
<component-import key="applicationLinkService"
interface="com.atlassian.applinks.api.ApplicationLinkService"/>
<component-import key="typeAccessor"
interface="com.atlassian.applinks.spi.util.TypeAccessor"/>
<component-import key="entityLinkBuilderFactory"
interface="com.atlassian.applinks.spi.link.EntityLinkBuilderFactory"/>
<component-import key="applicationProperties"
interface="com.atlassian.sal.api.ApplicationProperties"/>
<component-import key="licenseService"
interface="com.atlassian.confluence.license.LicenseService"/>
<component-import key="i18nResolver"
interface="com.atlassian.sal.api.message.I18nResolver"/>
<component-import key="loginUriProvider"
interface="com.atlassian.sal.api.auth.LoginUriProvider"/>
<component-import key="soyTemplateRenderer"
interface="com.atlassian.soy.renderer.SoyTemplateRenderer" />
<component-import name="Plugin Settings Factory" key="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory"/>

来自 META-INF/spring/atlassian-plugin-context.xml:

<osgi:reference id="transactionTemplate"
interface="com.atlassian.sal.api.transaction.TransactionTemplate" />
<osgi:reference id="sidebarLinkService"
interface="com.atlassian.confluence.plugins.ia.service.SidebarLinkService" />
<osgi:reference id="userManager"
interface="com.atlassian.user.UserManager" />
<osgi:reference id="systemTemplateManager"
interface="com.atlassian.confluence.spaces.SystemTemplateManager" />
<osgi:reference id="fileUploadManager"
interface="com.atlassian.confluence.pages.FileUploadManager" />
<osgi:reference id="entityLinkService"
interface="com.atlassian.applinks.spi.link.MutatingEntityLinkService"/>
<osgi:reference id="applicationLinkService"
interface="com.atlassian.applinks.api.ApplicationLinkService"/>
<osgi:reference id="typeAccessor"
interface="com.atlassian.applinks.spi.util.TypeAccessor"/>
<osgi:reference id="entityLinkBuilderFactory"
interface="com.atlassian.applinks.spi.link.EntityLinkBuilderFactory"/>
<osgi:reference id="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" />
<osgi:reference id="spaceManager"
interface="com.atlassian.confluence.spaces.SpaceManager" />
<osgi:reference id="pageManager"
interface="com.atlassian.confluence.pages.PageManager" />

注意:我需要检查以确保我仍然需要所有这些导入/引用。我也不确定是否需要在 atlassian-plugin.xml 中导入组件以在 atlassian-plugin-context.xml 中引用它们。如果没有,我也许可以稍微清理一下这些列表。

(d) public=true 的组件:

<component key="confluence-event-listener" class="com.foo.confluence.ConfluenceJMSAnnouncerImpl"
name="Confluence Event Listener" i18n-name-key="confluence-event-listener.name" public="true">
<description key="confluence-event-listener.description">The confluence event listener Impl Plugin</description>
<interface>com.foo.confluence.ConfluenceJMSAnnouncer</interface>
</component>

注意:我怀疑这不需要公开。

第二个注意事项:我在 atlassian-plugin-context.xml 中配置了 30 个 bean。我唯一暴露的是:

<osgi:service interface="com.foo.confluence.ConfluenceService" ref="confluenceService"/>

完整堆栈跟踪:

2014-10-30 09:29:25,451 ERROR [main] [plugin.osgi.factory.OsgiPlugin] enableInternal Detected an error (BundleException) enabling the plugin 'com.foo.ConflunceJMSIntegration' : Constraint violation for package 'org.springframework.transaction' when resolving module 201.0 between existing import 0.org.springframework.transaction BLAMED ON [[201.0] package; (&(package=org.springframework.transaction)(version>=0.0.0)(version<=0.0.0))] and uses constraint 4.0.org.springframework.transaction BLAMED ON [[201.0] package; (package=org.springframework.jms.connection)].  This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
2014-10-30 09:29:25,452 WARN [main] [atlassian.plugin.impl.AbstractPlugin] enable Unable to enable plugin 'com.foo.ConflunceJMSIntegration'
2014-10-30 09:29:25,454 WARN [main] [atlassian.plugin.impl.AbstractPlugin] enable Because of this exception
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.foo.ConflunceJMSIntegration
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:479)
at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:310)
at com.atlassian.plugin.impl.AbstractDelegatingPlugin.enable(AbstractDelegatingPlugin.java:242)
at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:136)
at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:104)
.... had to remove detail to trim length of question ....
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.osgi.framework.BundleException: Constraint violation for package 'org.springframework.transaction' when resolving module 201.0 between existing import 0.org.springframework.transaction BLAMED ON [[201.0] package; (&(package=org.springframework.transaction)(version>=0.0.0)(version<=0.0.0))] and uses constraint 4.0.org.springframework.transaction BLAMED ON [[201.0] package; (package=org.springframework.jms.connection)]
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3415)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1709)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:456)
... 33 more
2014-10-30 09:29:25,455 ERROR [main] [atlassian.plugin.manager.PluginEnabler] actualEnable Unable to enable plugin com.foo.ConflunceJMSIntegration
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.foo.ConflunceJMSIntegration
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:479)
at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:310)
.... had to remove detail to trim length of question ....
Caused by: org.osgi.framework.BundleException: Constraint violation for package 'org.springframework.transaction' when resolving module 201.0 between existing import 0.org.springframework.transaction BLAMED ON [[201.0] package; (&(package=org.springframework.transaction)(version>=0.0.0)(version<=0.0.0))] and uses constraint 4.0.org.springframework.transaction BLAMED ON [[201.0] package; (package=org.springframework.jms.connection)]
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3415)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1709)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:456)
... 33 more

最佳答案

只需添加 <dependency>条目 pom.xml在一个空插件中通常不会导致插件加载时出现 OSGi 错误,因为 Confluence 不应该仅仅根据依赖项的存在来尝试导入外部包。

我的怀疑(在聊天线程中得到证实)是,您的依赖项之一包含某种 Spring 指令,这些指令在插件加载时混淆了 Confluence。当使用默认值构建插件时,插件 SDK 将自动取消 JAR 所有依赖项,并将生成的文件集包含在主插件 JAR 中。

如果您的某个库依赖项无意中在 META-INF/spring 中包含了 Spring 相关数据或者其他地方,这会与您自己的插件的 Spring 配置混合在一起,这可能会造成严重破坏。

解决此问题的最佳方法是禁用依赖项提取。这意味着,不是将所有依赖项解 JAR 并将它们转储到与插件相同的 JAR 中,而是将依赖项保留在其源 JAR 中,并且这些 JAR 直接包含在 META-INF/lib 中。 。即使依赖项确实声明了一些流氓 Spring 指令,它们也会保留在自己的 JAR 中,并且在加载插件时不会被 Confluence 处理。

要禁用依赖项的提取,您需要在 pom.xml 的 confluence-maven-plugin 部分中将 extractDependency 设置为 false ,如下图:

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-conflue‌​‌​nce-plugin</artifactId>
<version>x.y.z</version>
[...]
<configuration>
[...]
<extractDependencies>false</extractDependencies>
</configuration>
</plugin>

关于java - 将 <dependency> 添加到我的 Atlassian 插件的 pom.xml 会导致 Spring BundleException 并违反约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26618618/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com