java.nio.channels.ClosedChannelException Exception when trying to build Java 8 project

Answered

Hello

I have faced below described issue on IntelliJ Idea CE 2019 and 2020 as well. Previously my project used to build, don't know what have changed.

I'm using MacOS Mojave

For simplicity, I have created a new java class with main method, which just runs hello java program. Getting below error

 

Build process started. Classpath: /Applications/IntelliJ IDEA CE.app/Contents/plugins/java/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/lib/tools.jar
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.Error connecting to 127.0.0.1:52511; reason: null
java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
at io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(AbstractChannel.java:976)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:237)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:517)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:978)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:253)
at io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:244)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
Exiting.

0
7 comments

Hyper-V on Windows is known to reserve most of the ports, verify with:

netsh interface ipv4 show excludedportrange protocol=tcp

in tha admin console.

Try uninstalling Hyper-V feature and see if it helps.

Could be also caused by some antivirus/firewall incorrectly blocking the local connections.

0
Avatar
Permanently deleted user

Hey Serge,

Thanks for replying quickly. 

Sorry but I forgot to mention that I have macOs. Also how would I know if firewall is blocking local connection ?

Also I would like to add that, I have many java projects and this error comes for most of projects and for remaining projects build and run happens successfully. 

0

Could you please share the logs (Help | Collect Logs and Diagnostic Data) via https://uploads.services.jetbrains.com/?

Is there anything unusual about your network configuration? VPN, third-party firewall, etc?

0
Avatar
Permanently deleted user

Hey Serge, 

I have uploaded logs by following the link you posted, but I'm not sure where it was uploaded. File name is idea-logs-20200421-185653.zip

And Yes, I do use VPN but even if I disconnect my VPN I get same error.

0

Does it help if you disable non bundled plug-ins like Protobuf Support and others?

If the issue persists after disabling the plug-ins and restarting the IDE, please also try reinstalling from http://www.jetbrains.com/idea/download/index.html.

build.log contains the following which indicates either an incompatible plug-in or corrupted installation:

2020-04-21 17:37:34,570 [ 0] INFO - etbrains.jps.cmdline.BuildMain - ==================================================
2020-04-21 17:37:34,570 [ 0] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: /Applications/IntelliJ IDEA CE.app/Contents/plugins/java/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/lib/tools.jar
2020-04-21 17:37:35,011 [ 441] WARN - tty.channel.ChannelInitializer - Failed to initialize a channel. Closing: [id: 0x763d3377]
java.lang.NoSuchMethodError: org.jetbrains.jps.api.CmdlineRemoteProto$Message.makeImmutable()V
at org.jetbrains.jps.api.CmdlineRemoteProto$Message.<clinit>(CmdlineRemoteProto.java:12154)
at org.jetbrains.jps.cmdline.BuildMain$1.initChannel(BuildMain.java:97)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:971)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)
at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:502)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
0
Avatar
Permanently deleted user

Hey Serge,

Here is what I did next,

1. Removed existing IntelliJ Idea 2020 application and 2019 application
2. Removed intellij related files from ~/Library/Application Support/, ~/Library/Logs/, ~/Library/Preferences/, ~/Library/Caches
3. Restarted Mac
4. Downloaded new IntelliJ 2020 from the link you given
5. On opening IntelliJ Idea, created new project in java and wrote HelloWorld.java file. Which ran successfully
6. Open an existing project, for which I was facing the error, tried to build project and got same error

I did not installed any plugin this time and as I deleted all folders related to old intelliJ, it was fresh start.

0

Please submit a ticket at https://intellij-support.jetbrains.com/hc/requests/new and attach the sample project to reproduce the issue. Also attach the fresh logs via Help | Collect Logs and Diagnostic Data.

0

Please sign in to leave a comment.