Compiling and Running HPE Ezmeral Data Fabric Database Binary Applications
For applications that use the HPE Ezmeral Data Fabric Database Java API for binary tables, use Maven to compile and determine the application's dependencies. Then, when you run the application, specify those dependencies in the application's classpath.
Compile and Determine Dependencies
- Add MapR's maven repository to the list of repositories in your application's
pom.xml
, if it is not there already:<repository> <id>mapr-releases</id> <url>https://repository.mapr.com/maven/</url> <snapshots><enabled>true</enabled></snapshots> <releases><enabled>true</enabled></releases> </repository>
- Add a dependency to the HBase client project:
<dependencies> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version><version selected from the repository></version> </dependency> <dependencies>
NOTE- The hbase-client version mentioned above is an example. The actual version that your application requires is based on the current EEP and MapR version that you are running.The file versions are listed in the following location: https://repository.mapr.com/nexus/content/groups/mapr-public/org/apache/hbase/hbase-client/ Ensure that the version tags include reference to m7-<maprversion>. Otherwise, your applications will not be able to access HPE Ezmeral Data Fabric Database binary tables.
- If your application uses both the HPE Ezmeral Data Fabric Database JSON and HPE Ezmeral Data Fabric Database Binary APIs, you
may encounter a conflict in the netty library used by each API. To avoid
this, exclude the netty library from your
hbase-client
dependency as follows:<dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version><version selected from the repository></version> <exclusions> <exclusion> <artifactId>netty-all</artifactId> <groupId>io.netty</groupId> </exclusion> </exclusions> </dependency>
- Use Maven to compile the application and resolve dependencies. For example, you can
run
mvn clean package
.
Running Applications
When you develop a Java application, you can use a dependency management
tool such as Maven to compile your application. However, it is recommended that do the
following instead:
- Compile the Java application without including dependencies
- Specify the required classpath when you submit the application to the cluster
If the cluster is secure, the node must also have a mapr ticket configured for the user that runs the application.
You can use the following command to launch HPE Ezmeral Data Fabric Database binary
applications:
java -cp <classpath>:. -Djava.library.path=/opt/mapr/lib <main class JAR> <command line arguments>
NOTE The classpath should include items that are part of the 'hbase classpath' script plus
any other required dependencies.