Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BootstrapApplicationListener.CloseContextOnFailureApplicationListener missing method implementation #552

Closed
gsbtech opened this issue Apr 16, 2019 · 11 comments

Comments

@gsbtech
Copy link

gsbtech commented Apr 16, 2019

Using

      <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-starter-openfeign</artifactId>
     <version>2.1.1.RELEASE</version>

        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-context</artifactId>
       <version>2.1.1.RELEASE</version>

does not work with spring.boot 4.3.18+ or 5.x
because class org.springframework.cloud.bootstrap.BootstrapApplicationListener.CloseContextOnFailureApplicationListener does not implement method SmartApplicationListener.supportsSourceType()

Current spring 5.1.6, org.springframework.context.event.SmartApplicationListener
still shows the method in question.
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/event/SmartApplicationListener.html

Run error:

Error:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-Apr-16 16:54:23.591Z level=ERROR thread=main pid=84562 code_location=o.s.boot.SpringApplication Application run failed
java.lang.AbstractMethodError: null
at org.springframework.core.OrderComparator.findOrder(OrderComparator.java:142)
at org.springframework.core.annotation.AnnotationAwareOrderComparator.findOrder(AnnotationAwareOrderComparator.java:65)
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:125)
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:113)
at org.springframework.core.OrderComparator.doCompare(OrderComparator.java:82)
at org.springframework.core.OrderComparator.compare(OrderComparator.java:68)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:360)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1462)
at org.springframework.boot.SpringApplication.asUnmodifiableOrderedSet(SpringApplication.java:1325)
at org.springframework.boot.SpringApplication.getListeners(SpringApplication.java:1234)
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:85)
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:66)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:394)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:328)
at com.xoom.inf.boot.api.autoconf.XoomBootApplication.run(XoomBootApplication.java:70)
at com.xoom.platform.trust.Application.runApplication(Application.java:112)
at com.xoom.platform.trust.Application.main(Application.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
@spencergibb
Copy link
Member

Please show all your dependencies, you have an incompatible version of Framework

@gsbtech
Copy link
Author

gsbtech commented Apr 18, 2019

Using springframework 5.0.8.RELEASE. I also tried older 4.3.18.RELEASE
Here is mvn dependency:tree:

tree.log

@spencergibb
Copy link
Member

Spring Cloud Greenwich (2.1.x) is not compatible with spring boot 2.0.x and spring framework 5.0.x. Either update spring boot or downgrade spring cloud to Finchley.

@gsbtech
Copy link
Author

gsbtech commented Apr 18, 2019

What version of spring framework is
Spring Cloud Greenwich (2.1.x) compatible with?
As mentioned in first message in this posting I checked spring 5.1.6, and cloud still had that problem

Current spring 5.1.6, org.springframework.context.event.SmartApplicationListener
still shows the method in question.
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/event/SmartApplicationListener.html

Do you mean that a different path to spring boot will not trigger
org.springframework.cloud.bootstrap.BootstrapApplicationListener.CloseContextOnFailureApplicationListener?

@spencergibb
Copy link
Member

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

If so, we can reconsider reopening the issue.

@gsbtech
Copy link
Author

gsbtech commented Apr 18, 2019

Let me see if I can write a tiny example with spring 5.1.x

@gsbtech
Copy link
Author

gsbtech commented Apr 19, 2019

We are using a wrapper around spring-boot, so it will take me some time to generate a demo.

Bottomline, this error reported is very straightforward. There is no need for a demo.

Inner Class
org.springframework.cloud.bootstrap.BootstrapApplicationListener.CloseContextOnFailureApplicationListener does not implement method SmartApplicationListener.supportsSourceType() where SmartApplicationListener is the interface that it implements.

So any code using CloseContextOnFailureApplicationListener will definitely fail, because class CANNOT be instantiated (becomes kind of abstract).

Other solution is to deprecate CloseContextOnFailureApplicationListener if applicable.

@spencergibb
Copy link
Member

But that only happens when there are incompatible versions on the classpath.

@gsbtech
Copy link
Author

gsbtech commented Apr 19, 2019

spring-cloud 2,1,x should work with spring 5.1.x and probably also spring 5.0.x according to the release.
Just look at SmartApplicationListener from any 5.x, all flavors have the method that the cloud inner class org.springframework.cloud.bootstrap.BootstrapApplicationListener.CloseContextOnFailureApplicationListener does not implement.

@spencergibb
Copy link
Member

Spring Framework 5.x requires java 8. Java 8 supports default methods in interfaces:

Spring Cloud 2.x+ also requires java 8.

https://github.com/spring-projects/spring-framework/blob/42fc4a35d59a37131bfe15d029738ab25f358241/spring-context/src/main/java/org/springframework/context/event/SmartApplicationListener.java#L49-L51

@gsbtech
Copy link
Author

gsbtech commented Apr 22, 2019

Java 8 is being used.
I see the default in 5.1.x but not in 5.0.x. Sorry, I missed this, I looked at the Javadoc and missed the"default" qualifier.
The Release Notes seems to indicate that spring boot 2.x is supported.

https://spring.io/blog/2019/01/23/spring-cloud-greenwich-release-is-now-available

The Spring Cloud Greenwich release train is considered a minor release and will continue support for the Spring Boot 2.x release branch.

Probably need to update Release Notes.

Thank you. I see I need spring boot 2.1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants