hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Calvin Lei <ckp...@gmail.com>
Subject Re: IllegalArgumentException: Connection is null or closed when calling HConnection.getTable()
Date Tue, 20 Jan 2015 12:50:34 GMT
Hi Nick,
     the HConnection is unmanaged and we cache it for the lifetime of the
application until it shuts down. I am not calling HConnection.close
anywhere in my code except for the shutdown hook.

On Mon, Jan 19, 2015 at 7:39 PM, Nick Dimiduk <ndimiduk@gmail.com> wrote:

> Hi Calvin,
>
> An HConnection created via
> HConnectionManager#createConnection(Configuration) is an "unmanaged"
> connection, meaning it's lifecycle is managed by your code. Are you calling
> HConnection#close() on that instance someplace?
>
> Please notice that these are different semantics from the previous
> HConnection#getConnection(Configuration), which returns a "managed"
> connection, one who's lifecycle is managed by the HBase client.
>
> -n
>
> On Mon, Jan 19, 2015 at 4:29 PM, Calvin Lei <ckplei@gmail.com> wrote:
>
> > Thanks. I was more curious why the connection would be closed.
> >
> > On Mon, Jan 19, 2015 at 5:22 PM, Ted Yu <yuzhihong@gmail.com> wrote:
> >
> > > Here is related code from HTable ctor:
> > >
> > >     if (connection == null || connection.isClosed()) {
> > >       throw new IllegalArgumentException("Connection is null or
> > closed.");
> > >     }
> > > It was likely that connection was closed (from your description of your
> > > code).
> > >
> > > If HConnectionImplementation were to check the status of connection
> > before
> > > calling HTable ctor, that would be helpful.
> > > For the moment, your application should check the status of connection.
> > >
> > > Cheers
> > >
> > > On Mon, Jan 19, 2015 at 1:48 PM, Calvin Lei <ckplei@gmail.com> wrote:
> > >
> > > > I upgraded to 0.98.0.2.1.1.0-385-hadoop2. The exception from hbase
> is:
> > > >
> > > > java.lang.IllegalArgumentException: Connection is null or closed.
> > > >   at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:302)
> > > >   at
> > > >
> > > >
> > >
> >
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getTable(HConnectionManager.java:763)
> > > >   at
> > > >
> > > >
> > >
> >
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getTable(HConnectionManager.java:745)
> > > >   at
> > > >
> > > >
> > >
> >
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getTable(HConnectionManager.java:740)
> > > >
> > > >
> > > > On Mon, Jan 19, 2015 at 4:37 PM, Ted Yu <yuzhihong@gmail.com> wrote:
> > > >
> > > > > Which 0.98 release did you upgrade to ?
> > > > >
> > > > > Can you pastebin the whole stack trace ?
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > > >
> > > > > > On Jan 19, 2015, at 1:25 PM, Calvin Lei <ckplei@gmail.com>
> wrote:
> > > > > >
> > > > > > Dear all,
> > > > > >   I recently upgrade to HBase 0.0.98 and I have started seeing
> the
> > > > error
> > > > > > "Connection is null or closed" when calling
> HConnection.getTable().
> > > > > >   As recommended by the documentation, I create a HConnection
> using
> > > > > > HConnectionManager.createConnection(config) and at app start
and
> > > close
> > > > > the
> > > > > > connection at app shut down. Looks like the state of the cluster
> > has
> > > > > > changed during the lifetime of the app and the HConnection closes
> > out
> > > > all
> > > > > > connections.
> > > > > >    Do i have to check isClosed() before I call getTable()?
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message