我正在构建一个处理传入消息的JIRA插件。 我正在使用Jericho来解析邮件的HTML信息。 在eclipse和“atlas-compile / run / debug”中,我没有收到任何关于缺少库的错误消息。 一旦插件需要使用Jericho JAR的“Source”类执行操作,我会遇到以下错误。
[INFO] [talledLocalContainer] java.lang.NoClassDefFoundError: net/htmlparser/jericho/Source
[INFO] [talledLocalContainer] at a2j.ExtractHTMLContent.extractMailContent(ExtractHTMLContent.java:63)
[INFO] [talledLocalContainer] at a2j.Handler.handleMessage(Handler.java:109)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:413)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:306)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:401)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:261)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:66)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:75)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:53)
[INFO] [talledLocalContainer] at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:36)
[INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:135)
[INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
[INFO] [talledLocalContainer] at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
[INFO] [talledLocalContainer] at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
[INFO] [talledLocalContainer] at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
[INFO] [talledLocalContainer] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: net.htmlparser.jericho.Source
[INFO] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
[INFO] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
[INFO] [talledLocalContainer] at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
[INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] [talledLocalContainer] ... 16 more
jar和pom在.classpath
中指定的位置可用我很高兴有关于此
的任何帮助或意见添加pom.xml和atlassian-plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven- v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId>a2j</artifactId>
<version>1.0</version>
<organization>
<name></name>
<url></url>
</organization>
<name>Mail Handler Plugin</name>
<description>This A2J Plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-mail-plugin</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.mail</groupId>
<artifactId>atlassian-mail</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.htmlparser.jericho</groupId>
<artifactId>jericho-html</artifactId>
<version>3.3</version>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>6.3.6</jira.version>
<amps.version>5.0.4</amps.version>
<plugin.testrunner.version>1.2.0</plugin.testrunner.version>
<!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x -->
<testkit.version>5.2.26</testkit.version>
</properties>
</project>
Atlassian的-插件
<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>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="a2j"/>
<!-- add our web resources -->
<web-resource key="a2j-resources" name="a2j Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="a2j.css" location="/css/a2j.css"/>
<resource type="download" name="a2j.js" location="/js/a2j.js"/>
<resource type="download" name="images/" location="/images"/>
<context>a2j</context>
</web-resource>
<!-- publish our component -->
<component key="issue-data-manager" class="a2j.IssueDataManager"/>
<message-handler i18n-name-key="handler.name"
key="handler"
class="a2j.Handler"
add-edit-url="/secure/admin/EditHandlerDetailsUsingParams!default.jspa"
weight="0"/>
<!-- import from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />
</atlassian-plugin>
答案 0 :(得分:0)
我们面临同样的问题,但有另一个框架。一切都在这里 https://developer.atlassian.com/display/DOCS/Managing+Dependencies 使用了不正确的ClassLoader。你可以通过调用MyClass.class.getClassLoader()得到正确的一个 在你的任何一个班级。或者阅读那篇文章(或其他文章)并搜索propper(config)解决方案。