You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by David Nickerson <da...@gmail.com> on 2012/07/20 22:00:07 UTC

NullPointerException

I keep getting a null pointer exception when constructing a ZooKeeper
object (with a session ID and password) that is connecting to a standalone
embedded ZooKeeper server on the same machine. I'm positive that none of
the arguments that I pass are null. Doing a quick Google search, it seems
like this may be a Java bug, exasperated by my starting an embedded
ZooKeeper server and a ZooKeeper client at nearly the same time.

However, it is my experience that I tend to make mistakes. Therefore I'm
asking, does this look like an error that ZooKeeper expects to throw when
the user does something wrong?

java.lang.NullPointerException
        at sun.nio.ch.Util.atBugLevel(Unknown Source)
        at sun.nio.ch.SelectorImpl.<init>(Unknown Source)
        at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
        at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
        at java.nio.channels.Selector.open(Unknown Source)
        at
org.apache.zookeeper.ClientCnxn$SendThread.<init>(ClientCnxn.java:692)
        at org.apache.zookeeper.ClientCnxn.<init>(ClientCnxn.java:391)
        at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:451)

Re: NullPointerException

Posted by David Nickerson <da...@gmail.com>.
This is running on Windows 7 Pro SP1 64-bit and Java 6 SE Update 33 64-bit.

Given your comment, I'm convinced it's this Java bug:
http://bugs.sun.com/view_bug.do?bug_id=6427854
It looks like it's fixed in Java 7.

On Tue, Jul 31, 2012 at 4:45 PM, Patrick Hunt <ph...@gmail.com> wrote:

> Is this running on a windows box? What version of the jvm? Seems like
> a jvm issue to me, the call into Selector.open is throwing the NPE -
> notice it's a static method that takes no arguments.
>
> http://docs.oracle.com/javase/6/docs/api/java/nio/channels/Selector.html#open()
>
> Patrick
>
> On Fri, Jul 20, 2012 at 1:00 PM, David Nickerson
> <da...@gmail.com> wrote:
> > I keep getting a null pointer exception when constructing a ZooKeeper
> > object (with a session ID and password) that is connecting to a
> standalone
> > embedded ZooKeeper server on the same machine. I'm positive that none of
> > the arguments that I pass are null. Doing a quick Google search, it seems
> > like this may be a Java bug, exasperated by my starting an embedded
> > ZooKeeper server and a ZooKeeper client at nearly the same time.
> >
> > However, it is my experience that I tend to make mistakes. Therefore I'm
> > asking, does this look like an error that ZooKeeper expects to throw when
> > the user does something wrong?
> >
> > java.lang.NullPointerException
> >         at sun.nio.ch.Util.atBugLevel(Unknown Source)
> >         at sun.nio.ch.SelectorImpl.<init>(Unknown Source)
> >         at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
> >         at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown
> Source)
> >         at java.nio.channels.Selector.open(Unknown Source)
> >         at
> > org.apache.zookeeper.ClientCnxn$SendThread.<init>(ClientCnxn.java:692)
> >         at org.apache.zookeeper.ClientCnxn.<init>(ClientCnxn.java:391)
> >         at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:451)
>

Re: NullPointerException

Posted by Patrick Hunt <ph...@gmail.com>.
Is this running on a windows box? What version of the jvm? Seems like
a jvm issue to me, the call into Selector.open is throwing the NPE -
notice it's a static method that takes no arguments.
http://docs.oracle.com/javase/6/docs/api/java/nio/channels/Selector.html#open()

Patrick

On Fri, Jul 20, 2012 at 1:00 PM, David Nickerson
<da...@gmail.com> wrote:
> I keep getting a null pointer exception when constructing a ZooKeeper
> object (with a session ID and password) that is connecting to a standalone
> embedded ZooKeeper server on the same machine. I'm positive that none of
> the arguments that I pass are null. Doing a quick Google search, it seems
> like this may be a Java bug, exasperated by my starting an embedded
> ZooKeeper server and a ZooKeeper client at nearly the same time.
>
> However, it is my experience that I tend to make mistakes. Therefore I'm
> asking, does this look like an error that ZooKeeper expects to throw when
> the user does something wrong?
>
> java.lang.NullPointerException
>         at sun.nio.ch.Util.atBugLevel(Unknown Source)
>         at sun.nio.ch.SelectorImpl.<init>(Unknown Source)
>         at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
>         at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
>         at java.nio.channels.Selector.open(Unknown Source)
>         at
> org.apache.zookeeper.ClientCnxn$SendThread.<init>(ClientCnxn.java:692)
>         at org.apache.zookeeper.ClientCnxn.<init>(ClientCnxn.java:391)
>         at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:451)