缺少工件 javax.transaction:jta:jar:1.0.1B(问题不同,因为您可能会看到分辨率不同)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19086523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Missing artifact javax.transaction:jta:jar:1.0.1B ( Issue was different as you may see the resolution is different)
提问by Patty
I am trying to learn Hibernate-Spring-Struts using the example here.
我正在尝试使用此处的示例来学习 Hibernate-Spring-Struts 。
But after creating the pom.xml
getting this error :
但是在创建后pom.xml
得到这个错误:
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
:
我只在创建pom.xml
文件方面取得了进展,并进行了更改以包含最新的库。这是我的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?
我尝试了依赖和不依赖javax.transation
. 没有区别。谁能告诉我我做错了什么?我该怎么做才能摆脱它?
采纳答案by Roman C
The error in your pom.xml
because you mess up different versions of Struts core and plugins.
你的错误是pom.xml
因为你搞砸了不同版本的 Struts 核心和插件。
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)
我不知道你为什么需要 JTA 1.0.1B 但你可以将 hibernate 更改为 3.3.2(至少,没有头痛)
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.3.2.ga</version>
</dependency>
it has a recommended dependency for JTA 1.1.
它具有 JTA 1.1 的推荐依赖项。
Create a new project from pom.xml
then add source files to it.
创建一个新项目,pom.xml
然后向其中添加源文件。
回答by Raghavendra Reddy Busireddy
回答by shareef
In my case i tried example from mkyong
就我而言,我尝试了 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
当我得到异常时,我进行了很多搜索,我使用的是 spring sts 套装工具,并使用 JDK 8 eclipse MARS 的解决方案是
I changed pom to 1.1instead of 1.0.1B
我将 pom 改为1.1而不是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
)
如果它不能从 m2 repo 自动下载,你应该手动下载它(你可以在文件夹中的 repo 中检查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.
并检查项目属性中的 maven 依赖项,它不应在 lib 选项卡中给您错误。
References :reference 1reference 2reference 3reference 4reference 5
参考文献:参考文献1参考文献2参考文献3参考文献4参考文献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/
1- http://www.mkyong.com/web-development/the-web-xml-deployment-descriptor-examples/
2-http://jonathan.lalou.free.fr/?p=2026
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
3-创建名为“sessionFactory”的 bean 时出错无法实例化默认的 tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] Tomcat 错误:在 ExternalContext 中未找到作为资源
回答by zinking
some approach from Unable to resolve javax.transaction dependency
无法解析 javax.transaction 依赖的一些方法
clear the .ivy/cache folder. it works, but takes very long time.
清除 .ivy/cache 文件夹。它有效,但需要很长时间。
回答by Gustavo Rozolin
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>
回答by tienph
At the moment, it may be unnecessary. But I think we should update this ticket for someone.
目前,这可能是不必要的。但我认为我们应该为某人更新这张票。
It works for me. Change porm.xml
这个对我有用。更改 porm.xml
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.16</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.3.Final</version>
</dependency>