Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing artifact javax.transaction:jta:jar:1.0.1B ( Issue was different as you may see the resolution is different)

I am trying to learn Hibernate-Spring-Struts using the example Struts 2 + Spring + Hibernate integration example.

But after creating the pom.xml getting this error :

Missing artifact javax.transaction:jta:jar:1.0.1B

I made a progress only up to creating the pom.xml file and made the changes to include most recent libraries.

Here is 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>S3HMaven</groupId>
<artifactId>S3HMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

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

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

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.0.1B</version>
    </dependency>

    <!-- Struts 2 -->
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>2.1.8</version>
    </dependency>

    <!-- Struts 2 + Spring plugins -->
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>2.3.15.2</version>
    </dependency>

    <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.26</version>
    </dependency>

    <!-- Spring framework -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>2.5.6</version>
    </dependency>

    <!-- Hibernate core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate</artifactId>
        <version>3.2.7.ga</version>
    </dependency>

    <!-- Hibernate core library dependency start -->
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>
    <!-- Hibernate core library dependency end -->

    <!-- Hibernate query library dependency start -->
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.7</version>
    </dependency>
    <!-- Hibernate query library dependency end -->

</dependencies>
</project>

I tried with and without dependency for javax.transation. Did not make difference. Can any one tell me what am I doing wrong ? What should I do to get rid of it?

like image 607
VictorGram Avatar asked Sep 30 '13 04:09

VictorGram


4 Answers

The error in your pom.xml because you mess up different versions of Struts core and plugins.

Change

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.15.2</version>
</dependency>

I don't know why do you need JTA 1.0.1B but you could change hibernate to 3.3.2 (at least, without headaches)

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

it has a recommended dependency for JTA 1.1.

Create a new project from pom.xml then add source files to it.

like image 44
Roman C Avatar answered Sep 16 '22 22:09

Roman C


In my case i tried example from mkyong

jsf-2.0 spring hibernate integration example

When i got the exception i searched alot i was using spring sts suit tool , and eclipse MARS with JDK 8 the solution was

I changed pom to 1.1 instead of 1.0.1B

<dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
</dependency>

And if it could not be downloaded automatically from m2 repo you should download it manualy (you can check this in the repo in folder C:\Users\pc1\.m2\repository\javax\transaction\jta\1.1\jta-1.1.jar )

and check the maven dependency in project properties it should not give you an error in the lib tab.

References : reference 1 reference 2 reference 3 reference 4 reference 5

Related issues might appear after you solve this if you are applying the tutorial:

1-http://www.mkyong.com/web-development/the-web-xml-deployment-descriptor-examples/

2-http://jonathan.lalou.free.fr/?p=2026

3-Error creating bean with name 'sessionFactory' Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] Tomcat error: Not Found in ExternalContext as a Resource

like image 66
shareef Avatar answered Sep 19 '22 22:09

shareef


Which repository are you using?

Add the java.net Maven repository as below.

<repository>
    <id>java.net</id>
    <url>http://download.java.net/maven/2/</url>
</repository>
like image 22
Raghavendra Reddy Busireddy Avatar answered Sep 17 '22 22:09

Raghavendra Reddy Busireddy


This repo worked for me:

   <repository>
           <id>webpublico-repository</id>
                <name>Webpublico Nexus Repository</name>
                <url>http://repository.webpublico.com.br/repository/maven-public/</url>
   </repository>
like image 45
Gustavo Rozolin Avatar answered Sep 17 '22 22:09

Gustavo Rozolin