Giter Club home page Giter Club logo

Comments (6)

stmty9 avatar stmty9 commented on June 12, 2024 1

The issue is with the serialization. There appears to not be a suitable Serde for InetAddress (I am using micronaut serialization).

I made my own Serde which seems to work (no need for @SerdeImport anymore. I have only tested this using localhost, so it may need some more testing.

@Singleton
public class InetAddressSerde implements Serde<InetAddress> {
    @Nullable
    @Override
    public InetAddress deserialize(Decoder decoder, DecoderContext context, Argument<? super InetAddress> type) throws IOException {
        return InetAddress.getByName(decoder.decodeString());
    }

    @Override
    public void serialize(Encoder encoder, EncoderContext context, Argument<? extends InetAddress> type, InetAddress value) throws IOException {
        encoder.encodeString(value.getHostAddress());
    }
}

Why?
It looks like the registration is attempting to utilize this service
The serialized registration FROM micronaut using @SerdeImport is:

{
  "checks": [
    {
      "TTL": "25s",
      "status": "passing"
    }
  ],
  "ID": "my-svc:55e23743cb",
  "address": {
    "multicastAddress": false,
    "anyLocalAddress": false,
    "loopbackAddress": true,
    "linkLocalAddress": false,
    "siteLocalAddress": false,
    "MCGlobal": false,
    "MCNodeLocal": false,
    "MCLinkLocal": false,
    "MCSiteLocal": false,
    "MCOrgLocal": false,
    "address": [127, 0, 0, 1],
    "hostAddress": "127.0.0.1",
    "hostName": "localhost",
    "canonicalHostName": "localhost"
  },
  "port": 8081,
  "name": "my-svc"
}

This is a sample payload. from their docs

from micronaut-discovery-client.

message avatar message commented on June 12, 2024

Consul and the Micronaut Framework - Microservices Service Discovery guide also fails with same issue.

from micronaut-discovery-client.

alvarosanchez avatar alvarosanchez commented on June 12, 2024

I've seen this issue too.

We have the intention to replace Jackson with Micronaut Serialization in this module for Micronaut 4, however, we are not there yet. Once #379 is done, I will give it a try.

from micronaut-discovery-client.

stmty9 avatar stmty9 commented on June 12, 2024

Any update on this? I am having the same issue:
micronaut: 3.7.0
discovery-client: 3.1.0
consul (docker): 1.14.3

from micronaut-discovery-client.

averri avatar averri commented on June 12, 2024

@stmty9, thank you so much for sharing the custom Serde code.

from micronaut-discovery-client.

sdelamo avatar sdelamo commented on June 12, 2024

closed via micronaut-projects/micronaut-serialization#593 and #523

from micronaut-discovery-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.