Classes not found in Jira 8.0 EAP

Hi,

I’m testing an app in current Jira 8.0 EAP (v8.0.0-m0025) and I have problems with several classes. I can’t find any information in the document Preparing for Jira 8.0 related to these classes. The classes are:

  • com.atlassian.jira.rest.v2.issue.RESTException
  • com.atlassian.jira.rest.v2.issue.UserPickerUser

Both classes are part of jira-rest-plugin.

When I put Jira version 8.0.0-m0025 in my app’s pom.xml, no compiled error are shown with these classes. I’ve reviewed my Jira 8.0 instance and this plugin exists and is enabled.

Why now my app doesn’t found these classes if they are present? In previous version of Jira they was working.

Anyone has a similar problem?

Thanks, Carlos

Do you mean 7.13, or previous EAP?

Why now my app doesn’t found these classes

What error are you getting? Can you paste the error message?

Did you check your <Import-Package> directives? See Configuration of Instructions in Atlassian Plugins.

Hi

Do you mean 7.13, or previous EAP?

In 7.1.3 and previous versions

What error are you getting? Can you paste the error message?

This is the error for UserPickerUser, the other class throw the same error

Uncaught exception thrown by REST service: com/atlassian/jira/rest/v2/issue/UserPickerUser
java.lang.NoClassDefFoundError: com/atlassian/jira/rest/v2/issue/UserPickerUser
	at com.deiser.jira.profields.rest.internal.v2.helper.UserRestHelper.makeUserPickerBean(UserRestHelper.java:147)
	at com.deiser.jira.profields.rest.internal.v2.helper.UserRestHelper.findUsersAsBean(UserRestHelper.java:98)
	at com.deiser.jira.profields.rest.internal.v2.UserRest.findUsers(UserRest.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	... 1 filtered
	at java.lang.reflect.Method.invoke(Method.java:498)
	... 19 filtered
	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:159)
	... 1 filtered
	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:69)
	... 41 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 53 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
	... 1 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
	... 16 filtered
	at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37)
	... 19 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 10 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 4 filtered
	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
	... 26 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 24 filtered
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.atlassian.jira.rest.v2.issue.UserPickerUser not found by com.deiser.jira.profields [181]
	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 235 more

Did you check your <Import-Package> directives?

Yes, but I don’t know what I need to put there.
Should I add any directive to import the plugin “jira-rest-plugin”?
As I said before, we don’t need that directive in previous versions of Jira

Thank you @kcichy

Would you mind sharing your <Import-Package>?

Do you have

*;version="0";resolution:=optional

or

com.atlassian.jira.rest.v2.issue

there?

I didn’t have this configuration in the pom.xml, previously I didn’t need it.

I’ve tried to add it but I always get this error:

The default package ‘.’ is not permitted by the Import-Package syntax.

I’ve put these different configurations:

<instructions>
    <Import-Package>com.atlassian.jira.rest.v2.issue</Import-Package>
</instructions>
<instructions>
    <Import-Package>resolution:="optional",*</Import-Package>
</instructions>
<instructions>
    <Import-Package>com.atlassian.jira.rest.v2.issue.*;resolution:="optional",*</Import-Package>
</instructions>

Sure I’m doing something wrong.

Thanks, Carlos

I was able to reproduce the problem in one of our plugins and the following import instructions fixed it:

                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.jira.rest.v2.issue,
                            *
                        </Import-Package>

Can you try this? Of course you need to rebuild and reinstall the plugin to make it work.

Hi @kcichy
Sorry, the problem with the default package is caused by one maven plugin that generate some classes without package.
I added your Import-Package and the add-on compiles, but when I try to install it, Jira throws an error:

org.osgi.framework.BundleException:....(osgi.wiring.package=bsh)...

I add “bsh” to the Import-Package and then Jira throws:

org.osgi.framework.BundleException:....(osgi.wiring.package=com.bea.jvm)...

I repeat the operation and each time Jira throws another error:

org.osgi.framework.BundleException:....(osgi.wiring.package=com.opensymphony.user)...
...
org.osgi.framework.BundleException:....(osgi.wiring.package=com.opensymphony.xwork)...
...
org.osgi.framework.BundleException:....(osgi.wiring.package=com.thoughtworks.qdox)

We are not using these packages

Thanks

Carlos

the problem with the default package

Do I understand this right that * pulls in all packages, but it blows up, because you have the default package too?

one maven plugin that generate some classes without package

What plugin is it? Is it configurable to put its output to a non-default package?

I don’t explain very well :smiley: Import-Package doesn’t allow classes wit h default package. And the add-on doens’t compile until several classes has a package, but that problem is already solved.

I’ve added all the error that Jira was throwing to the Import-Package until Jira didn’t throw install errors anymore, but when I go to the page that is using the “com.atlassian.jira.rest.v2.issue.UserPickerUser”…the first error (java.lang.NoClassDefFoundError: com/atlassian/jira/rest/v2/issue/UserPickerUser) persists.

Regards @kcichy

Hi @kcichy

The problem has been solved when I’ve upgraded to the latest version of Jira 8 (v8.0.0-m0030). Probably something was not correct in the previous EAP (v8.0.0-m0025) for these classes.

I’ve removed the Import-Package completely and the app is working again.

Thank you for answer.

Regards.

I’m glad you’re unblocked now.
Thanks for letting me know!