Server.js内容:
// server.js load('vertx.js'); vertx.createHttpServer().requestHandler(function(req){ req.response.end("hello vertx!"); }).listen(8080, 'localhost');
尝试运行:
D:\vertx>bin\vertx run server.js Failed to create the vert.x instance java.lang.IllegalStateException: failed to create a child event loop at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:88) at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58) at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47) at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:58) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:75) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:70) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:57) at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:129) at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:119) at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:42) at io.vertx.core.Vertx.vertx(Vertx.java:90) at io.vertx.core.impl.launcher.commands.ClasspathHandler.create(ClasspathHandler.java:114) at io.vertx.core.impl.launcher.commands.BareCommand.startVertx(BareCommand.java:194) at io.vertx.core.impl.launcher.commands.BareCommand.run(BareCommand.java:132) at io.vertx.core.impl.launcher.commands.RunCommand.run(RunCommand.java:249) at io.vertx.core.impl.launcher.VertxCommandLauncher.execute(VertxCommandLauncher.java:230) at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:365) at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:328) at io.vertx.core.Launcher.main(Launcher.java:49) Caused by: io.netty.channel.ChannelException: failed to open a new selector at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:150) at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:141) at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:116) at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:34) at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84) ... 18 more Caused by: java.io.IOException: Unable to establish loopback connection at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:101) at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:68) at java.security.AccessController.doPrivileged(Native Method) at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:170) at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50) at java.nio.channels.Pipe.open(Pipe.java:155) at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:127) at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44) at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:148) ... 22 more Caused by: java.net.ConnectException: Connection timed out: connect at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Net.java:454) at sun.nio.ch.Net.connect(Net.java:446) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648) at java.nio.channels.SocketChannel.open(SocketChannel.java:189) at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:130) at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:83) ... 30 more Exception in thread "Thread-2" java.lang.NullPointerException at io.vertx.core.impl.launcher.commands.BareCommand$1.run(BareCommand.java:308)
难不成是防火墙在搞鬼?还是说load('vertx.js'); 这一句有问题??