Hbase 0.98.0-hadoop2 mvn dependency - maven

I am adding hbase jars in my client project using mvn dependency
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.98.0-hadoop2</version>
</dependency>
However, mvn is not able to find the required version and is giving error. I myself checked at following link but there is no hbase-0.98.0-hadoop2.jar present at that location. Please help
Downloading: http://repo1.maven.org/maven2/org/apache/hbase/hbase/0.98.0-hadoop2/hbase-0.98.0-hadoop2.jar
[INFO] Unable to find resource 'org.apache.hbase:hbase:jar:0.98.0-hadoop2' in repository java.net (http://repo1.maven.org/maven2)
Downloading: https://repository.jboss.org/maven2//org/apache/hbase/hbase/0.98.0-hadoop2/hbase-0.98.0-hadoop2.jar
[INFO] Unable to find resource 'org.apache.hbase:hbase:jar:0.98.0-hadoop2' in repository jboss (https://repository.jboss.org/maven2/)
Thanks in advance.

Dependency definition which you have mentioned has been updated. Use below maven dependency definition instead :-
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>0.98.8-hadoop2</version>
</dependency>
this will solve your problem.

Related

Failure to find org.springframework:spring-webmvc-portlet:jar:5.3.22 in https://repo.maven.apache.org/maven2

Recently, I am trying to upgrade my spring version to 5.3.22 and hibernate-core to 5.4.33.Final. However, I am facing this error Failure to find org.springframework:spring-webmvc-portlet:jar:5.3.22 in https://repo.maven.apache.org/maven2 although I have added the dependency as follow:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>5.3.22</version>
</dependency>
I have checked from here that spring-webmvc 5.3.22 is a legitimate version. Any idea on how to fix this ?

Maven: module-info.java:[6,21] module not found: org.slf4j

I'm currently migrating a project to Java 11 (i.e. >= 9) and because JavaFX seems not to work without modules, anymore, I'm currently adding module-info.java files to all sub-projects. But I get the following error:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/mangu/workspace/cloudstore.2/co.codewizards.java9test.project1/src/main/java/module-info.java:[6,21] module not found: org.slf4j
[INFO] 1 error
I'm running OpenJDK 11.0.3, Maven 3.6.1 (embedded in Eclipse 2019-06) and I definitely have the dependency for the module org.slf4j declared in my pom.xml!
In order to simplify things, I created a little, minimal test-project causing the same error.
Here's the test-project's pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>co.codewizards.java9test</groupId>
<artifactId>co.codewizards.java9test.project1</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.8.0-beta4</version>
</dependency>
</dependencies>
</project>
I tried both: 1.8.0-beta4 and 2.0.0-alpha0. Eclipse shows me an existing module-info.class in both JARs (i.e. currently inside slf4j-api-1.8.0-beta4.jar).
Here's the module-info.java:
module co.codewizards.java9test.project1 {
requires java.base;
requires java.se;
requires org.slf4j;
}
And here's the output from mvn clean install -Dmaven.test.skip=true -X (but run inside Eclipse): mvn.log
Any idea what I'm doing wrong?
Update: I just uploaded the little test project: co.codewizards.java9test.project1.7z
Your maven logs show slf4j-api being placed on the classpath, not modulepath.
You need to upgrade the version of maven-compiler-plugin, as modulepath is supported only since version 3.6, whereas your build uses version 3.1.
I was getting the same issue due to older verion of slf4j was coming from one of dependency in pom. So I resolved it by adding below slf4j dependency to my pom :
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
</dependency>
module-info:
module my.service {
requires org.slf4j;
}

How to update or replace dependencies from other library in Maven probject?

My project is using another library commons-collection, which I have no control of. I run the command:
mvn dependency:tree -Dverbose -Dincludes=commons-collections
Verbose not supported since maven-dependency-plugin 3.0
[INFO] com.jde.jnlu:jnlu-qe-web:war:1.0.0-SNAPSHOT
[INFO] \- com.jde.jimi3.data:jd-jimi3-data-sdk:jar:3.0-SNAPSHOT:compile
[INFO] \- com.jde.jmq:jmq-client-spring:jar:2.1.2:compile
[INFO] \- com.jde.jmq:jmq-client-core:jar:2.1.2:compile
[INFO] \- com.jde.jmq:jmq-client-json:jar:1.2.9:compile
[INFO] \- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] \- commons-collections:commons-
collections:jar:3.2.1:compile
As it can been seen, the "commons-collections" is introduced by jd-jimi3-data-sdk which I can't update. But I was reminded of the current version of "commons-collection" has a potential security issue and needs to be upgraded. How can I achieve that in my project?
In your project, if you declare an explicit dependency on the version of commons-collection that you want, Maven will use that instead. See Maven documentation: Resolving conflicts using the dependency tree.
If you want to be really sure, you can also (in addition to the above) exclude commons-collection from your jd-jimi3-data-sdk dependency. Something like:
<project>
...
<dependencies>
<dependency>
<groupId>com.jde.jimi3.data</groupId>
<artifactId>jd-jimi3-data-sdk</artifactId>
<version>3.0-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
This is also covered in the Maven documentation: Dependency Exclusions.
Warning: Since the library you are using - jd-jimi3-data-sdk - was not written with this version of commons-collections, and allegedly not tested with it, this may break you project!

JMS connection to WebsphereMQ

I am trying to connect to WebsphereMQ using JMS.
The following configuration is defined:
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "com.ibm.ws.naming");
properties.put(Context.PROVIDER_URL, "iiop://localhost:2809");
properties.put(Context.SECURITY_PRINCIPAL, "user")
properties.put(Context.SECURITY_CREDENTIALS, "password")
The following dependencies are included in the Maven POM file:
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.mqjms</artifactId>
<version>7.0.1.4</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.mq.jmqi</artifactId>
<version>7.0.1.4</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>com.ibm.dhbcore</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.jar</artifactId>
<version>7.0.1.4</version>
<scope>runtime</scope>
</dependency>
When trying to instantiate the context (new InitialContext(properties)), the following exception is thrown:
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
Is there a maven dependency missing?
Thanks
Not sure what the maven coordinates are, since I don't think these libraries are in any public repos, so coordinates will be repo specific, but according to this post, the jar files required are:
wssec.jar
naming.jar
namingclient.jar
lmproxy.jar
sas.jar
ecutils.jar
Nicholas' answer is correct. (Moving this from comment to allow for formatting)
IBM does not distribute their jars into Maven repositories. Someone in your organization deployed them manually (which is a common practice).
You either:
Are not pointing your maven settings.xml or project pom.xml to your organization's internal Maven Repository
Need to deploy the MQ jars to the repository manually.
mvn deploy:deploy-file -DgroupId=com.ibm.mq -DartifactId=mqjms -Dversion=7.5.0.2 -Dfile=mqjms.jar
See: https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html

