emmet7life / openjdk-osx-build

Automatically exported from code.google.com/p/openjdk-osx-build
0 stars 0 forks source link

NIO.2 AsynchronousServerSocketChannel throw platform not recognized exception #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use NIO.2, just us AsynchronousServerSocketChannel to accept a socket 
connection,but found below exception:

Exception in thread "main" java.lang.InternalError: platform not recognized
    at sun.nio.ch.DefaultAsynchronousChannelProvider.create(DefaultAsynchronousChannelProvider.java:53)
    at java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder$1.run(AsynchronousChannelProvider.java:88)
    at java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder$1.run(AsynchronousChannelProvider.java:79)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder.load(AsynchronousChannelProvider.java:78)
    at java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder.<clinit>(AsynchronousChannelProvider.java:75)
    at java.nio.channels.spi.AsynchronousChannelProvider.provider(AsynchronousChannelProvider.java:166)
    at java.nio.channels.AsynchronousServerSocketChannel.open(AsynchronousServerSocketChannel.java:138)
    at java.nio.channels.AsynchronousServerSocketChannel.open(AsynchronousServerSocketChannel.java:161)

I checked the "DefaultAsynchronousChannelProvider.java:53", it check only two 
OS: "SunOS" and "Linux", otherwise throw the platform not defined exception. I 
think may be the jdk not implements the NIO.2 JNI part on MacOSX? or may be the 
way I use jdk7 is error?

Original issue reported on code.google.com by vipy...@126.com on 12 Apr 2011 at 12:33

GoogleCodeExporter commented 9 years ago
Could you provide a sample test app

Original comment by henri.gomez on 30 Sep 2011 at 10:18

GoogleCodeExporter commented 9 years ago
The simplest code to recreate this exception only tries to open the socket.

=== Foo.java ===
import java.nio.channels.AsynchronousServerSocketChannel;

class Foo {
    public static void main(String[] args) throws Exception {
        AsynchronousServerSocketChannel.open();
    }
}
=== Foo.java ===

Compile and run it

    javac Foo.java
    java Foo

to see the exception.

Original comment by topher.t...@gmail.com on 30 Sep 2011 at 1:09

GoogleCodeExporter commented 9 years ago
see http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Project+Status , the 
Async I/O API in not done, we just need wait.
The port track is http://java.net/jira/browse/MACOSX_PORT-222

Original comment by vipy...@126.com on 30 Sep 2011 at 3:50

GoogleCodeExporter commented 9 years ago
Closing it here since it's now opened on osx port JIRA

Original comment by henri.gomez on 4 Oct 2011 at 9:14