gudii9
asked on
hibernate example using maven
Hi
I am working on below example
https://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/
i downloaded code and unzipped adn impred as maven project to eclipse.
when i open pom i see error
Project build error: 'dependencies.dependency.v ersion' for com.oracle:ojdbc6:jar is missing.
how to resolve this error and execue
when i right click run as maven install gave below error
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------- ---------- ---------- ---------- ---------- ------
[INFO] Building HibernateExample 1.0
[INFO] -------------------------- ---------- ---------- ---------- ---------- ------
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2 .0 is missing, no dependency information available
[INFO] -------------------------- ---------- ---------- ---------- ---------- ------
[INFO] BUILD FAILURE
[INFO] -------------------------- ---------- ---------- ---------- ---------- ------
[INFO] Total time: 0.510 s
[INFO] Finished at: 2017-01-21T15:56:34-05:00
[INFO] Final Memory: 6M/155M
[INFO] -------------------------- ---------- ---------- ---------- ---------- ------
Failed to execute goal on project HibernateExample: Could not resolve dependencies for project com.mkyong.common:Hibernat eExample:j ar:1.0: Failure to find com.oracle:ojdbc6:jar:11.2 .0 in http://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of JBoss repository has elapsed or updates are forced -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
please advise
I am working on below example
https://www.mkyong.com/hibernate/maven-3-hibernate-3-6-oracle-11g-example-xml-mapping/
i downloaded code and unzipped adn impred as maven project to eclipse.
when i open pom i see error
Project build error: 'dependencies.dependency.v
how to resolve this error and execue
when i right click run as maven install gave below error
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------
[INFO] Building HibernateExample 1.0
[INFO] --------------------------
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2
[INFO] --------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------
[INFO] Total time: 0.510 s
[INFO] Finished at: 2017-01-21T15:56:34-05:00
[INFO] Final Memory: 6M/155M
[INFO] --------------------------
Failed to execute goal on project HibernateExample: Could not resolve dependencies for project com.mkyong.common:Hibernat
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<!-- ORACLE database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
</dependency>
remove aboe oracle entry
and
simply
add that jar from java build path??
Can you not see section 4 of the link YOU posted ?
It quite clearly has a link to a page that tells you how to install oracle driver into maven.
It quite clearly has a link to a page that tells you how to install oracle driver into maven.
ASKER
For Oracle JDBC driver, you need to install it into your local maven repository manually.
For Oracle JDBC Driver
Read this guide – How to add Oracle JDBC driver in your Maven local repository
i see it now . I will try it today
ASKER
\HibernateExample>mvn install:install-file -Dfile=C:\oraclexe\app\oracle\produc t\11.2.0\s erver\jdbc \lib\ojdbc 6.jar
'mvn' is not recognized as an internal or external command,
operable program or batch file.
getting above error. looks like ned to set maven path
Yes so do it
ASKER
http://www.mkyong.com/maven/how-to-install-maven-in-windows/
just completed
>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09 453c074783 23dc5; 2015-11-10T11:41:47-05:00)
Maven home: C:\gpSoftwares\apache-mave n-3.3.9-bi n\apache-m aven-3.3.9
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_102\jr e
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
just completed
>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09
Maven home: C:\gpSoftwares\apache-mave
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_102\jr
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
ASKER
D:\>mvn install:install-file -Dfile=D:\app\mkyong\product\11.2.0\ dbhome_1\j dbc\lib\oj dbc6.jar
Step 4 says above step.
in my case in instead of D which directory i have to go? to my eclipse workspace as below?
C:\Users\xyz\gpJava\edu\Hi
above gives below error
C:\Users\xyz\gpJava\edu\Hi
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------
[INFO] Building HibernateExample 1.0
[INFO] --------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:i
[INFO] --------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------
[INFO] Total time: 1.196 s
[INFO] Finished at: 2017-01-24T22:47:36-05:00
[INFO] Final Memory: 7M/123M
[INFO] --------------------------
Failed to execute goal org.apache.maven.plugins:m
[0] 'groupId' is missing.
[1] 'artifactId' is missing.
[2] 'packaging' is missing.
[3] 'version' is missing.
-> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
actually i mised some commamd
HibernateExample>mvn install:install-file -Dfile=C:\oraclexe\app\ora
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------
[INFO] Building HibernateExample 1.0
[INFO] --------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:i
[INFO] Installing C:\oraclexe\app\oracle\pro
[INFO] Installing C:\Users\SAIGAN~1\AppData\
[INFO] --------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------
[INFO] Total time: 1.099 s
[INFO] Finished at: 2017-01-24T22:58:36-05:00
[INFO] Final Memory: 7M/123M
[INFO] --------------------------
above is fine
ASKER
finally works as attached
hibernateWorksMAven.png
hibernateWorksMAven.png
ASKER
final command i used is
mvn install:install-file -Dfile=C:\oraclexe\app\ora cle\produc t\11.2.0\s erver\jdbc \lib\ojdbc 6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
mvn install:install-file -Dfile=C:\oraclexe\app\ora
ASKER
my modified hibernate config file is
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
<property name="hibernate.connection.username">sample</property>
<property name="hibernate.connection.password">admin</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="show_sql">true</property>
<mapping resource="com/mkyong/user/DBUser.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>
ASKER
i already have ojdbc5 jar at
C:\oraclexe\app\oracle\pro
how to install it and integrate to maven?
which section 4?
please advise