[英]Cannot import javax.ejb.* packages
I am having trouble in building an EJB
session bean. 我在构建
EJB
会话bean时遇到了麻烦。
The following packages
cannot be found: 找不到以下
packages
:
import javax.ejb.LocalBean;
import javax.ejb.Stateful;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
Some solutions implied adding the libraries j2ee.jar
and javaee
.jar to the java build path. 一些解决方案暗示将库
j2ee.jar
和javaee
.jar添加到java构建路径中。
I am using jdk-7u75-windows-x64
and java_ee_sdk-7-windows-ml
and cannot find any of these libraries at the given location($JAVA_HOME\\lib). 我正在使用
jdk-7u75-windows-x64
和jdk-7u75-windows-x64
java_ee_sdk-7-windows-ml
并且在给定位置找不到任何这些库($ JAVA_HOME \\ lib)。 I am using eclipse(kepler) on a Windows 7 x64
machine 我在
Windows 7 x64
机器上使用eclipse(kepler)
javaee.jar ships with neither eclipse nor java(jdk). javaee.jar既没有eclipse也没有java(jdk)。 The file must be manually downloaded and added to the project build path.
必须手动下载该文件并将其添加到项目构建路径中。 The java ee 7 api can be found here.
java ee 7 api可以在这里找到。 Alternatively, a maven dependency can be used:
或者,可以使用maven依赖项:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
The EJB API is found in the JavaEE libraries which are, as you correctly pointed out, distributed with the j2ee.jar library. EJB API位于JavaEE库中,正如您正确指出的那样,它与j2ee.jar库一起分发。 If you're using Eclipse, its classpath may be pointing to the standard Java libraries and not the Enterprise libraries.
如果您正在使用Eclipse,则其类路径可能指向标准Java库而不是Enterprise库。 You can try two things:
你可以尝试两件事:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.