Oracle driver ojdbc6 maven dependency error in spring boot application - eclipse

I am trying to develop spring boot application which will in back-end connect to oracle db.
For oracle db connection I have added ojdbc6 driver dependency. I already have ojdbc6 jar in .m2 folder. But still I am getting compilation error in pom.xml for ojdbc6 dependency 'Missing artifact com.oracle:ojdbc6:jar:11.2.0.3'
As per solutions mentioned on various sites I tried to install ojdbc6 jar using following mvn command :
mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar
But it failed saying artifact already exist:
jar installation error
Error in pom.xml:

You can navigate to .m2 folder, find the path of repository/com/oracle/... and delete the content. then run the command again.

The following solution worked for me:
Download the jar, rename it according to your dependency and paste in the repository folder. For example below path and the dependency:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
</dependency>
C:\Users\Elias.m2\repository\com\ibm\db2\jcc\db2jcc4\10.1

Related

How can I import external *.jar in spring mvc project using maven?

I followed this correct answer in how to add local jar using maven, But I get 404 not found.
POM.Xml
<dependency>
<groupId>tn.mass</groupId>
<artifactId>massTer</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
eclipse console error
Check in your .m2 folder if massTer.jar is present with correct group id and version. Ideally if you are owning the source project massTer then I would suggest you to user maven-install-plugin to get it installed within your .m2 folder when you run mvn clean install over that project. Instead of building the jar and later adding it as mvn install:install

Spring boot 1.4.1 Maven Eclipse Error 88252

I use Eclipse Neon, configured with embedded maven 3.3.9
When I add to my pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
and I try to run Maven Update I get the error:
An internal error occurred during: "Updating Maven Project".
88252
And the dependency jars are not added to Maven Dependencies tree.
If I run mvn clean package -U it builds correctly, both from command line and Eclipse (Run As Maven..)
If I change back to 1.4.0.RELEASE everything works fine!
Any Idea?
The problem was related to some broken package in my local maven repository.
I delete the entire <home_dir>/.m2/repository/org/springframework/ directory, I ran Maven Update again and everything turned normal!

eclipse cannot find the jar available in maven dependencies

I have a pom.xml with the following entry
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
And on maven install the jar is added to the maven repository and is also listed in the maven dependencies library.
But I am not able to import any of the classes from the added jar 'spring-web-3.1.0.RELEASE.jar' for the particular entry, though it shows in the classpath
The error - in eclipse "cannot be resolved to a type"
environment - maven 3.1 and Spring tool suite
Thanks
Solved - found the solution through some other forum
The jar inside the repository was corrupted.
After clearing the .m2 folder in the physical drive and repeating the maven clean install worked.
Thanks for the time #techidiot #jtravaglini.

Manually downloaded Oracle driver but still getting Missing artifact com.oracle:ojdbc6:jar:11.2.0.3:compile

I have followed as mentioned in this article Find Oracle JDBC driver in Maven repository.
I have manually downloaded Oracle driver to maven\repo\com\oracle\ojdbc6\11.2.0.3 and added the following in pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
However I am still getting the following error
Missing artifact com.oracle:ojdbc6:jar:11.2.0.3:compile
What I am doing wrong and how can I resolve this issue?
Thanks
Issue can be resolved by doing the following steps
Run the below from the folder where ojdbc6.jar is copied
mvn install:install-file -DgroupId=com.
oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar
-DgeneratePom=true
Run the below from workspace
mvn -U clean

How to resolve javax/mail/MessagingException?

I am using eclipse indigo to run my tomcat server, when I am launching tomcat server, the tomcat server successfully up and running, but with error shown in the console.
ERROR - ContextLoader[177]: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'com.huahsin68.MyBoc' defined in class path resource [my-spring.xml]: Class that bean class [com.huahsin68.MyBocImp] depends on not found; nested exception is java.lang.NoClassDefFoundError: javax/mail/MessagingException
java.lang.NoClassDefFoundError: javax/mail/MessagingException
It seems like the MessagingException wasn't found. I have check in the Java Build Path > Libraries, I notice that javax.mail_1.4.0.v200105080615.jar was there. This jar file is locate under eclipse > plugins folder. Is there anything solution to rectify this problem?
THanks #!
With Maven, you can add the following dependency:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
Try the following:
Download the java mail jars from: http://www.oracle.com/technetwork/java/javamail/index-138643.html
Add the jars to your WEB-INF/lib folder
Add the jars to Java Build Path > Libraries
That should do it.
For gradle/android users, in build.gradle (Module app):
compile 'javax.mail:mail:1.4.1'
I had a similar problem, running tomcat stand-alone (that is, not through Eclipse). I copied mail-1.4.jar to my tomcat/lib directory. This worked for me.
For those conning late in this ..
I got the same error resolved by adding below jar.
geronimo-javamail_1.4_mail-1.8.3.jar