Git Product home page Git Product logo

learning-spring-boot-2.0-second-edition's Issues

Chapter 03: ChannelOperation terminal stack with Netty and WebFlux

I'm working through Learning Spring Boot 2.0 by Greg L. Turnquist and I'm getting a continuous spewing of errors with no idea how to debug them or even find them. I've just finished Chapter 3 and any time I do anything on the site I get the following error:

2019-07-22 19:57:58.245 DEBUG 17404 --- [ctor-http-nio-3] r.n.http.server.HttpServerOperations     : [id: 0xbcb056a7, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:52374] Last HTTP response frame
2019-07-22 19:57:58.245 DEBUG 17404 --- [ctor-http-nio-3] r.n.http.server.HttpServerOperations     : [id: 0xbcb056a7, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:52374] Decreasing pending responses, now 0
2019-07-22 19:57:58.245 DEBUG 17404 --- [ctor-http-nio-3] r.n.http.server.HttpServerOperations     : [id: 0xbcb056a7, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:52374] Last HTTP packet was sent, terminating the channel
2019-07-22 19:57:58.246 TRACE 17404 --- [ctor-http-nio-3] reactor.netty.channel.ChannelOperations  : [id: 0xbcb056a7, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:52374] Disposing ChannelOperation from a channel

java.lang.Exception: ChannelOperation terminal stack
	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:391) ~[reactor-netty-0.8.8.RELEASE.jar:0.8.8.RELEASE]
	at reactor.netty.http.server.HttpServerOperations.cleanHandlerTerminate(HttpServerOperations.java:519) ~[reactor-netty-0.8.8.RELEASE.jar:0.8.8.RELEASE]
	at reactor.netty.http.server.HttpTrafficHandler.operationComplete(HttpTrafficHandler.java:313) ~[reactor-netty-0.8.8.RELEASE.jar:0.8.8.RELEASE]
	at reactor.netty.http.server.HttpTrafficHandler.operationComplete(HttpTrafficHandler.java:54) ~[reactor-netty-0.8.8.RELEASE.jar:0.8.8.RELEASE]
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:502) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:495) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:474) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:415) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:540) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:529) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:101) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.internal.PromiseNotificationUtil.trySuccess(PromiseNotificationUtil.java:48) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.ChannelOutboundBuffer.safeSuccess(ChannelOutboundBuffer.java:715) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:270) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.ChannelOutboundBuffer.removeBytes(ChannelOutboundBuffer.java:350) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:428) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:939) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:360) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$1.run(AbstractNioByteChannel.java:54) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[netty-transport-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.36.Final.jar:4.1.36.Final]
	at java.base/java.lang.Thread.run(Thread.java:835) ~[na:na]

I could just clone his repository (and I probably will) but I would like to know what the problem is here and how I can identify the root of similar problems should I encounter them again. None of the files in the stack trace are my code so I don't know what code snippets I could provide you to help.

Chapter1 - Problem in init method of LoadDatabase

I'm optaining this compilation error:

Error:(20, 29) java: incompatible types: cannot infer type-variable(s) R,S
(argument mismatch; bad return type in method reference
S cannot be converted to org.reactivestreams.Publisher<? extends R>)

In the method init of the LoadDatabase class:

@Bean
    CommandLineRunner init(ChapterRepository repository) {
        return args -> {
            Flux.just(
                    new Chapter("Quick Start with Java"),
                    new Chapter("Reactive Web with Spring Boot"),
                    new Chapter("...and more!"))
                    .flatMap(repository::save)
                    .subscribe(System.out::println);
        };
    }

The problem is in the line: .flatMap(repository::save)

Any idea why this happends?

flux fluent by example in Korean translation

It is the source content registered on page 73 of Korean translation.
The return has been changed, but I want you to tell me if it's a different version or a typo.

Flux.just("alpha", "bravo", "charlie")
.map(String::toUpperCase)
.flatMap(s -> Flux.fromArray(s.split("")))
.groupBy(String::toString)
// .sort((s1, s2) -> s1.key().compareTo(s2.key()));
// .flatMap(group -> Mono.just((group.key()).zipWith(group.count()))

        Mono.just(): Mono<T>

        will return Mono<Void>
        Mono.just().and(): Mono<Void>
        .flatMap(group -> Mono.just(group.key()).and(group.count()))

        .map(keyAndCount -> keyAndCount.getT1() + " => " + keyAndCount.getT2())
        .subscribe(System.out::println);

Chapter 01: List of empty json objects with Lombok

Hello, there seems to be an issue when mapping the Flux result to json when the entities are using Lombok: I get [{}, {},{}] as a response (even with the provided code in this repository).

If I remove the Data annotation from the Chapter entity, and generate plain old getters and setters, there is no issue in the json response, the id and name fields do appear.

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.