Add External JAR in Maven Dependency

I am trying to add external JAR file tigase-muc in a maven based project tigase-server in eclipse IDE.
I have tried following method
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
[INFO] Scanning for projects...
[INFO]
[INFO] Building Tigase XMPP Server 5.1.0 5.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3:install-file (default-cli) # tigase-server ---
[INFO] Installing /home/haider/Downloads/tigase-muc-2.2.0.jar to /
home/haider/.m2/repository/tigase/tigase-muc/2.2.0/tigase-muc-2.2.0.jar
[INFO] --------------
[INFO] BUILD SUCCESS
[INFO] -------------
[INFO] Total time: 0.791s
[INFO] Finished at: Mon Aug 05 18:06:48 PKT 2013
[INFO] Finished at: Mon Aug 05 18:06:48 PKT 2013
[INFO] ----------------------
From above BUILD SUCCESS message i assume that JAR file is correctly added , but when i add following dependency in POM file
<dependency>
<groupId>tigase</groupId>
<artifactId>tigase-xmltools</artifactId>
<version>3.3.6</version>
<scope>compile</scope>
</dependency>
It give me following error Missing artifact tigase:tigase-muc. This message clearly indicate that it didn't get the JAR file that i am referring in dependency
You Contribution will be highly appreciated THANKS
It looks like it installs the Jar like this: [INFO] Installing /home/haider/Downloads/tigase-muc-2.2.0.jar to /
home/haider/.m2/repository/tigase/tigase-muc/2.2.0/tigase-muc-2.2.0.jar
As maven works, its group id is resolved to be ''tigase'', artifactId is ''tigase-muc'', version is ''2.2.0''
So this is right.
Now, I've took a look on tigase:tigase-xmltools:3.3.6 available here
It doesn't define any dependency at all.
So it looks like this would happen even if you don't specify this dependency :)
I would suggest you to run mvn dependency:tree to see where does this dependency comes from
Hope this helps
A more complete error message would help narrow down what's gone wrong. The artifact you installed should be resolvable via the following dependency:
<dependency>
<groupId>tigase</groupId>
<artifactId>tigase-muc</artifactId>
<version>2.2.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
You're reference tigase-xmltools which I'm assuming has a dependency on tigase-muc.
My guess is tigase-xmltools might have dependency on the actual pom of tigase-muc, which you don't have despite having the jar. Seeing the full error message and the pom of tigase-xmltools.
Installing the file with -DgeneratePom=true might help.
Well, if you have added the jar in maven dependencies, then it should be added in Maven Dependencies automatically.
Do you get any specific error while building the project? if yes then can you please share the error trace.
Also have a look at Maven Dependency Scope
Also, verify your local maven repository - M2_HOME\tigase\tigase-xmltools\3.3.6\ and check if the jar is installed here properly.
You can install external jars in local repository.
Here is a blog -
http://findnerd.com/list/view/External-Dependencies-in-Maven-Project/3501/
Hope this would help you.
My solution is use the embed lib repo:
and add local lib:
<dependencies>
<dependency>
<groupId>ok</groupId>
<artifactId>comet4j-tomcat7</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>lib</id>
<name>lib</name>
<url>file://${basedir}/lib</url>
</repository>
</repositories>

Resources