Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error if you set grpc.server.port to -1 #111

Closed
sdelamo opened this issue May 4, 2020 · 1 comment
Closed

error if you set grpc.server.port to -1 #111

sdelamo opened this issue May 4, 2020 · 1 comment
Labels
type: bug Something isn't working

Comments

@sdelamo
Copy link
Contributor

sdelamo commented May 4, 2020

Docs:

The server by default runs on port 50051, however you can configure which port the server runs on by setting grpc.server.port to whichever value you wish (a value of -1 will use a random port).

Steps to reproduce

% mn --version
Micronaut Version: 2.0.0.M3
JVM Version: 11.0.6
% mn create-grpc-app foo
| Application created at /Users/sdelamo/Downloads/demo-12/foo
% cd foo 
foo % vi src/main/resources/application.yml 
foo % cat src/main/resources/application.yml 
micronaut:
  application:
    name: foo
grpc:
  server:
    port: -1
% ./gradlew run

> Task :compileJava
Note: /Users/sdelamo/Downloads/demo-12/foo/build/generated/source/proto/main/java/foo/Foo.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :run FAILED
10:58:27.659 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Error instantiating bean of type  [io.micronaut.grpc.server.GrpcEmbeddedServer]

Message: port out of range:-1
Path Taken: new GrpcEmbeddedServer(ApplicationContext applicationContext,ApplicationConfiguration applicationConfiguration,[GrpcServerConfiguration grpcServerConfiguration],ServerBuilder serverBuilder,ApplicationEventPublisher eventPublisher,ComputeInstanceMetadataResolver computeInstanceMetadataResolver,List metadataContributors)
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [io.micronaut.grpc.server.GrpcEmbeddedServer]

Message: port out of range:-1
Path Taken: new GrpcEmbeddedServer(ApplicationContext applicationContext,ApplicationConfiguration applicationConfiguration,[GrpcServerConfiguration grpcServerConfiguration],ServerBuilder serverBuilder,ApplicationEventPublisher eventPublisher,ComputeInstanceMetadataResolver computeInstanceMetadataResolver,List metadataContributors)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1840)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:2549)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2535)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2222)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2196)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1198)
        at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:1039)
        at io.micronaut.grpc.server.$GrpcEmbeddedServerDefinition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1814)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:2549)
        at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2535)
        at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2222)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2196)
        at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:1218)
        at io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:713)
        at io.micronaut.context.BeanLocator.findBean(BeanLocator.java:149)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:66)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:294)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:280)
        at foo.Application.main(Application.java:8)
Caused by: java.lang.IllegalArgumentException: port out of range:-1
        at java.base/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
        at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:188)
        at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:166)
        at io.grpc.netty.NettyServerBuilder.<init>(NettyServerBuilder.java:131)
        at io.grpc.netty.NettyServerBuilder.forPort(NettyServerBuilder.java:115)
        at io.micronaut.grpc.server.GrpcServerConfiguration.<init>(GrpcServerConfiguration.java:83)
        at io.micronaut.grpc.server.$GrpcServerConfigurationDefinition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1814)
        ... 19 common frames omitted

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Users/sdelamo/.sdkman/candidates/java/11.0.6-amzn/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s
@sdelamo sdelamo added the type: bug Something isn't working label May 4, 2020
@sdelamo
Copy link
Contributor Author

sdelamo commented May 4, 2020

duplicate of : #72

@sdelamo sdelamo closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant