question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not generate marshaller

See original GitHub issue

The following message occurs when the spring is started and the application is terminated

org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exception is java.lang.IllegalStateException: Could not generate marshaller, this is generally a bug in this library. Please file a report at https://github.com/curioswitch/curiostack with this stack trace and an example proto to reproduce.
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:80)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:62)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at com.myapp.api.ApiApp$Companion.main(ApiApp.kt:95)
	at com.myapp.api.ApiApp.main(ApiApp.kt)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: Could not generate marshaller, this is generally a bug in this library. Please file a report at https://github.com/curioswitch/curiostack with this stack trace and an example proto to reproduce.
	at org.curioswitch.common.protobuf.json.TypeSpecificMarshaller.buildOrFindMarshaller(TypeSpecificMarshaller.java:284)
	at org.curioswitch.common.protobuf.json.TypeSpecificMarshaller.buildAndAdd(TypeSpecificMarshaller.java:160)
	at org.curioswitch.common.protobuf.json.MessageMarshaller$Builder.build(MessageMarshaller.java:425)
	at com.linecorp.armeria.common.grpc.GrpcJsonUtil.jsonMarshaller(GrpcJsonUtil.java:62)
	at com.linecorp.armeria.common.grpc.GrpcJsonMarshallerBuilder.build(GrpcJsonMarshallerBuilder.java:71)
	at com.linecorp.armeria.common.grpc.GrpcJsonMarshaller.of(GrpcJsonMarshaller.java:45)
	at com.linecorp.armeria.server.grpc.GrpcServiceBuilder$$Lambda$641/000000000000000000.apply(Unknown Source)
	at com.linecorp.armeria.internal.shaded.guava.collect.CollectCollectors.lambda$toImmutableMap$1(CollectCollectors.java:61)
	at com.linecorp.armeria.internal.shaded.guava.collect.CollectCollectors$$Lambda$627/000000000000000000.accept(Unknown Source)
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.util.stream.DistinctOps$1$2.accept(DistinctOps.java:175)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at com.linecorp.armeria.server.grpc.FramedGrpcService.<init>(FramedGrpcService.java:127)
	at com.linecorp.armeria.server.grpc.GrpcServiceBuilder.build(GrpcServiceBuilder.java:479)
	at com.myapp.core.config.ArmeriaServerConfiguration$armeriaServerConfigurator$1.configure(ArmeriaServerConfiguration.kt:29)
	at com.linecorp.armeria.spring.web.reactive.ArmeriaReactiveWebServerFactory.lambda$getWebServer$3(ArmeriaReactiveWebServerFactory.java:206)
	at com.linecorp.armeria.spring.web.reactive.ArmeriaReactiveWebServerFactory$$Lambda$635/000000000000000000.accept(Unknown Source)
	at com.linecorp.armeria.internal.shaded.guava.collect.ImmutableList.forEach(ImmutableList.java:405)
	at com.linecorp.armeria.spring.web.reactive.ArmeriaReactiveWebServerFactory.getWebServer(ArmeriaReactiveWebServerFactory.java:206)
	at org.springframework.boot.web.reactive.context.WebServerManager.<init>(WebServerManager.java:49)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.createWebServer(ReactiveWebServerApplicationContext.java:90)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:77)
	... 13 common frames omitted
Caused by: java.lang.NoSuchMethodException: org.curioswitch.common.protobuf.json.TypeSpecificMarshaller$ByteBuddy$zhONG0fu.<init>(com.myapp.protobuf.StockPriceRequest)
	at java.lang.Class.newNoSuchMethodException(Class.java:567)
	at java.lang.Class.getConstructor(Class.java:609)
	at org.curioswitch.common.protobuf.json.TypeSpecificMarshaller.buildOrFindMarshaller(TypeSpecificMarshaller.java:278)
	... 40 common frames omitted


dependencies

  • spring-boot 2.3.5
  • spring-webflux 5.2.10
  • jdk 1.8, 11 both
  • kotlin 1.4

build.gradle

            implementation platform('com.linecorp.armeria:armeria-bom:1.2.0')
            implementation platform('io.netty:netty-bom:4.1.53.Final')
            implementation 'com.linecorp.armeria:armeria-spring-boot2-webflux-starter'
            implementation 'com.linecorp.armeria:armeria-grpc'
            implementation "io.grpc:grpc-services"

proto

syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.myapp.protobuf";

package com.myapp.protobuf;

message StockPriceRequest {
  string symbol = 1;
}

message StockPriceReply {
  double price = 1;
}

service StockPriceService {
  rpc StreamPrice (StockPriceRequest) returns (stream StockPriceReply) {}
}

configuration

@Configuration
class ArmeriaServerConfiguration(
    private val stockPriceService: StockPriceService
) {

    @Bean
    fun armeriaServerConfigurator(): ArmeriaServerConfigurator {
        return ArmeriaServerConfigurator { builder ->
            builder.decorator(LoggingService.newDecorator())
            builder.accessLogWriter(AccessLogWriter.combined(), false)
            builder.serviceUnder("/docs", DocService())

            builder.service(
                GrpcService.builder()
                    .addService(stockPriceService)
                    .addService(ProtoReflectionService.newInstance())
                    .build()
            )
        }
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
probeparkcommented, Nov 18, 2020

If you work on a multi-module project Try this out

restart.exclude.protobuf-common=/protobuf-common/

Thank you @minwoox

0reactions
probeparkcommented, Nov 17, 2020

It seems to be a problem due to the different class loader.

    private Constructor<T> getConstructor0(Class<?>[] parameterTypes,
                                        int which) throws NoSuchMethodException
    {
        ReflectionFactory fact = getReflectionFactory();
        Constructor<T>[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC));
        for (Constructor<T> constructor : constructors) {
            if (arrayContentsEq(parameterTypes,
                                fact.getExecutableSharedParameterTypes(constructor))) {
                return constructor;
            }
        }
        throw new NoSuchMethodException(methodToString("<init>", parameterTypes));
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

JAXB marshaller cannot create context for class implemented ...
My error actually refers to the interface myInterface, so I think that for some reason, JAXB is trying to create a context for...
Read more >
jaxb marshal problem — oracle-tech
Hi everyone, I' ve got a problem with marshalling with jaxb. I have a dtd that looks like this one:
Read more >
Why not use protobuf-java-util for json Marshaller · Issue #1784
I want to use proto3 enum as int not string,protobuf-jackson can't support。 ... If you want to support json and proto. And any...
Read more >
[#CXF-8536] Incorrect log message "Could not create a ...
Incorrect log message "Could not create a NamespaceMapper compatible with Marshaller class com.sun.xml.bind.v2.runtime.MarshallerImpl". Status: Assignee:.
Read more >
Are the JAXB runtime API's thread safe? Q - Java EE
The JAXB Specification currently does not address the thread safety of any of ... Just create a new Unmarshaller / Marshaller / Validator...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found