Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven missing dependency jta-1.0.1b

I'm trying to build my java hibernate project with maven. But when I try to do this, it looks like there is a dependency not available?

I have this pom.xml now in my project:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.viralpatel.hibernate</groupId>
  <artifactId>HibernateHelloWorldXML</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>HibernateHelloWorldXML</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>ejb3-persistence</artifactId>
      <version>1.0.1.GA</version>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-annotations</artifactId>
      <version>3.3.1.GA</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.10</version>
    </dependency>
  </dependencies>
</project>

When I try to build using mvn then I get this error:

[WARNING] An error occurred during dependency resolution.
    Failed to retrieve javax.transaction:jta-1.0.1B
Caused by: Failure to find javax.transaction:jta:jar:1.0.1B in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
 not be reattempted until the update interval of central has elapsed or updates are forced

Try downloading the file manually from:
    http://java.sun.com/products/jta

Then, install it using the command:
    mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Drepository
Id=[id]

Path to dependency:
        1) net.viralpatel.hibernate:HibernateHelloWorldXML:jar:1.0-SNAPSHOT
        2) org.hibernate:hibernate-annotations:jar:3.3.1.GA
        3) org.hibernate:hibernate:jar:3.2.6.ga
        4) javax.transaction:jta:jar:1.0.1B


  javax.transaction:jta:jar:1.0.1B

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

I searched for this error and found a lot of people that had to change their hibernate-core dependency version in their pom.xml file but it seems like I don't have a hibernate-core, so how can I solve this?

like image 777
Kaj Avatar asked Apr 25 '14 06:04

Kaj


2 Answers

<dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate</artifactId>
 <version>3.3.2.ga</version>
</dependency>

it has a recommended dependency for JTA 1.1.

OR

You can add "http://download.java.net/maven/2" as new repository in pom.xml or settings.xml

  <repository>
        <id>java.net.m2repo</id>
        <name>java.net Maven 2 Repository</name>
        <url>http://download.java.net/maven/2/</url>
        <layout>default</layout>
    </repository>

For any JEE library provided by Sun or oracle .. Add below repository

 <repositories>
    <repository>
        <id>GlassFish</id>
        <name>GlassFish Maven Repository</name>
        <url>http://download.java.net/maven/glassfish/</url>
    </repository>
    <repository>
        <id>java.net.m1repo</id>
        <name>java.net Maven 1 Repository</name>
        <url>http://download.java.net/maven/1/</url>
        <layout>legacy</layout>
    </repository>
    <repository>
        <id>java.net.m2repo</id>
        <name>java.net Maven 2 Repository</name>
        <url>http://download.java.net/maven/2/</url>
        <layout>default</layout>
    </repository>
</repositories> 
like image 112
Shashi Avatar answered Oct 05 '22 23:10

Shashi


I have the same problem and I have downloaded the jta-1.0.1B.jar file manually from http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm

Im using Netbeans7.3. I expanded dependencies folder in the project and found the jta-1.0.1B.jar with small yellow icon(meant for error). Then I right click and use the option "Manually install artifact" and point to the location of the file jta-1.0.1B.jar. Solved.

like image 38
street hawk Avatar answered Oct 06 '22 00:10

street hawk