Hi,

We have a linux instance for HBase. Now I am trying to connect to HBase
using Java, when I tried using a simple program it is connecting to HBase
and doing the the operations like create and get the table rows etc.  But
the same code I used in my application as a ear file and deployed its not
running. I am not getting any exceptions also. Even I tried for
RuntimeException catching to know the problem. But still not getting the
exceptions.

Please help me in resolving this issue.

Please see the below code snippet which is running as a Java console
application.

             Configuration conf = HBaseConfiguration.create();
//conf.set("hbase.zookeeper.quorum", "10.0.100.90");  // this property
added in the hbase-site.xml
conf.addResource(new
Path("C:/jilani/workspace/hbaseproj1/src/com/demo/hbase/hbase-site.xml"));

HBaseAdmin hbase = new HBaseAdmin(conf);
 // will create a table
HTableDescriptor desc = new HTableDescriptor("demo1");
HColumnDescriptor meta = new HColumnDescriptor("personal".getBytes());
HColumnDescriptor prefix = new HColumnDescriptor("account".getBytes());
desc.addFamily(meta);
desc.addFamily(prefix);
hbase.createTable(desc);
hbase.close();
// will create a table


The same code I have used in Java file but it is packaged as jar under ear
for my application. The ear and app server both on the same box where the
java console application running. But its not working.

I am getting one security exception in Java console application but still
it is giving me the required outputs like connecting to HBase and getting
data from HBase table etc. Where as in ear may be it is not connecting to
the Hbase. When I used the debug mode It is coming out from the below line
of code

HBaseAdmin hbase = new HBaseAdmin(conf);

Please see the below output from my console for the same

12/08/01 17:41:11 WARN client.ZooKeeperSaslClient: SecurityException:
java.lang.SecurityException: Unable to locate a login configuration
occurred when trying to find JAAS configuration.
12/08/01 17:41:11 INFO client.ZooKeeperSaslClient: Client will not
SASL-authenticate because the default JAAS configuration section 'Client'
could not be found. If you are not using SASL, you may ignore this. On the
other hand, if you expected SASL to work, please fix your JAAS
configuration.
12/08/01 17:41:11 INFO zookeeper.ClientCnxn: Socket connection established
to systemName/10.0.100.90:2181, initiating session
12/08/01 17:41:11 INFO zookeeper.ClientCnxn: Session establishment complete
on server systemName/10.0.100.90:2181, sessionid = 0x138c9dba4c7004d,
negotiated timeout = 10000
Demo.main() i: 0columnDescriptors[i] {NAME => 'account', BLOOMFILTER =>
'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE',
MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY
=> 'false', BLOCKCACHE => 'true'}
Demo.main() i: 1columnDescriptors[i] {NAME => 'personal', BLOOMFILTER =>
'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE',
MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY
=> 'false', BLOCKCACHE => 'true'}


Thank You,
Jilani

Reply via email to