I was developping an atlassian plugin (JIRA) and tried to use java 8. By the way, JIRA is successfully running on JRE-1.8 without any troubles. More than that, I can use any new java class or method which appeared in java 8 (like java.time.LocalDate, for instance).
First thing I did - changed the version for maven-compiler-plugin:
<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin>
Everything is still working perfect. Plugin compiles, I can install and use it without any troubles.
When I add at least one syntactic feature which appeared in java 8 (lambda, method reference or anything else) anywhere, for example, this simple code:
List<String> list = Arrays.asList("1", "22", "333"); list.stream().map(String::length);
Code compiles without any issues. But when I try to install it to running JIRA instance, I see the following error in logs:
com.atlassian.plugin.PluginParseException: Unable to scan for host components in plugin classes at com.atlassian.plugin.osgi.factory.transform.stage.HostComponentSpringStage.execute(HostComponentSpringStage.java:62) at com.atlassian.plugin.osgi.factory.transform.DefaultPluginTransformer.transform(DefaultPluginTransformer.java:146) at com.atlassian.plugin.osgi.factory.OsgiPluginFactory.createOsgiPluginJar(OsgiPluginFactory.java:324) at com.atlassian.plugin.osgi.factory.OsgiPluginFactory.create(OsgiPluginFactory.java:229) at com.atlassian.jira.plugin.MasterPluginFactory.create(MasterPluginFactory.java:81) at com.atlassian.plugin.loaders.ScanningPluginLoader.deployPluginFromUnit(ScanningPluginLoader.java:155) at com.atlassian.plugin.loaders.ScanningPluginLoader.loadFoundPlugins(ScanningPluginLoader.java:117) at com.atlassian.plugin.loaders.PermissionCheckingPluginLoader.loadFoundPlugins(PermissionCheckingPluginLoader.java:30) at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:850) at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:799) at com.atlassian.jira.plugin.JiraPluginManager.installPlugins(JiraPluginManager.java:163) at sun.reflect.GeneratedMethodAccessor970.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegis trar.java:134) at com.sun.proxy.$Proxy73.installPlugins(Unknown Source) at sun.reflect.GeneratedMethodAccessor970.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1444.installPlugins(Unknown Source) at com.atlassian.upm.core.install.PluginArtifactInstallerImpl$1.doInTransaction(PluginArtifactInstallerImpl.java:55) at com.atlassian.upm.core.install.PluginArtifactInstallerImpl$1.doInTransaction(PluginArtifactInstallerImpl.java:50) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:25) at com.atlassian.jira.DefaultHostContextAccessor.doInTransaction(DefaultHostContextAccessor.java:34) at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegis trar.java:134) at com.sun.proxy.$Proxy417.doInTransaction(Unknown Source) at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:154) at com.sun.proxy.$Proxy417.doInTransaction(Unknown Source) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:21) at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy1505.execute(Unknown Source) at com.atlassian.upm.core.install.PluginArtifactInstallerImpl.installPlugins(PluginArtifactInstallerImpl.java:49) at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installSingleArtifact(AbstractPluginInstallHandler.java:94) at com.atlassian.upm.core.install.JarPluginInstallHandler.installPluginInternal(JarPluginInstallHandler.java:47) at com.atlassian.upm.core.install.AbstractPluginInstallHandler.installPlugin(AbstractPluginInstallHandler.java:48) at com.atlassian.upm.core.install.DefaultPluginInstallationService.execute(DefaultPluginInstallationService.java:111) at com.atlassian.upm.core.install.DefaultPluginInstallationService.install(DefaultPluginInstallationService.java:87) at com.atlassian.upm.install.UpmPluginInstallationService.install(UpmPluginInstallationService.java:94) at com.atlassian.upm.core.rest.resources.install.InstallTask.installFromFile(InstallTask.java:123) at com.atlassian.upm.core.rest.resources.install.InstallFromFileTask.executeTask(InstallFromFileTask.java:38) at com.atlassian.upm.core.rest.resources.install.InstallTask.call(InstallTask.java:60) at com.atlassian.upm.core.rest.resources.install.InstallTask.call(InstallTask.java:34) at com.atlassian.upm.core.rest.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:78) at com.atlassian.upm.core.rest.async.AsynchronousTaskManager$1.call(AsynchronousTaskManager.java:73) at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:42) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Error parsing class file at com.atlassian.plugin.osgi.util.ClassBinaryScanner.scanClassBinary(ClassBinaryScanner.java:66) at com.atlassian.plugin.osgi.factory.transform.stage.HostComponentSpringStage.findUsedHostComponents(HostComponentSpringStage.java:194) at com.atlassian.plugin.osgi.factory.transform.stage.HostComponentSpringStage.execute(HostComponentSpringStage.java:58) ... 88 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 18 at aQute.lib.osgi.Clazz.parseClassFile(Clazz.java:448) at aQute.lib.osgi.Clazz.parseClassFile(Clazz.java:369) at aQute.lib.osgi.Clazz.parseClassFileWithCollector(Clazz.java:359) at com.atlassian.plugin.osgi.util.ClassBinaryScanner.scanClassBinary(ClassBinaryScanner.java:38) ... 90 more
Is it possible to make it working with java 8?
Community moderators have prevented the ability to post new answers.
By the way, it is resolved in JIRA-7. I had checked. Works fine with lambdas, method references and everything else.
As Bernard Jaquet suggested in the comment, lambda expressions might be the cause for this, at least it was for me. After removing them from my code (that is, replacing with old-school java code), I was able to successfully upload the new version compiled on java 8.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same problem with Jira 7.13, now what's up with that?
Runtime is Java 8, plugin was compiled with Java 8.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
UPM seems to choke on a 3rd party library containing a module-info.class file in the jar (although it says it's compatible with Java 8?).
Hm, and my plugin's MANIFEST says it requires JavaSE 9.0, which I don't even have installed on my system. WTF?
Oh nice, the version of biz.aqute.bndlib is still 2.4.1, from 2015.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Compiling with AMPS 6.2 at least fails early, because AMPS includes an old bndlib version that cannot parse the module-info.class.
With AMPS 8.0.0 everything builds fine, but installation on Jira 7.13 fails (because Jira still uses that ancient version, even after upgrading UPM). I got the plugin working by
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ulrich Hobelmann [catworkx]
Could you please show us how you configured this ? I'm not finding any doc on this.
Also, are you using jira-maven-plugin or maven-jira-plugin (with AMPS 8 it should be jira-maven-plugin).
Thanks, I'm having a third party dependency that seems to make the plugin install fail.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I used amps 8, as you say.
For the jar plugin:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<excludes>
<exclude>**/module-info.class</exclude>
</excludes>
</configuration>
</plugin>
For the jira-maven-plugin, the following:
<instructions>
<Import-Package>
...
</Import-Package>
<Require-Capability>
<![CDATA[osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"]]>
</Require-Capability>
<CONF_COMM />
</instructions>
in addition to whatever imports you need there.
Hope this helps...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for the answer @Ulrich Hobelmann [catworkx]
I'll test this this morning and come back to say if it helped.
But anyway, I'm very grateful you came to share your solution. Thanks !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately it did not help, here is the error :
2019-05-29 08:53:36,799 UpmAsynchronousTaskManager:thread-3 ERROR admin 580x4716x1 14qajfm 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ [c.a.plugin.loaders.ScanningPluginLoader] Unable to deploy plugin
2019-05-29 08:53:36,799 UpmAsynchronousTaskManager:thread-3 ERROR admin 580x4716x1 14qajfm 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ [c.a.plugin.loaders.ScanningPluginLoader] Because of the following exception:
java.lang.NullPointerException
at com.atlassian.plugin.osgi.factory.transform.stage.HostComponentSpringStage.addHostComponentsUsedInSuperClasses(HostComponentSpringStage.java:235)
at com.atlassian.plugin.osgi.factory.transform.stage.HostComponentSpringStage.findUsedHostComponents(HostComponentSpringStage.java:220)
I don't know if it's the same cause (dependency with jdk8) but the same plugin with the same dependency at a previous version works fine, but from one version up, it fails.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, that doesn't look familiar. I'm not sure what a HostComponentSpringStage is. Are there exceptions before that? Maybe the NPE is because some classes were not found (if your OSGi doesn't include everything you need)? Otherwise, no idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope no other exception.
Before I had a different exception with AMPS 6, which directed to a BND problem with JDK 8 (lambdas), but with AMPS 8, I just have this NPE.
Maybe if I could find the source code of this HostComponentSpringStage I could try to debug this.
But the imports are the same in both working and failing versions, only the external dependency version changes.
I opened an AMPS support ticket for this, if you want to follow :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ulrich Hobelmann [catworkx] Thanks a looooot !
Finally got it working.
So what I did is :
So a huge thanks to you for your (quick) answers, and for pointing me in the right direction !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Added a comment on the AMPS issue to let them know where it is in their code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good. So looks like the same problem with a different dependency and in your case in a different component (I didn't use Spring scanner in the plugin, maybe that's why?). Hope Atlassian upgrades all their components asap to be able to process jars from newer Java versions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far I can tell only lambda expressions are impacted, other things like streams are working just fine on JIRA 6.4.11.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has anyone found the solution? I am on jira 6.4.11, almost latest version and still have the same issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.