NetBeans - Java EE 服务器类路径未正确设置 - 服务器主目录丢失错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7128709/
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
NetBeans - Java EE server classpath is not correctly set up - server home directory is missing error
提问by Suchi
I am getting an error when I try to build my project in NetBeans. I am using JBoss 5.1.0 server and have attached that to my project. The error is -
当我尝试在 NetBeans 中构建我的项目时出现错误。我正在使用 JBoss 5.1.0 服务器并将其附加到我的项目中。错误是——
The following error occurred while executing this line:
.../myPath/build-impl.xml:176: The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=<app_server_installation_directory>
I am using Mac OS X Lion.
我正在使用 Mac OS X Lion。
采纳答案by Suchi
I was missing a library. When I right clicked the project and went to libraries, it showed me library missing. I added the library and did a clean and build and the error disappeared
我错过了一个图书馆。当我右键单击该项目并转到库时,它显示我缺少库。我添加了库并进行了清理和构建,错误消失了
回答by Blisterpeanuts
Clean builds did not help me, either. I took a look at project.properties and found that j2ee.server.homewas not set anywhere, although j2ee.platform.classpathdepends on it.
干净的构建也没有帮助我。我查看了project.properties,发现j2ee.server.home没有设置任何地方,虽然j2ee.platform.classpath依赖于它。
I do have Weblogic Server set up under /home (on a Linux machine).
我确实在 /home 下(在 Linux 机器上)设置了 Weblogic Server。
So, I closed the project and added a line to project.properties:
j2ee.server.home=/home/blister/wls/wlserver
所以,我关闭了项目并在 project.properties 中添加了一行:
j2ee.server.home=/home/blister/wls/wlserver
(where wlserver= the server name)
(其中wlserver= 服务器名称)
And reopened the project. Presto, the app now builds. It still doesn't know where the app server is, but at least I can built my jar and can worry about deploying it later. (I tell it to build a warwhich deploys nicely to Weblogic.)
并重新打开了该项目。Presto,应用程序现在构建。它仍然不知道应用服务器在哪里,但至少我可以构建我的 jar 并且可以担心以后部署它。(我告诉它构建一个可以很好地部署到 Weblogic的War。)
回答by user3664210
If you are using netBeans Ide, then right click on the project. click properties. in the properties menu select Run. in that the first text box is server. There select the server. with which u want to run the project. If the server details are not configured before. configure server details and try. it wil help you to solve the above problem.
如果您使用的是 netBeans Ide,则右键单击该项目。单击属性。在属性菜单中选择运行。因为第一个文本框是服务器。在那里选择服务器。你想用它来运行项目。如果之前没有配置服务器详细信息。配置服务器详细信息并尝试。它将帮助您解决上述问题。
回答by TomasJohn
I also had this error. However despite adding servers in the Run section of the Properties window, repeatedly no servers showed as being available to add to the Project ( again within the Run section ). The solution to being able to see a server in this server list was to run Netbeans as an admin ( which I saw Rotunba referencing in this thread..It was then possible to add a server and the project built successfully..
我也有这个错误。然而,尽管在“属性”窗口的“运行”部分添加了服务器,但反复显示没有服务器可添加到项目中(再次在“运行”部分中)。能够在此服务器列表中看到服务器的解决方案是以管理员身份运行 Netbeans(我在此线程中看到 Rotunba 引用了该服务器。然后可以添加服务器并成功构建项目。)
回答by Kersy
This worked for me.
这对我有用。
Right click on the Project -> Properties -> Run
And Change the server Setting from the current server to another sever and click OK.
Wait for any background scanning to finish.
右键单击项目 -> 属性 -> 运行
并将服务器设置从当前服务器更改为另一台服务器,然后单击确定。
等待任何后台扫描完成。
Repeat the processes 1 to 3 again this time selecting the actual server you want to run the code on.
这次再次重复过程 1 到 3,选择要在其上运行代码的实际服务器。
Then try Re-Running your application.
然后尝试重新运行您的应用程序。
回答by rotunba
It could also be as simple as not running your IDE i.e. netbeans as an administrator on your machine. I had the same problem. Wasted some time.
它也可以像不在机器上以管理员身份运行 IDE 即 netbeans 一样简单。我有同样的问题。浪费了一些时间。