包 javax.ejb 不存在
我已经在netbeans中打开了一个项目来查看该项目,但大多数文件中都存在相同的错误。它说“包 javax.ejb 不存在”。这是一个正在运行的项目,我不确定出了什么问题。谁能帮助我吗?
I have opened a project in netbeans to view the project but there is a same error in most of the files. It says that "package javax.ejb does not exist". This is a working project and I am not sure what is wrong. Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先尝试一下:http://forums.netbeans.org/topic44810.html
如果不行要解决您的问题,您可以右键单击您的项目并转到属性部分。单击“库”部分并选择“添加库”。然后向下滚动,直到找到以“Java”开头的库(例如:Java EE 6 API 库)。我将所有 Java 库添加到我的项目中来解决此问题,但是您可以一次添加一个库,然后看看哪一个可以解决该问题。
Try this first: http://forums.netbeans.org/topic44810.html
If that doesn't fix your problem, you can right click on your project and go to the properties section. Click on the Libraries section and select "Add Library". Then scroll down until you find the Libraries that start with "Java" (for example: Java EE 6 API Library). I add all of the Java libraries to my project to resolve this issue, however you might add them one at a time and see which one resolves it.
您只需要导入 Java EE Web 6 API 库即可解决此问题,这些库必须导入到库文件夹下:
右键单击“添加库”,单击“导入库”,向下滚动并查找“Java EE Web 6 API 库”,单击“导入库”,最后单击“添加库”。
这应该可以解决任何问题
在我的例子中,我正在使用 ant java web 应用程序使用 java,我还使用 Java EE 版本 Java EE 6 web
you just need to import Java EE Web 6 API Library to fix this issue, these libraries must be imported under the libraries folder:
right click Add library, click on import library, scroll down and look for Java EE Web 6 API Library, click on import library and finally click on add library.
That should fix any issues
In my case I was working with java with ant java web app, i was also using Java EE Version Java EE 6 web
当我尝试打开 Java Web 服务应用程序时,我遇到了同样的问题,并在尝试了一些方法后成功解决了该问题。对于 Java Web 服务应用程序,问题可能有多种原因。您可能已经安装了“EJB 和 EAR”插件,但是,Netbeans 可能不知道用于运行您的应用程序的 Web 服务器。当项目打开时,它可能会抱怨“一个或多个项目没有正确设置目标服务器”。要解决此问题,您必须为项目分配一个 Web 服务器。不仅要对主项目执行此操作,还要对主项目可能依赖的所需项目执行此操作。
您首先需要确保您不仅打开了主项目,还打开了所需的项目。要打开所需的项目,请右键单击主项目窗口中的主项目名称,然后选择“打开所需的项目”->“打开所需的项目”。打开所有项目。打开后,项目窗口中的项目名称可能会显示为红色以指示问题。
为了使用 Web 服务器,您需要先安装一个。我选择了玻璃鱼。从 https://glassfish.java.net/download.html 下载并安装 Glassfish,如果您还没有这样做过。如果尚未安装,还要安装 Netbeans 的“Glassfish Server”插件。
现在,在 Netbeans 项目窗口中,右键单击主项目名称并选择“解决缺少求解器问题”。如果您在出现的弹出窗口中看到“Glassfish 服务器”,请选择该服务器并单击“确定”。如果没有看到它,请单击“添加服务器”,然后选择“Glassfish 服务器”,然后设置 Glassfish 服务器。这里您需要提供 Glassfish 服务器的安装目录,但我只是使用其余的默认值。后来我使用用户名“admin”和空白密码来运行该项目。还要执行相同的步骤来解决所有所需项目缺少服务器的问题。
I had the same problem when I tried to open a Java web service application and managed to resolve it after trying out a few things. For a Java web service application, there can be multiple causes to the problem. You may have "EJB and EAR" plugin already installed, however, Netbeans may not know the web server to use to run your application. It may have complained that "One or more projects do not have the target server set properly" when the project was opened. To resolve this problem, you have to assign a web server for the project. This is to be done not only for the main project, but also for the required projects that the main project may be dependent upon.
You first need to ensure that you have opened not just the main project, but also the required projects. To open the required projects, right-click on the main projects name in the main projects window and select Open Required Projects -> Open All Projects. After opening, the project names may be colored red in the project window to indicate problem.
In order to use a web server, you need to have one already installed. I chose Glassfish. Download and install Glassfish from https://glassfish.java.net/download.html, if you haven't done so. Also install the "Glassfish Server" plugin for Netbeans, if it's not already installed.
Now, in the Netbeans project window, right-click on the main project name and select "Resolve missing solver issue". If you see "Glassfish server" in the pop-up window that appears, select that one and click ok. If you don't see it, click "Add Server" then select "Glassfish Server", and setup the Glassfish server. Here you need to provide the installation directory of your Glassfish server, but I simply used the default values for the rest. Later I used username "admin" with blank password for running the project. Also perform the same steps to resolve the missing server for all of the required projects.
将 Java EE Web 8 API 库添加到 Libraries 文件夹中
Add Java EE Web 8 API Library into the Libraries folder