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

Support spring-boot 1.3.0 #326

Closed
xxlabaza opened this issue Apr 30, 2015 · 11 comments
Closed

Support spring-boot 1.3.0 #326

xxlabaza opened this issue Apr 30, 2015 · 11 comments

Comments

@xxlabaza
Copy link

Hi,

The issue is connected with this one: #212

My pom.xml dependencies block:

    ...
    <dependencies>
       ...
       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-feign</artifactId>
            <version>1.0.2.BUILD-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-security</artifactId>
            <version>1.0.2.BUILD-SNAPSHOT</version>
        </dependency>
        ...
    </dependencies>
    ...

My Main.class app class:

@EnableHystrix
@EnableEurekaClient
@EnableFeignClients
@EnableOAuth2Resource
@SpringBootApplication
public class Main {

    public static void main (String[] args) {
        new SpringApplicationBuilder(Main.class)
                .web(true)
                .run(args);
    }
}

My ClientApi.class:

@FeignClient("clientsample")
interface ClientApi {

    @RequestMapping(
            value = "/who",
            method = RequestMethod.GET
    )
    String getWho ();
}

And my bootstrap.yml has the next configuration:

...
spring:
  oauth2:
    resource:
      userInfoUri: <http://my-domain.com/auth/user>
...

When I try to start my Spring Boot app it prints the following:

Caused by: java.lang.NullPointerException: encoder
    at feign.Util.checkNotNull(Util.java:93)
    at feign.ReflectiveFeign$ParseHandlersByName.<init>(ReflectiveFeign.java:138)
    at feign.ReflectiveFeign$ParseHandlersByName$$InjectAdapter.get(ReflectiveFeign$ParseHandlersByName$$InjectAdapter.java:67)
    at feign.ReflectiveFeign$ParseHandlersByName$$InjectAdapter.get(ReflectiveFeign$ParseHandlersByName$$InjectAdapter.java:19)
    at feign.ReflectiveFeign$$InjectAdapter.get(ReflectiveFeign$$InjectAdapter.java:62)
    at feign.ReflectiveFeign$$InjectAdapter.get(ReflectiveFeign$$InjectAdapter.java:23)
    at feign.ReflectiveFeign$Module$$ModuleAdapter$ProvideFeignProvidesAdapter.get(ReflectiveFeign$Module$$ModuleAdapter.java:114)
    at feign.ReflectiveFeign$Module$$ModuleAdapter$ProvideFeignProvidesAdapter.get(ReflectiveFeign$Module$$ModuleAdapter.java:78)
    at dagger.ObjectGraph$DaggerObjectGraph.get(ObjectGraph.java:272)
    at feign.Feign$Builder.target(Feign.java:265)
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:126)
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:136)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
    ... 44 more

If I turn off Spring Security:

  • remove dependency from pom.xml;
  • remove oauth2 configuration from bootstrap.yml.

it works perfectly, but how to run it with Spring Security?

@spencergibb
Copy link
Member

@xxlabaza I am unable to reproduce your problem with this sample. Do you have a sample project you can share?

@xxlabaza
Copy link
Author

xxlabaza commented May 1, 2015

@spencergibb
Copy link
Member

@xxlabaza we don't support spring-boot 1.3.0 yet. Changing to 1.2.3.RELEASE and I didn't get your error.

@xxlabaza
Copy link
Author

xxlabaza commented May 1, 2015

Oh, this is very sad, I've lost 2 days =(

@spencergibb
Copy link
Member

@xxlabaza we will, we just haven't started it yet. This will be an issue when we start

@spencergibb spencergibb changed the title NullPointerException: encoder, while creating FiegnClient NullPointerException: encoder, while creating FiegnClient with spring-boot 1.3.0.BUILD-SNAPSHOT May 1, 2015
@theevangelista
Copy link

If it can help, I had the same issue while trying to upgrade to boot 1.3.0.BUILD-SNAPSHOT. I debugged the source code while initializing the application, seems it's caused by FeignClientsConfiguration beans, which was not been created in time to FeignClientFactoryBean autowire dependencies, strange is it isn't creating any Spring autowire exception, but the @Autowired private Encoder encoder; has receiving null, and the debugger didn't pass through FeignClientsConfiguration, class.
Maybe an configuration order issue came from the framework or race condition ?

@kristofferpeterhansel
Copy link

I'm getting this exact issue with Spring Boot 1.2.3 and Spring Cloud 1.0.0 (or 1.0.1 for that matter).

In my case it may have been triggered by moving to Spring Data "Fowler" and MongoDB 3.0 drivers. At least that is the main major dependency chance since it started happening. And the issue happens when a MongoDB repository needs a client to a service that is implemented with the Feign support

The interesting part is that I don't see this running it locally in my IDE. But it does happen when I run it in on my server. So it does indeed appear it may be a race condition.

@spencergibb spencergibb changed the title NullPointerException: encoder, while creating FiegnClient with spring-boot 1.3.0.BUILD-SNAPSHOT Support spring-boot 1.3.0 Jun 17, 2015
@spencergibb
Copy link
Member

See this initializr commit spring-io/initializr@e6a1a17

@jordanjennings
Copy link

+1 for Spring Boot 1.3.0 support. Is there any general timeline in mind for this (even for a snapshot version)?

@spencergibb
Copy link
Member

Not a date, but in the pipeline it would not be a minor release. There is a minor release that needs to come first. We'll probably have at least one milestone and release candidate.

@spencergibb
Copy link
Member

Closed via spring-cloud/spring-cloud-build@dd98d1e

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

5 participants