I want to connect to mysql using jdbc in my spring project. I havee added the mysql-connector dependency to the pom.xml project file:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>
This is throwing an error:
The container 'Maven Dependencies' references non existing library 'C:\Users\User\.m2\repository\mysql\mysql-connector-java\8.0.26\mysql-connector-java-8.0.26.jar'
Once I remove this, everything works fine. Same issue with c3p0 dependency.
Please help.
1.Go to your project path and run maven install.wait until the installation process is completed successfully.
2.Then Run maven update.
3.Try to clean your project and do maven build.
Related
My application is failing because of the following issue :
Source '/.../.ivy2/jars/org.apache.zookeeper_zookeeper-3.4.6.jar' does not exist
But I see, there exists a jar in that folder with "tests" suffix - org.apache.zookeeper_zookeeper-3.4.6-tests.jar
If I remove -tests from the name manually, the application runs fine.
I need to understand how can I place the jar my application is expecting in .ivy folder through my program/dependency.
Also, when are the all jars loaded in .ivy/jars folder, is it during the build?
I am using java with maven.
<!-- https://mvnrepository.com/artifact/org.apache.zookeeper/zookeeper -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
<type>pom</type>
</dependency>
add this to your maven dependencies also the org.apache.zookeeper_zookeeper-3.4.6-tests.jar is for the test environment.
Following import in an existing class is throwing a compilation error "import cannot be resolved" on eclipse -
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
The corresponding jar inclusion in pom.xml is -
<properties>
<fasterxml.version>0.7.0</fasterxml.version>
</properties>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>jackson-module-hibernate</artifactId>
<version>${fasterxml.version} </version>
</dependency>
I checked that the corresponding jar file is not present in .m2.
There is no such directory as jackson-module-hibernate inside .m2/fasterxml/
However, jar corresponding to another declaration is present in .m2 -
com.fasterxml.jackson.core
jackson-annotations
2.6.1
Is present in .m2/fasterxml/jackson/core/jackson-annotations/2.6.1
as jackson-annotations-2.6.1.jar
Setup details
Maven version - 3.3
Java version - 1.8.
Eclipse latest version - 2019-06.
I could not verify the absence of the first jar in the working sandbox setup, but that's how it should be, as we had taken a backup of the .m2 directory. How is it possible that the application runs in another setup without the presence of the jar.
Note - I am still a struggler when it comes to maven dependencies and the setup of this legacy project has made me pull hairs. I am trying to do the setup on eclipse. It got setup sometime back, after a lot of struggle, but before I could document all the steps/workarounds we made, I deleted the working setup by mistake.
Update
The pom declaration for jackson-annotations is in the pom of another project. That project has been included in the pom of the dependent project as -
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.dependencies</groupId>
<artifactId>dependency-project</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
You also need:
Execute mvn clean compile from Command Line, on another project
Execute mvn clean compile on your project
Right-click on Project > Maven > Update project...
We are not Maven yet, and I’m trying to run a cucumber feature. Getting the below error.
java.lang.NoClassDefFoundError: org.picocontainer.PicoBuilder at
cucumber.runtime.java.picocontainer.PicoFactory.start(PicoFactory.java:17)
Below is my folder structure for src.
src
test.java.stepdefinition.holiday
Myholiday_StepDef.java
MyRunner.java
test.resources.features
holiday.feature
Add Jar file of “PicoContainer Core” to build path of your project if you are using java project.
You can use maven dependency for “PicoContainer Core” to your pom.xml (for Maven project) as mentioned below.
<dependency>
<groupId>org.picocontainer</groupId>
<artifactId>picocontainer</artifactId>
<version>2.14.1</version>
</dependency>
I am trying to deploy sample Java EE Cargo Tracker application
https://github.com/javaee/cargotracker
I am able to deploy it by executing maven, which build project completely
mvn package cargo:run
However when I am trying to deploying application from IntelliJ Idea on Glassfish 4.1.12 I am getting
Internal Exception: java.lang.NoClassDefFoundError:
org/apache/commons/lang3/Validate. Please see server.log for more details.
My pom contains
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
<scope>compile</scope>
</dependency>
Tried 3.4 and 3.6, does not help, application fails to deploy with above error
This is configuration of artifact in IntelliJ IDEA
Project -> Artifact
Exploded WAR details
may be old or previous dependency occurring the issue so delete .m2 folder and use commons-lang3 version 3.5 update maven project and rebuild it and run it.
I am trying to initialize firebase in Google appengine web app and using maven for dependencies.
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-server-sdk</artifactId>
<version>[3.0.0,)</version>
</dependency>
Getting error
java.lang.NoSuchMethodError: com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(....)
at com.google.firebase.FirebaseOptions$Builder.setServiceAccount(FirebaseOptions.java:77)
How to solve this issue:
Go to http://search.maven.org/#search%7Cga%7C1%7Cgoogle-api-client and find the last version of com.google.api-client API.
Add the dependency on you project
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-assembly</artifactId>
<version>last version </version>
</dependency>
I do this on EJB project using netbeans and glassfish server, so I download the jar file of the last version com.google.api-client add it on Netbeans Libraries and glassfish libraries, then I compile the project and restart glassfish.