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

Error with EurekaServer in standalone mode. #120

Closed
wgorder opened this issue Dec 28, 2014 · 12 comments
Closed

Error with EurekaServer in standalone mode. #120

wgorder opened this issue Dec 28, 2014 · 12 comments

Comments

@wgorder
Copy link

wgorder commented Dec 28, 2014

So I have this project I am trying to get working in a certain way and I keep running into stuff, so I have started a public repo that I can create a simpler example with, and maybe it will help others to as it evolves.

I was trying to get the standalone eureka server configuration working as outlined in the documentation and I get this exception below when I hit the dashboard. You can reproduce from here:

https://github.com/wgorder/service-discovery

serviceDiscovery_1 | [2014-12-08 10:33:50.931] boot - 1 ERROR [http-nio-8761-exec-1] --- StatusResource: Could not determine if the replica is available 
serviceDiscovery_1 | java.lang.NullPointerException
serviceDiscovery_1 |    at com.netflix.eureka.resources.StatusResource.isReplicaAvailable(StatusResource.java:90)
serviceDiscovery_1 |    at com.netflix.eureka.resources.StatusResource.getStatusInfo(StatusResource.java:70)
serviceDiscovery_1 |    at org.springframework.cloud.netflix.eureka.server.EurekaController.status(EurekaController.java:40)
serviceDiscovery_1 |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
serviceDiscovery_1 |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
serviceDiscovery_1 |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
serviceDiscovery_1 |    at java.lang.reflect.Method.invoke(Method.java:483)
serviceDiscovery_1 |    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
serviceDiscovery_1 |    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
serviceDiscovery_1 |    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
serviceDiscovery_1 |    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
serviceDiscovery_1 |    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
serviceDiscovery_1 |    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
serviceDiscovery_1 |    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
serviceDiscovery_1 |    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
serviceDiscovery_1 |    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
serviceDiscovery_1 |    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
serviceDiscovery_1 |    at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
serviceDiscovery_1 |    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
serviceDiscovery_1 |    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
serviceDiscovery_1 |    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:288)
serviceDiscovery_1 |    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
serviceDiscovery_1 |    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:100)
serviceDiscovery_1 |    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)
serviceDiscovery_1 |    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:90)
serviceDiscovery_1 |    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
serviceDiscovery_1 |    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
serviceDiscovery_1 |    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
serviceDiscovery_1 |    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
serviceDiscovery_1 |    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
serviceDiscovery_1 |    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
serviceDiscovery_1 |    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
serviceDiscovery_1 |    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
serviceDiscovery_1 |    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
serviceDiscovery_1 |    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
serviceDiscovery_1 |    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
serviceDiscovery_1 |    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
serviceDiscovery_1 |    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556)
serviceDiscovery_1 |    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513)
serviceDiscovery_1 |    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
serviceDiscovery_1 |    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
serviceDiscovery_1 |    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
serviceDiscovery_1 |    at java.lang.Thread.run(Thread.java:745)

@dsyer
Copy link
Contributor

dsyer commented Dec 29, 2014

As far as I know that's harmless. I think it's just a sign that the Eureka client part of the server hasn't started up properly yet (it takes a while). Unfortunately the error is logged by third party code (Netflix) so it's not possible to suppress it without just switching off logging for that channel (which is what I usually do).

@wgorder
Copy link
Author

wgorder commented Dec 29, 2014

Thanks Dave. One other quick Eureka related question if I could. I noticed that the client connects but it shows as registered but unavailable rather than available. Is that normal?

@dsyer
Copy link
Contributor

dsyer commented Dec 29, 2014

Which client?

@wgorder
Copy link
Author

wgorder commented Dec 29, 2014

Well I have a UI piece that registers itself with the server. When you go to the Eureka server dashboard you see that it is unavailable.
screen shot 2014-12-29 at 11 52 00 am

@wgorder
Copy link
Author

wgorder commented Dec 29, 2014

meh I guess its the replica that is unavailable. That is probably just because I am running stand-alone.

@dsyer
Copy link
Contributor

dsyer commented Dec 29, 2014

Yes. It all looks normal to me. And the original error you posted goes away if you wait a bit?

@wgorder
Copy link
Author

wgorder commented Dec 29, 2014

Seems to have thanks! Next step SSO :)

@wgorder wgorder closed this as completed Dec 29, 2014
@shuraa
Copy link

shuraa commented Mar 17, 2016

@dsyer why this exception is normal? I think there is bug in implementation of isReplicaAvailable

    private boolean isReplicaAvailable(String myAppName, String url) {

        try {
            String givenHostName = new URI(url).getHost();
            Application app = PeerAwareInstanceRegistry.getInstance()
            .getApplication(myAppName, false);
            for (InstanceInfo info : app.getInstances()) {
                if (info.getHostName().equals(givenHostName)) {
                    return true;
                }
            }
            givenHostName = new URI(url).getHost();
        } catch (Throwable e) {
            logger.error("Could not determine if the replica is available ", e);
        }
        return false;
    }

since app can be null by contract of PeerAwareInstanceRegistry.getApplication(...), so if there is no app instance - no replica is available for now and isReplicaAvailable have to return false without any exception in log.

@dsyer
Copy link
Contributor

dsyer commented Mar 17, 2016

I guess I agree. But that code is in com.netflix.eureka.util.StatusUtil, so please raise an issue and try and get it fixed in Eureka (I already pointed this out in a comment above).

@shuraa
Copy link

shuraa commented Mar 17, 2016

@dsyer, ok

@shuraa
Copy link

shuraa commented Mar 18, 2016

Its seems that issue has been already fixed in https://github.com/Netflix/eureka/releases/tag/v1.3.0

@dsyer
Copy link
Contributor

dsyer commented Mar 18, 2016

Should be fixed in Spring Cloud Netflix 1.1 then (unless they had a regression).

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