1

I am using the single server mode to configure the redis server and port, am I missing something here ?

Config config = new Config();
config.useSingleServer().setAddress("localhost:6379");

But below exception is encountered

Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in scheme name at index 0: [localhost]:6379
at java.net.URI.create(URI.java:852)
at org.redisson.misc.URIBuilder.create(URIBuilder.java:38)
at org.redisson.config.SingleServerConfig.setAddress(SingleServerConfig.java:129)

Seems the below code in org.redisson.misc.URIBuilder has issue

public static URI create(String uri) {
    URI u = URI.create(uri);
    // Let's assuming most of the time it is OK.
    if (u.getHost() != null) {
        return u;
    }
    String s = uri.substring(0, uri.lastIndexOf(":")).replaceFirst("redis://", "").replaceFirst("rediss://", "");
    // Assuming this is an IPv6 format, other situations will be handled by
    // Netty at a later stage.
    return URI.create(uri.replace(s, "[" + s + "]"));
}
Sunil
  • 364
  • 1
  • 14

1 Answers1

2

Managed to get it working by using the following configuration

Config config = new Config();
config.useSingleServer().setAddress("redis://localhost:6379");
Sunil
  • 364
  • 1
  • 14