JSONException using Netflix Eureka


cigarette

I'm pretty new to Netflix Eureka and SpringBoot. I built a very simple Eureka server and client to see how they do long term discovery. When I see the UI when I go to localhost:8761/, the Eureka server loads itself normally.

I am using Eclipse's Tomcat to run both instances.

The Eureka client I built has no code as it just runs a SpringBoot application with the appropriate annotations. Same thing about Eureka server.

When running the client, after running the server, you will get the following stack. I searched online for some explanations but didn't find any. Do you know what is causing these JSONObject exceptions?

Server side stack : http://pastebin.ca/2968955

Client stack : http://pastebin.ca/2968957

Here is my code:

EurekaServer.java:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
@EnableEurekaServer
public class EurekaServer {
		public static void main( String[] args ) {
    	    SpringApplication.run(EurekaServer.class, args);
    }
}

EurekaServer-like application.yml:

spring:
  application:
    name: EurekaServer

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    festRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

EurekaClientApp.java:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableEurekaClient
@RestController
public class EurekaClientApp {
	public static void main(String[] args) {
		SpringApplication.run(EurekaClientApp.class, args);
	}
}

EurekaClient 的 Application.yml :

spring:
  application:
    name: EurekaClient
    
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    registerWithEureka: true
    fetchRegistry: false
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}

server:
  port: 8188

eureka-client.properties:

eureka.port=8188
eureka.vipAddress=productservice.mydomain.net
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.availabilityZones=default
eureka.serviceUrl.defaultZone=http://localhost:8761/eureka/

cigarette

So after hours of trying to modify the code to make it fail, I looked at the pom.xmlfiles and removed the dependencies attached to this part of the application. Then I put them back one by one, verified the modifications it made, and found out that I had the wrong dependencies eurekabecause I replaced my own dependencies with the ones com.netflix.eurekaprovided by springboot , eg spring-cloud-starter-eureka.

Related


JSONException using Netflix Eureka

cigarette I'm pretty new to Netflix Eureka and SpringBoot. I built a very simple Eureka server and client to see how they do long term discovery. When I see the UI when I go to localhost:8761/, the Eureka server loads itself normally. I am using Eclipse's Tomc

Using Netflix Eureka on Kubernetes

rajesh023 We are currently using spring boot and netflix components to set up a microservices architecture, for Deployment we plan to use aws kubernetes (EKS) setup. We're in a dilemma when it comes to choosing between using netflix's Eureka and Ribbon service

Using Netflix Eureka on Kubernetes

rajesh023 We are currently using spring boot and netflix components to set up a microservices architecture, for Deployment we plan to use aws kubernetes (EKS) setup. We're in a dilemma when it comes to choosing between using netflix's Eureka and Ribbon service

Using Netflix Eureka on Kubernetes

rajesh023 We are currently using spring boot and netflix components to set up a microservices architecture, for Deployment we plan to use aws kubernetes (EKS) setup. We're in a dilemma when it comes to choosing between using netflix's Eureka and Ribbon service

Using Netflix Eureka on Kubernetes

rajesh023 We are currently using spring boot and netflix components to set up a microservices architecture, for Deployment we plan to use aws kubernetes (EKS) setup. We're in a dilemma when it comes to choosing between using netflix's Eureka and Ribbon service

Using Netflix Eureka on Kubernetes

rajesh023 We are currently using spring boot and netflix components to set up a microservices architecture, for Deployment we plan to use aws kubernetes (EKS) setup. We're in a dilemma when it comes to choosing between using netflix's Eureka and Ribbon service

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Custom Service Discovery Using Netflix Eureka

Mahesh Sind Currently, I'm working on a POC in an organization. Our goal is to implement service discovery. So I'm exploring Eureka. Eureka is great for unconditional discovery services. Our requirement is to implement conditional service discovery. Our curren

Spring Netflix Eureka Server using illegal URL from intelliJ

Geshe I started an application with spring-cloud-netflix-eureka-server. On startup, it encounters java.net.URISyntaxException. I just added it @EnableEurekaServerafter start.spring.io-bootstrap. import org.springframework.boot.SpringApplication; import org.spr

Spring Netflix Eureka Server using illegal URL from intelliJ

Geshe I started an application with spring-cloud-netflix-eureka-server. On startup, it encounters java.net.URISyntaxException. I just added it @EnableEurekaServerafter start.spring.io-bootstrap. import org.springframework.boot.SpringApplication; import org.spr

Spring Netflix Eureka Server using illegal URL from intelliJ

Geshe I started an application with spring-cloud-netflix-eureka-server. On startup, it encounters java.net.URISyntaxException. I just added it @EnableEurekaServerafter start.spring.io-bootstrap. import org.springframework.boot.SpringApplication; import org.spr

Create a client/service in Netflix Eureka

Sean Regarding the Netflix Eureka service registry, I have successfully setup an Eureka Netflix server with Tomcat 8.0.35. I also got basic sample services and clients that can communicate with each other. I'm new to Eureka and the management decision was to u

How to disable login in Spring Boot Netflix' eureka?

Eric: I am setting up a microservice architecture using Spring Boot and Eureka. I followed some tutorials. However, the Eureka server shows the login when trying to open the dashboard. Also, client registration fails (I think due to enabling security). How to

How to disable login in Spring Boot Netflix' eureka?

Eric: I am setting up a microservice architecture using Spring Boot and Eureka. I followed some tutorials. However, the Eureka server shows the login when trying to open the dashboard. Also, client registration fails (I think due to enabling security). How to

Unable to register Spring MicroService with Netflix Eureka

Maciejka I have a Maven Spring microservice with main class. @EnableEncryptableProperties @SpringBootApplication @EnableDiscoveryClient public class AccountService { private static ApplicationContext applicationContext; public static void main(String

Unable to register Spring MicroService with Netflix Eureka

Maciejka I have a Maven Spring microservice with main class. @EnableEncryptableProperties @SpringBootApplication @EnableDiscoveryClient public class AccountService { private static ApplicationContext applicationContext; public static void main(String

How to disable login in Spring Boot Netflix' eureka?

Eric: I am setting up a microservice architecture using Spring Boot and Eureka. I followed some tutorials. However, the Eureka server shows the login when trying to open the dashboard. Also, client registration fails (I think due to enabling security). How to