Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7614653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:27:33+00:00 2026-05-31T02:27:33+00:00

I wrote an application that tried to create a default HBaseConfiguration, but when I

  • 0

I wrote an application that tried to create a default HBaseConfiguration, but when I package the application as a jar it won’t work properly because it is trying to use 127.0.0.1’s zookeeper and not the one specified in my /etc/hbase/conf/hbase-site.xml. The application can be stripped down to something like this:

 object TestUtil extends App {
   val hbaseTable = new HTable(HBaseConfiguration.create, "tableName")
   println(hbaseTable)
 }

When I run this using the following command it works fine:

 CLASSPATH=`hbase classpath` java fully.qualified.name.TestUtil

If I package it as a jar and call it using CLASSPATH='hbase classpath' java -jar TestUtil.jar then I get the following error:

 org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately.

I’ve checked the logs and can see that it is trying to connect to 127.0.0.1 for Zookeeper, which is different from the zookeeper configuration in my /etc/hbase/conf/hbase-site.xml. The jar seems to be ignoring my classpath even though I explicitly set it on the command line.

How can I make the JVM honor my classpath when executing a jar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:27:35+00:00Added an answer on May 31, 2026 at 2:27 am

    When starting a JVM with java -jar the resulting environment does not see files in the classpath from the outside CLASSPATH variable. It instead uses the classpath from the MANIFEST file.

    Assuming you don’t want to hardcode the paths to your dependencies in the manifest, You can get around this by:

    1. putting the JAR you want to run in the class path in addition to,
    2. not using the -jar switch, and
    3. specifying the class with the main() as an argument.

    For example:

     CLASSPATH=/path/to/my.jar:`hbase classpath` java fully.qualified.MainClass
    

    This is the same approach that HBase’s hbase shell script uses. Take a look at line 332.

    So long as your JAR doesn’t include an hbase-site.xml, this approach should result in the JVM loading the hbase-site.xml from your classpath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write an application that can be used to create pictures that
I am trying to create a WPF application that will be a central point
My mamp mysql server won't turn on. I tried executing /Applications/MAMP/bin/startMysql.sh but that gave
I'm trying to create a Silverlight application that downloads a file accessed by a
I'm trying to write an application that will allow a non-administrator user to create
I'm trying to add a create Facebook event functionality to my application that uses
I wrote an application that currently runs against a local instance of MySql. I
I wrote an application that loops through a set of records and prints two
I have wrote an application that syncs two folders together. The problem with the
I wrote a C# application that is a simple countdown timer. I use it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.