NPE while creating channel
See original GitHub issuePlease answer these questions before submitting your issue.
What version of gRPC are you using? -> 1.20.0
Using Java 8, Tomcat V 7.0
The line in question is ->
ManagedChannel channel = NettyChannelBuilder.forAddress(getGrpcDomainName(), getGrpcPort()).sslContext(GrpcSslContexts.forClient().trustManager(certificateStream).build()).build();
What did you expect to see?
ERROR ERROR - java.lang.NullPointerException - exc.name=java.lang.NullPointerException,exc.orig=com.google.common.base.Preconditions.checkNotNull:770
,exc.msg=java.lang.NullPointerException:null,exc.chain=53e4226a,exc.stack=java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
at io.grpc.NameResolver$Args$Builder.setProxyDetector(NameResolver.java:525)
at io.grpc.NameResolver$Factory.newNameResolver(NameResolver.java:184)
at io.grpc.internal.ManagedChannelImpl.getNameResolver(ManagedChannelImpl.java:632)
at io.grpc.internal.ManagedChannelImpl.<init>(ManagedChannelImpl.java:547)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:440)
at com.project.new.services.read.Orchestrator.init(Orchestrator.java:60)
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:497)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at com.project.scm.client.execution.ScmServletContextListener.configureAndRefreshWebApplicationContext(ScmServletContextListener.java:87)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)\n,applog.msg=Problem creating connection with gRPC
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
NPE in channel.write(Object message) - netty - Stack Overflow
I am running a (selfmade) middleware "Service Connector (SC)" basing on netty (3.2.5.Final.jar) which basically is a proxy for http traffic. Any ...
Read more >Java NullPointerException - Detect, Fix, and Best Practices
Some of the common reasons for NullPointerException in java ... Java NullPointerException while accessing/modifying field of a null object.
Read more >NullPointerException is received when creating a new ... - IBM
NullPointerException is received when creating a new Routing Channel Template. UI popup: NullPointerException creating RCT. Error Message.
Read more >"NullPointerException" is displayed while creating ... - Search
In the Master Data Management (MDM) Informatica Data Director (IDD) Hierarchy View and the Hub Hierarchy Manager, when a relationship is ...
Read more >NullPointerException - Medium
When you declare a reference variable (i.e. an object), you are really creating a pointer to an object. Consider the following code where...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It does not appear you are running v1.20. The line numbers for NameResolver match v1.21 (grpc-api) and those for ManagedChannelImpl match v1.18 (grpc-core).
The error is because PARAMS_PROXY_DETECTOR was not supported in v1.18 and we introduced an API in 1.21 that requires it. Even if that wasn’t the problem, skewing versions like this could cause many more problems.
Are you using Gradle? I don’t think Maven would behave this way. If you add a dependency on
io.grpc:grpc-core:1.21.0
the problem should go away.CC @zhangkun83
@vaikzs, what does that have to do with this issue?