Dependency for driver-class com.ibm.db2.jcc.DB2Driver is missing - maven

i added the followinig dependency for my project to connect to the database:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>4.19.26</version>
</dependency>
Since the connection to my database gets refused (ERRORCODE=-4499, SQLSTATE=08001) i tried to add a newer driver
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>11.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/com/ibm/db2/jcc/db2jcc4/11.1/db2jcc4-11.1.jar</systemPath>
</dependency>
I installed the jar with the maven install comand in my project directory. It created a lib folder with everything in it.
However i now get the following error:
Dependency for driver-class com.ibm.db2.jcc.DB2Driver is missing!
The maven project is definitly able to locate the jar-file.

There is a second dependency you are missing :
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc_license_cu</artifactId>
<version>11.1</version>
<systemPath>${basedir}/lib/com/ibm/db2/jcc/db2jcc4/11.1/db2jcc_license_cu.jar</systemPath>
</dependency>
Found on nacho4d's blog

Related

Maven Fatal Error because of cucumber-junit dependency

Something very strange is happening.
I have the following dependency in my pom.xml:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<type>pom</type>
<scope>test</scope>
</dependency>
The project compiles perfectly.
But as soon as I change the cucumber version in this dependency to 1.2.6 I get an error when compling the progect:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gp-it-test-product: Fatal error compiling
I also attempted to use the most recent cucumber version:
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.10.1</version>
<scope>test</scope>
</dependency>
But I got the same error. Why is this happening? Version 1.2.5 works OK
It was moved to another group io.cucumber after version 1.2.5 check the maven repository
Okay, I finally solved this. The problem was not in maven, but in cucumber. It appeared that some old packages that I was using in my code disappeared, so I had to change all old imports to new ones and also make some other changes in accordance with the new version to make it work. Nullpointer exception that I posted was due to changed package of Scenario class.

Imported Git Repository but some imports are not found?

I have a Git Repository that I imported into Eclipse but it has some import errors.
I'm using Spring Redis version 1.8.4 and following their examples on how to do object mapping. I used the Jackson Mapper link and then followed that to the jackson-datatype-mongo mapper.
https://github.com/commercehub-oss/jackson-datatype-mongo
On my work computer everything is fine.
<dependency>
<groupId>com.commercehub.jackson</groupId>
<artifactId>jackson-datatype-mongo</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.4.RELEASE</version>
</dependency>
If I remove the jackson-datatype-mongo dependency then the imports are fine but then I wouldn't have the MongoModule import. I tried one of eclipse's solutions and it said that it could an archive 'jackson-databind-2.8.1.jar' and everything would be clear. But then my '.classpath' file is now changed.
I don't understand how it is fine on one machine and all I did was clone the repository into another machine.
I solved the issue. I checked libraries in the project and it showed that the class was in there. So I went into '.m2\repository\com\fasterxml\jackson\core' and deleted the whole 'jackson-databind' folder and restarted eclipse and all the imports were now resolved.

Maven dependency for javax.mail

What is the maven dependency i should add for
import javax.mail.*;
import javax.mail.internet.*;
Adding the maven dependency from here http://mvnrepository.com/artifact/javax.mail/mail/1.5.0-b01 makes some of the jersey dependencies unable to retrieve error. What do you think is going wrong?
The version 1.6.3 had been the last version of JavaMail; since 2019-07-03, the new name for it is "Jakarta Mail".
Together with the name change also the Maven coordinates got different:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>…</version>
</dependency>
The project homepage can be found here: https://eclipse-ee4j.github.io/mail/
We are using following dependency:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>

No suitable driver found for jdbc (only in jar file)

I'm using netbeans to create a simple java maven application with a very simple JavaDB database connectivity. I've configured the dependencies in maven pom.xml file as follows, and my application works correctly when I run it from the IDE.
pom.xml
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.12.1.1</version>
</dependency>
Yet when I build the project with dependencies and try to run the final jar, I get the following error.
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/TestDB
I've even tried copying the derby.jar to the application jar file location. But still the above error appears. I'm not sure what I'm doing wrong.

Postgresql driver not found for maven dependency

I am running a spring project with maven and I am trying to use postgresql. I've added the dependency to pom.xml, but at tomcat startup, I get the following error:
java.lang.ClassNotFoundException: org.postgresql.Driver
pom.xml dependency:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1101-jdbc41</version>
</dependency>
It appears that Maven isn't downloading the jar so the Driver class is not found. Any ideas?
What also worked for me if you are on intellj:
right klick pom.xml->Maven->Reimport
Don't know why it doesn't download the artifact on copy paste.
When I put this in my pom, the artifact gets downloaded. Maybe you should clean your maven repository cache or delete the folders manually and retry.
If you came here for "missing artifact" error, This worked for me:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
</dependency>
For PostgreSQL 10 I use this:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.4</version>
</dependency>
Maven wasn't recognizing the new dependency I have added to pom.xml, so I added it through 'Dependency view' from the xml and that did the trick. Thank you for your answers.
Try to rebuild the artifact, most likely only the added dependency was not included there
You need to place a copy of the jar in the tomcat/lib folder.

Resources