I can't start my Spring Boot application anymore after adding persistence. The error is:
java.lang.NoSuchMethodError: org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.<init>(Lorg/springframework/core/type/AnnotationMetadata;Ljava/lang/Class;Lorg/springframework/core/io/ResourceLoader;Lorg/springframework/core/env/Environment;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;)V
at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport$1.<init>(AbstractRepositoryConfigurationSourceSupport.java:68) ~[spring-boot-autoconfigure-1.5.7.RELEASE.jar:1.5.7.RELEASE]
I tracked this down to the changes in spring-data-commons where AnnotationRepositoryConfigurationSource resides and an additional constructor argument was added in version 1.13.5, and version 1.13.7 with the same constructor signature should be used by spring-boot-starter-data-jpa in version 1.5.7. And we only use Spring Boot dependencies with version number 1.5.7.
So then I built the dependency tree and strangely found spring-data-commons in version 1.13.4, not 1.13.7 (third to last line):
...(snippet)
[INFO] +- com.name.project:project-subproject8:jar:1.0.0-SNAPSHOT:compile
[INFO] | \- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.4.RELEASE:compile
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.15:compile
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.15:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.9.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.4.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.13.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-orm:jar:4.3.9.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.3.9.RELEASE:compile
...
Going up the tree you can see that spring-data-jpa is included in version 1.11.4, whereas, according to Spring Boot Dependency Appendix, it should be version 1.11.7. This seems to cause the error. But we don't depend on spring-data-jpa directly via our pom files.
So I don't know how this older version got into the dependency tree.
The pom of spring-boot-starter-data-jpa doesn't indicate any version numbers.
I had the same issue, and yeah it is SOLVED now!!!
You can always exclude particular inner dependency from the outer dependency. You have already given hint to solve this issue.
The root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it.
I switched to 1.5.7 version of spring boot, so i just needed to add jpa dependency compatible with spring boot 1.5.7 version. Why jpa dependency because - org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource is in the spring data package. And it worked
Related
I have a Java project which has a dependency of SpringBoot version 2.3.6.RELEASE. However, I'm in trouble trying to upgrade to 2.4.0 version. In the project nothing else was changed, only version of SpringBoot. Since then the application throws the following error message:
Caused by: java.lang.ClassCastException: com.nimbusds.jose.shaded.json.JSONObject cannot be cast to net.minidev.json.JSONObject
I did some comparison of maven dependency tree (mvn dependency:tree) and found out that probably some significant changes have been done for nimbus-jose-jwt and json-smart libs.
2.3.6.RELEASE
[INFO] +- org.springframework.security:spring-security-oauth2-jose:jar:5.3.5.RELEASE:compile
[INFO] | +- com.nimbusds:nimbus-jose-jwt:jar:8.19:compile (version managed from 8.20.1)
[INFO] | | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | | \- net.minidev:json-smart:jar:1.3.1:provided (scope managed from compile)
[INFO] | +- org.springframework.security:spring-security-core:jar:5.3.5.RELEASE:compile
2.4.0
[INFO] +- org.springframework.security:spring-security-oauth2-jose:jar:5.4.1:compile
[INFO] | +- com.nimbusds:nimbus-jose-jwt:jar:9.1.2:compile (version managed from 9.0.1)
[INFO] | | \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:5.4.1:compile
As can be seen above nimbus-jose-jwt has been updated from 8.19 to 9.1.2. Moreover, json-smart is not anymore part of nimbus-jose-jwt in 2.4.0.
The root cause is probably this change https://connect2id.com/blog/nimbus-jose-jwt-9
However, what should be done in order to prevent this exception?
You could override the default versions of jars nimbus-jose-jwt and json-smart, by adding the older version explicitly in your pom.
Please refer here : https://github.com/Azure/azure-sdk-for-java/issues/14898
In my case - I had to upgrade to 2.5.7 Springboot version and the nimbus-jose-jwt:jar version came with SB-2.5.7 is 9.10.1.
org.springframework.security:spring-security-oauth2-jose:jar:5.5.3:compile
[INFO] | +- (org.springframework.security:spring-security-core:jar:5.5.3:compile - version managed from 4.2.15.RELEASE; omitted for duplicate)
[INFO] | +- (org.springframework.security:spring-security-oauth2-core:jar:5.5.3:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:5.3.13:compile - version managed from 5.3.11; omitted for duplicate)
[INFO] | \- com.nimbusds:nimbus-jose-jwt:jar:9.10.1:compile
After downgrading the nimbus-jose-jwt to 8.20 the app started working.
I have following dependency tree.
[INFO] +- net.sf.jasperreports:jasperreports:jar:6.5.1:compile
[INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] | +- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] | | +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.6:compile
When I add dependency "commons-lang" as top level dependency in the pom file it automatically removes the transitive dependency for common-lang even without exclude it from pom file.
[INFO] +- net.sf.jasperreports:jasperreports:jar:6.5.1:compile
[INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] | +- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] | | +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] | | +- javax.inject:javax.inject:jar:1:compile
What is expected is it should exclude common-lang when we exclude it from jasperreports.
Dependency Mediation is the rule which you are talking about. It is one of the rule which maven follows to manage transitive dependencies.
It will put commons-lang in the dependency tree according to its nearest definition in the pom.
You can read about all the rules here :
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
So to quote them :
Dependency mediation - this determines what version of an artifact will be chosen when multiple versions are encountered as dependencies. Maven picks the "nearest definition". That is, it uses the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM.
And the dependency of commons-lang is never removed, its place in the transitive tree has changed. Now it has become a Level 1 dependency.
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] \- net.sf.jasperreports:jasperreports:jar:6.5.1:compile
[INFO] +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] +- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] | +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | +- stax:stax:jar:1.2.0:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile
When a dependency is declared in your projects pom maven will use that declaration instead of the transitive dependency.
Omitted dependencies are not displayed in the maven dependency tree, and I just learned that since maven-dependency-plugin version 3.0 the verbose option is no longer supported - which would show the omitted dependency.
I see this when I tried to provide -Dverbose option at maven command line (for "mvn dependency:tree -Dverbose=true"):
Verbose not supported since maven-dependency-plugin 3.0
See comments on answer in Display omitted versions in maven dependency:tree?
My pom references a parent pom with a lot of declared dependencies in the dependenyManagement section. This overwrites the version of a transitive dependency and causes runtime problems.
To solve this I now declare the transitive dependency as an explicit dependency, but it took me a while to figure out the problem. I would have noticed much sooner, if mvn dependency:tree would have shown me that the version was overwritten, but it did not.
Can you tell me how I can quickly see, where the versions of my dependency originate from and how I can see whether a transitive dependency was affected by the parent pom or not?
mvn dependency:tree -Dverbose=true
ought to do the trick. Alternativ, you can use:
mvn dependency:tree -X
Using Maven 3.3.9 and 3.5.2 (Both default to version 2.10 of maven-dependency-plugin:
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # xxx ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] xxx:jar:1.0.0-SNAPSHOT
[INFO] +- com.sun.mail:javax.mail:jar:1.5.6:runtime
[INFO] | \- (javax.activation:activation:jar:1.1:runtime - omitted for conflict with 1.1.1)
[INFO] +- org.eclipse.jgit:org.eclipse.jgit.junit:jar:4.7.0.201704051617-r:test
[INFO] | \- (org.eclipse.jgit:org.eclipse.jgit:jar:3.5.3.201412180710-r:test - version managed from 4.7.0.201704051617-r; omitted for conflict with 4.7.0.201704051617-r)
[INFO] +- org.eclipse.jgit:org.eclipse.jgit.junit.http:jar:4.7.0.201704051617-r:test
[INFO] | +- (org.eclipse.jgit:org.eclipse.jgit:jar:3.5.3.201412180710-r:test - version managed from 4.7.0.201704051617-r; omitted for conflict with 4.7.0.201704051617-r)
[INFO] | +- org.eclipse.jgit:org.eclipse.jgit.http.server:jar:4.7.0.201704051617-r:test
[INFO] | | \- (org.eclipse.jgit:org.eclipse.jgit:jar:3.5.3.201412180710-r:test - version managed from 4.7.0.201704051617-r; omitted for conflict with 4.7.0.201704051617-r)
[INFO] | +- (org.eclipse.jgit:org.eclipse.jgit.junit:jar:4.7.0.201704051617-r:test - omitted for duplicate)
[INFO] | \- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:test (version managed from 9.3.17.v20170317)
[INFO] | \- (org.eclipse.jetty:jetty-security:jar:9.4.7.v20170914:test - omitted for conflict with 9.3.19.v20170502)
[INFO] +- org.eclipse.jetty:jetty-security:jar:9.3.19.v20170502:test
[INFO] | \- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:test (version managed from 9.3.19.v20170502)
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:test
[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:test
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:test
[INFO] | | \- (org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:test - omitted for duplicate)
[INFO] | \- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:test
[INFO] | \- (org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:test - omitted for duplicate)
[INFO] \- org.springframework.boot:spring-boot-starter-data-ldap:jar:1.5.8.RELEASE:compile
[INFO] \- (org.slf4j:jcl-over-slf4j:jar:1.7.25:compile - scope updated from runtime; omitted for duplicate)
If you are using Eclipse with the M2 plugin, the tab "Dependency Hierarchy" on the POM will display omitted versions as well.
Use these plugins
https://maven.apache.org/plugins/maven-dependency-plugin/list-mojo.html
https://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html
Run command
mvn dependency:list
and
help:effective-pom
then compare two lists.
On Spring Boot 1.2.3.RELEASE trying to setup SSH on JDK 1.8, Windows 7.
I got the application.properties configured as:
shell.ssh.port=2212
shell.ssh.enabled=true
shell.auth=simple
shell.auth.simple.user.name=user
shell.auth.simple.user.password=password
When the application starts and trying to access it via putty, the following exception appears:
java.lang.IllegalStateException: No session available
at org.apache.sshd.common.AbstractSessionIoHandler.exceptionCaught(AbstractSessionIoHandler.java:52) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.exceptionCaught(DefaultIoFilterChain.java:697) ~[mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:483) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1100(DefaultIoFilterChain.java:46) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.exceptionCaught(DefaultIoFilterChain.java:791) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.IoFilterAdapter.exceptionCaught(IoFilterAdapter.java:111) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:483) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireExceptionCaught(DefaultIoFilterChain.java:471) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:359) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$700(DefaultIoFilterChain.java:46) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.sessionCreated(DefaultIoFilterChain.java:771) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.IoFilterAdapter.sessionCreated(IoFilterAdapter.java:79) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:357) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireSessionCreated(DefaultIoFilterChain.java:350) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.service.IoServiceListenerSupport.fireSessionCreated(IoServiceListenerSupport.java:211) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.addNow(AbstractPollingIoProcessor.java:514) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.handleNewSessions(AbstractPollingIoProcessor.java:481) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$200(AbstractPollingIoProcessor.java:67) [mina-core-2.0.2.jar:na]
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1071) [mina-core-2.0.2.jar:na]
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) [mina-core-2.0.2.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
Caused by: java.lang.AbstractMethodError: org.apache.sshd.common.keyprovider.AbstractKeyPairProvider.loadKeys()[Ljava/security/KeyPair;
at org.apache.sshd.common.keyprovider.AbstractKeyPairProvider.getKeyTypes(AbstractKeyPairProvider.java:49) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.sshd.server.session.ServerSession.sendKexInit(ServerSession.java:331) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.sshd.server.session.ServerSession.<init>(ServerSession.java:92) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.sshd.server.session.SessionFactory.doCreateSession(SessionFactory.java:43) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.sshd.common.session.AbstractSessionFactory.createSession(AbstractSessionFactory.java:38) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.sshd.common.AbstractSessionIoHandler.sessionCreated(AbstractSessionIoHandler.java:37) ~[sshd-core-0.6.0.jar:0.6.0]
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.sessionCreated(DefaultIoFilterChain.java:643) ~[mina-core-2.0.2.jar:na]
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:357) [mina-core-2.0.2.jar:na]
Is there something I am missing here?
Thanks.
Update:
Thanks for the pointers. Here is my dependency tree:
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.2.3.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-actuator:jar:1.2.3.RELEASE:compile
[INFO] \- org.springframework.boot:spring-boot-starter-remote-shell:jar:1.2.3.RELEASE:compile
[INFO] +- org.crashub:crash.cli:jar:1.3.1:compile
[INFO] +- org.crashub:crash.connectors.ssh:jar:1.3.1:compile
[INFO] | +- org.apache.sshd:sshd-core:jar:0.6.0:compile
[INFO] | +- org.apache.sshd:sshd-pam:jar:0.11.0:compile
[INFO] | | \- net.sf.jpam:jpam:jar:1.1:compile
[INFO] | +- org.bouncycastle:bcpkix-jdk15on:jar:1.51:compile
[INFO] | \- org.apache.mina:mina-core:jar:2.0.2:compile
[INFO] +- org.crashub:crash.embed.spring:jar:1.3.1:compile
[INFO] +- org.crashub:crash.plugins.cron:jar:1.3.1:compile
[INFO] | \- it.sauronsoftware.cron4j:cron4j:jar:2.2.5:compile
[INFO] +- org.crashub:crash.plugins.mail:jar:1.3.1:compile
[INFO] | \- javax.mail:mail:jar:1.4.7:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.crashub:crash.shell:jar:1.3.1:compile
[INFO] \- org.codehaus.groovy:groovy:jar:2.3.11:compile
All dependencies appear transitive from spring-boot-starter-remote-shell. I will try to fix up with manual override.
I started a spring boot project with jdk1.8, added the spring-boot-starter-remote-shell maven dependency & your configuration, gave it a go, and everything went smooth.
However java.lang.AbstractMethodError made me suspect a classpath issue, so I quickly ran a mvn dependency:tree on my project and, among others, spring-boot-starter-remote-shell:jar:1.2.3.RELEASE has org.apache.sshd:sshd-core:jar:0.11.0 as a transitive dependency as you can see below.
[INFO] +- org.springframework.boot:spring-boot-starter-remote-shell:jar:1.2.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-actuator:jar:1.2.3.RELEASE:compile
[INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:1.2.3.RELEASE:compile
[INFO] | +- org.crashub:crash.cli:jar:1.3.1:compile
[INFO] | +- org.crashub:crash.connectors.ssh:jar:1.3.1:compile
[INFO] | | +- org.apache.sshd:sshd-core:jar:0.11.0:compile <===THIS ONE===
[INFO] | | +- org.apache.sshd:sshd-pam:jar:0.11.0:compile
[INFO] | | | \- net.sf.jpam:jpam:jar:1.1:compile
[INFO] | | +- org.bouncycastle:bcprov-jdk15on:jar:1.51:compile
[INFO] | | +- org.bouncycastle:bcpkix-jdk15on:jar:1.51:compile
[INFO] | | \- org.apache.mina:mina-core:jar:2.0.7:compile
[INFO] | +- org.crashub:crash.embed.spring:jar:1.3.1:compile
[INFO] | +- org.crashub:crash.plugins.cron:jar:1.3.1:compile
[INFO] | | \- it.sauronsoftware.cron4j:cron4j:jar:2.2.5:compile
[INFO] | +- org.crashub:crash.plugins.mail:jar:1.3.1:compile
[INFO] | | \- javax.mail:mail:jar:1.4:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | +- org.crashub:crash.shell:jar:1.3.1:compile
[INFO] | \- org.codehaus.groovy:groovy:jar:2.3.11:compile
Another quick look at your stacktrace revealed that you seemed to have a different version on the classpath at org.apache.sshd.common.keyprovider.AbstractKeyPairProvider.getKeyTypes(AbstractKeyPairProvider.java:49) ~[sshd-core-0.6.0.jar:0.6.0] so what I did next was to manually specify this version as a dependency in the pom. When I rerun the app and attempted to connect via SSH I got the same exception as you did.
Also looking at the classes, the AbstractKeyPairProvider.loadKeys() method has a different signature which most likely messes up the implementations depending on the 0.11.0 contract, such as URLKeyPairProvider:
0.6.0 protected abstract KeyPair[] loadKeys();
0.11.0 public abstract Iterable<KeyPair> loadKeys();
So, either you also have added this version unintentionally, or some of your other dependencies are referring it, effectively shadowing 0.11.0 on the classpath. In my case I enabled the spring boot actuator HTTP endpoints confirming the above:
In conclusion, check your dependency tree and figure out where does the sshd-core 0.6.0 and perhaps mina-core 2.0.2 come from and exclude them.
I'm working on a Portlet project using Java8 and Spring 4.1.5
I have a class annotated with #Service that includes this line (same failure with any closure)
user.getOrganizations().stream().forEach(o -> System.out.println(o));
When I deploy my webapp I get the following error (omitting the massive stack-trace)
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\dev\liferay-developer-studio\DeveloperStudio\workspace\somepath\service\MyService.class];
nested exception is java.lang.ArrayIndexOutOfBoundsException: 52264
....
Caused by: java.lang.ArrayIndexOutOfBoundsException: 52264
at org.springframework.asm.ClassReader.readClass(Unknown Source)
My dependencies in MVN look like:
myGroupId:myArtifactId:war:0.0.0-SNAPSHOT
+- com.liferay.portal:portal-service:jar:6.2.10.11:provided
+- com.liferay.portal:util-bridges:jar:6.2.10.11:provided
+- com.liferay.portal:util-java:jar:6.2.10.11:provided
+- com.liferay.portal:util-taglib:jar:6.2.10.11:provided
+- javax.portlet:portlet-api:jar:2.0:provided
+- javax.servlet:servlet-api:jar:2.5:provided
+- javax.servlet.jsp:jsp-api:jar:2.2:provided
+- org.springframework:spring-webmvc-portlet:jar:4.1.5.RELEASE:provided
| +- org.springframework:spring-beans:jar:4.1.5.RELEASE:provided
| +- org.springframework:spring-context:jar:4.1.5.RELEASE:provided
| | +- org.springframework:spring-aop:jar:4.1.5.RELEASE:provided
| | | \- aopalliance:aopalliance:jar:1.0:provided
| | \- org.springframework:spring-expression:jar:4.1.5.RELEASE:provided
| +- org.springframework:spring-core:jar:4.1.5.RELEASE:provided
| | \- commons-logging:commons-logging:jar:1.2:provided
| +- org.springframework:spring-web:jar:4.1.5.RELEASE:provided
| \- org.springframework:spring-webmvc:jar:4.1.5.RELEASE:provided
+- org.springframework:spring-test:jar:4.1.5.RELEASE:test
+- org.mockito:mockito-all:jar:1.10.8:test
+- junit:junit:jar:4.11:test
| \- org.hamcrest:hamcrest-core:jar:1.3:test
+- org.powermock:powermock-module-junit4:jar:1.5.1:test
| \- org.powermock:powermock-module-junit4-common:jar:1.5.1:test
| \- org.powermock:powermock-reflect:jar:1.5.1:test
| \- org.objenesis:objenesis:jar:1.2:test
+- org.powermock:powermock-module-junit4-rule-agent:jar:1.5.1:test
| +- org.powermock:powermock-module-javaagent:jar:1.5.1:test
| \- org.powermock:powermock-core:jar:1.5.1:test
| \- org.javassist:javassist:jar:3.18.0-GA:test
\- org.powermock:powermock-api-mockito:jar:1.5.1:test
\- org.powermock:powermock-api-support:jar:1.5.1:test
Every solution that I've found so far says "If you are using spring 3 update to spring 4" but I'm already using it
Any ideas?
Cheers
Turns out that the issue is the container I'm working with - Liferay - has an older version of Spring (3.something).
The dependencies in my pom are provided; in addition in my liferay-plugin-package.properties the property portal-dependency-jars had the spring jars in the list.
This means that my plugin was using the Liferay's libs which have an older version of ASM unable to parse bytecode of classes using the new Java8 syntactical features, hence the breakage.
To solve it I got rid of the spring jars from liferay-plugin-package.properties and set the scope for spring in my pom to compile. This solved the problem.
(Note: Liferay doesn't officially support Java 8 at the moment so they are not meant to upgrade their spring version yet)