1

I am following this link Link to run my hibernate application. Although I have added all the required dependencies but it runs into following error.

The following artifacts could not be resolved: javax.security:jacc:jar:1.0, 
javax.transaction:jta:jar:1.0.1B: Failure to find javax.security:jacc:jar:1.0 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 -> [Help 1]

The netbeans also shows the following message in its properties window.

Problems: * some dependency artifacts are not in the local repository.

My Pom.xml

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.myProject</groupId>
  <artifactId>hibernateTesting</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>hibernateTesting</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

       <dependencies>
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>3.0</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
      <version>1.0.1.Final</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.grlea.log.adapters</groupId>
      <artifactId>simple-log-sl4j</artifactId>
      <version>1.7</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>javax.security</groupId>
      <artifactId>jacc</artifactId>
      <version>1.0</version>
      <type>jar</type>
    </dependency>
  </dependencies>
</project>
Daniel Morgan
  • 782
  • 5
  • 15
  • 43
  • possible duplicate of [When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified?](http://stackoverflow.com/questions/4856307/when-maven-says-resolution-will-not-be-reattempted-until-the-update-interval-of) or http://stackoverflow.com/questions/4701532/force-maven-update or http://stackoverflow.com/questions/12645707/update-interval-of-maven-central-repo or ... – Brian Roach Feb 22 '13 at 04:58
  • Is this for a standalone or JEE app? If JEE, what version? – Perception Feb 22 '13 at 04:58
  • @Perception, It is a SE JDK 7 – Daniel Morgan Feb 22 '13 at 05:01
  • @BrianRoach, It is not a duplicate, my problem is related to two specific libraries ,please read the question again. – Daniel Morgan Feb 22 '13 at 05:03
  • why you have pom for jta ? – Manish Singh Feb 22 '13 at 05:04
  • @BrianRoach, it is not because I have specified the libraries, and there is not accepted answer in those questions. – Daniel Morgan Feb 22 '13 at 05:04
  • @user395072, netbeans did it automatically, even when I remove it run into same error. – Daniel Morgan Feb 22 '13 at 05:12
  • 1
    Remove it if you don't have dependent modules. Install the jacc jar manually if you don't have jacc in your local repository – Manish Singh Feb 22 '13 at 05:16
  • @DanielMorgan - some of the dependencies you are trying to pull in only exist in deprecated repositories. I assume that you are trying to create a standalone SE app with Hibernate and JTA transactions? What JTA provider are you using? – Perception Feb 22 '13 at 05:21
  • @Perception, not sure, I am new to this, how to find out? I am just following the mentioned tutorial – Daniel Morgan Feb 22 '13 at 05:26
  • @DanielMorgan - the tutorial you linked doesn't use Maven (it asks you to explicitly download JARs and include them in your build path). But with Maven your dependencies are automatically managed. You should only need the JUnit, Hibernate 3 and sl4j dependencies in your POM. – Perception Feb 22 '13 at 05:39
  • @Perception, referring to my Pom in the question I have them all dont I? – Daniel Morgan Feb 22 '13 at 05:47
  • @DanielMorgan - you have some unnecessary ones (pretty much all the JTA stuff). You can't really use JTA without a provider implementation, and its totally unnecessary for the tutorial you linked. – Perception Feb 22 '13 at 05:50
  • 1
    @Perception, I have updated the pom but running into same problem – Daniel Morgan Feb 22 '13 at 05:55
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/24951/discussion-between-perception-and-daniel-morgan) – Perception Feb 22 '13 at 05:55

2 Answers2

1

Try adding this repository to your pom.xml

<repositories>
  <repository>
    <id>JBoss Deprecated</id>
    <url>https://repository.jboss.org/nexus/content/repositories/deprecated</url>
  </repository>
  <repository>
    <id>java.net</id>
    <url>http://download.java.net/maven/2/</url>
  </repository>
</repositories>

JBoss repository will find javax.security.jcc and java.net repository will have javax.transaction.jta jar

<repositories> tags can go anywhere inside your <project> tags. I ususally declare them at the beginning of the pom.

  • I am trying to add it but it does not accept it where should I put this ? I mean in which part of my pom.xml ? – Daniel Morgan Feb 22 '13 at 06:08
  • This goes into pom.xml as first child. Like - 4.0.0 ... ... PorjectName ... ... ... Eclipse will show autocompletion based on given DTD. – Ravi Kumar Jun 07 '13 at 22:29
  • Another similar option is spring-maven-release Spring Maven Release Repository http://maven.springframework.org/release – Michael Munsey Aug 13 '13 at 20:29
  • The java.net repository is blacklisted according to Netbeans... any idea why or if its something I should be concerned about? – monksy Sep 17 '13 at 23:33
0

You could try to clean and force an update of your maven repo like this:

mvn clean -U
Michel Feldheim
  • 17,625
  • 5
  • 60
  • 77
  • my IDE is netbeans, where should I type it ? – Daniel Morgan Feb 22 '13 at 05:38
  • On your console (cmd on windows) change into your project path, then run the command. If it says unknown command, you need to add the `C:/.../maven/bin` path to your [environment PATH variable](http://www.itechtalk.com/thread3595.html) – Michel Feldheim Feb 22 '13 at 05:50
  • -U is for updating snapshots, not the release versions. The problem here is, in his settings.xml he may not have added these repositories, and maven is unable to find these packages. These are not available in standard repos, rather in http://download.java.net/maven/2/ and https://repository.jboss.org/nexus/content/repositories/deprecated – Ravi Kumar Jun 07 '13 at 22:32