我们正在开发一个使用 rest api 的 jira 自定义插件。
安装自定义插件后,当我们重新启动jira时,它会失败。
我们在日志中面临以下异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activator' defined in URL [bundle://109.0:0/META-INF/spring/atlassian-plugins-components.xml]: Invocation of init method failed; nested exception is com.sun.jersey.spi.service.ServiceConfigurationError: com.sun.jersey.spi.HeaderDelegateProvider: The class com.sun.jersey.core.impl.provider.header.LocaleProvider implementing provider interface com.sun.jersey.spi.HeaderDelegateProvider could not be instantiated: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: com.sun.jersey.spi.service.ServiceConfigurationError: com.sun.jersey.spi.HeaderDelegateProvider: The class com.sun.jersey.core.impl.provider.header.LocaleProvider implementing provider interface com.sun.jersey.spi.HeaderDelegateProvider could not be instantiated: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider
at com.sun.jersey.core.osgi.Activator$OsgiServiceFinder$1.next(Activator.java:80)
at com.sun.jersey.core.spi.factory.AbstractRuntimeDelegate.<init>(AbstractRuntimeDelegate.java:76)
at com.sun.jersey.server.impl.provider.RuntimeDelegateImpl.<init>(RuntimeDelegateImpl.java:54)
at com.sun.jersey.server.osgi.Activator.start(Activator.java:63)
at com.atlassian.plugins.rest.module.Activator.afterPropertiesSet(Activator.java:22)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 19 more
Caused by: java.lang.ClassCastException: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider
at java.lang.Class.cast(Class.java:3084)
at com.sun.jersey.core.osgi.Activator$OsgiServiceFinder$1.next(Activator.java:78)
... 25 more
您能否为上述异常提出解决方案?
此插件的 atlassian-plugin.xml文件:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<web-resource key="QC-Jira-Linkage" name="QC-Jira-Linkage Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<!-- <resource type="download" name="qc-jira-linkage.css" location="css/qc-jira-linkage.css"/> -->
<resource type="download" name="qc-jira-linkage.js" location="js/qc-jira-linkage.js"/>
<resource type="download" name="images/" location="images/"/>
<context>QC-Jira-Linkage</context>
<context>atl.general</context>
<context>atl.admin</context>
</web-resource>
<!-- add our i18n resource -->
<resource type="i18n" name="qc-jira-linkage" location="qc-jira-linkage"/>
<web-item key="add-qc-link" section="create-issue-link-types" weight="20">
<label key="com.example.externallinkage.type" />
<link linkId="add-qc-link">
/secure/LinkQC!default.jspa?id=${issueId}
</link>
</web-item>
<component key="link-service" class="com.example.externallinkage.LinkService"/>
<component-import key="activityService" interface="com.atlassian.streams.thirdparty.api.ActivityService"/>
<component-import key="sal-request-factory" interface="com.atlassian.sal.api.net.RequestFactory"/>
<webwork1 key="issue-link-qc" name="Link Issues With QC" class="java.lang.Object">
<actions>
<action name="com.example.externallinkage.LinkQC" alias="LinkQC">
<view name="error">/templates/qc-jira-linkage-view.vm</view>
<view name="input">/templates/qc-jira-linkage-view.vm</view>
</action>
</actions>
</webwork1>
<component-import key="remote-issue-link-service" interface="com.atlassian.jira.bc.issue.link.RemoteIssueLinkService"/>
<issue-link-renderer key="qc-jira-linkagekey" application-type="com.example.externallinkage" class="com.example.externallinkage.JiraQCLinkRenderer">
<resource name="initial-view" type="velocity" location="templates/renderer/loadingissuelink.vm"/>
<resource name="final-view" type="velocity" location="templates/renderer/qclink.vm"/>
</issue-link-renderer>
<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager" />
<component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider" />
<component-import key="renderer" interface="com.atlassian.templaterenderer.velocity.one.six.VelocityTemplateRenderer" />
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />
<component-import key="pluginSettingsFactory" interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" />
<component-import key="transactionTemplate" interface="com.atlassian.sal.api.transaction.TransactionTemplate" />
<template-context-item key="applicationPropertiesContextItem" component-ref="applicationProperties"
context-key="applicationProperties" name="Application Properties Context Item"/>
<servlet key="link-servlet" class="com.example.externallinkage.LinkServlet">
<url-pattern>/asurion/TestInstanceDetails</url-pattern>
</servlet>
<webwork1 key="DeleteLink" name="DeleteLink" class="java.lang.Object">
<actions>
<action name="com.example.externallinkage.RemoteDeleteLink" alias="DeleteRemoteIssueLink" roles-required="use">
<view name="input">/secure/views/issue/deletelink.jsp</view>
<view name="error">/secure/views/issue/deletelink.jsp</view>
</action>
</actions>
</webwork1>
</atlassian-plugin>