Plugin error - nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException

fla_91 August 4, 2016

I have to use the Jackson Library in my Plugin, so i add them to my pom.xml 

<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.8.0</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.8.0</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.8.0</version>
			<scope>compile</scope>
		</dependency>

 

But i get always this error in the log-file when i run JIRA

'com.jazz.scheduler.plugins.jazz-scheduler-plugin' - 'Jazz Scheduler Plugin'  failed to load.
		Error creating bean with name 'jazz-scheduler' defined in URL [bundle://174.0:0/META-INF/spring/atlassian-plugins-components.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.jazz.scheduler.plugins.JazzScheduler]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
			Failed to instantiate [com.jazz.scheduler.plugins.JazzScheduler]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
				com/fasterxml/jackson/core/JsonProcessingException
					com.fasterxml.jackson.core.JsonProcessingException not found by com.jazz.scheduler.plugins.jazz-scheduler-plugin [174]

 

it always works, but suddenly i got this error every time.

i also tried with <scope>provided</scope> but it also do not worked..

 

how can i include the dependency correctly that the plugin-jar includes them after packing? 

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2016

Your dependencies look correct. How did you build and deploy the jar? Did you do mvn clean install? Did you run with atlas-run or something else? You haven't tried using "pi" on JIRA 7, right?

Do a clean build and look at what's there in the jar file - amps should have packaged all classes from those three libraries inside your plugin jar - check that this is the case.

It would also help if you post the code of the com.jazz.scheduler.plugins.JazzScheduler class.

fla_91 August 4, 2016

i got it know.. i saw that the jar-file only had about 200kb.. the 3 dependencies have got about 1200kb togehter..

so i used atlas-clean to delete the whole target-folder.. after i used atlas-package and now the file has about 1700kb and it works now..

that's really strange that from one run to the other, the dependencies were not included in the jar..

 

are there any diffrences between atlas-package and atlas-release.. when i run atlas-release i get errors.. sth like this:

unable to execute mojo: java.lang.reflect.InvocationTargetException: NullPointerException

with altas-package i don't get any errors and the plugin works

0 votes
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2016

JIRA itself is using Jackson 1 and it will be exported for REST.  This is likely to clash with you trying to use Jackson 2.

If you were just using Jackson 2 because it's the latest and that seemed like the right thing to do, but you can get by using Jackson 1 instead if you have to, then that is probably the simplest answer.

If you aren't going to use any <rest> modules at all, then I would expect you to be able to use exclusions in the manifest instructions (specifying the jackson packages with "!" in front of them) to prohibit their import, allowing you to use a private version.  Another option is to use the Maven Shade Plugin to relocate Jackson's classes to another package so that they will no longer clash.

If you need <rest> modules and you also need to use an unshaded Jackson 2 to talk to another library, then I think you're out of luck.  You can't do both of those from inside the same classloader, so I think that you would have to split your plugin into 2 pieces to make it work.

 

Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2016

Class clashing could not possibly be the reason for this - the root packages are different between Jackson 1 and Jackson 2. Also we have an add-on that packages Jackson 2 and there is no problem with that. The reason is more trivial in my opinion.

TAGS
AUG Leaders

Atlassian Community Events