Eclipse 4.2 (Juno) 在 Tomcat 7 中“无法使用所选类型创建服务器”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13423593/
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
Eclipse 4.2 (Juno) 'Cannot create a server using the selected type' in Tomcat 7
提问by Joe
I have installed:
我已经安装:
- eclipse juno
- java-6-openjdk-i386 (selected as default JRE in Eclipse)
- java-7-openjdk-i386
- 日食朱诺
- java-6-openjdk-i386(在 Eclipse 中被选为默认 JRE)
- java-7-openjdk-i386
When I try to add a new server Tomcat7, in Eclipse, I get this message
当我尝试在 Eclipse 中添加新服务器 Tomcat7 时,收到此消息
'Cannot create a server using the selected type'
'无法使用所选类型创建服务器'
and I can not continue. No problem adding Tomcat6 server.
我不能继续。添加Tomcat6服务器没问题。
I read this questionbut it didn't solve it for me
我读了这个问题,但它没有为我解决
回答by Joe
1 . To fix the error 'Cannot create a server using the selected type'run the following:
1 . 要修复错误“无法使用所选类型创建服务器”,请运行以下命令:
cd ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/
rm org.eclipse.jst.server.tomcat.core.prefs
rm org.eclipse.wst.server.core.prefs
2 . Once you do this, another error
2 . 一旦你这样做,另一个错误
'Could not load the Tomcat server configuration at /usr/share/tomcat7/conf. The configuration may be corrupt or incomplete /usr/share/tomcat7/conf/catalina.policy (No such file or directory)'
'无法在 /usr/share/tomcat7/conf 加载 Tomcat 服务器配置。配置可能已损坏或不完整 /usr/share/tomcat7/conf/catalina.policy (No such file or directory)'
So to fix this run the following commands:
因此,要解决此问题,请运行以下命令:
cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf conf
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat7 log
sudo chmod -R 777 /usr/share/tomcat7/conf
3 . Restart server and Eclipse
3 . 重启服务器和 Eclipse
4 . Add new server
4 . 添加新服务器
- Choose the Servers under the Server category;
- Create new server wizard;
- Choose Apache / Tomcat v7.0 Serverand press Next;
- Enter /usr/share/tomcat7into the Tomcat installation directoryand press Next;
- Select your project on the left pane under “Available” and press Add> to move it to the right pane under Configured; press Finish;
- 选择服务器类别下的服务器;
- 创建新服务器向导;
- 选择Apache / Tomcat v7.0 Server并按 Next;
- 在Tomcat安装目录中输入/usr/share/tomcat7,按Next;
- 在“Available”下的左窗格中选择您的项目,然后按 Add> 将其移动到Configured下的右窗格中;按完成;
Eclipse need to start the server, and to do that, first, it has to stop the one running in background.
Eclipse 需要启动服务器,为此,首先,它必须停止在后台运行的服务器。
sudo service tomcat7 stop
须藤服务 tomcat7 停止
If you don't have to automatically start at boot, we can use the following command
如果不需要开机自动启动,我们可以使用下面的命令
sudo update-rc.d tomcat7 disable
须藤更新-rc.d tomcat7 禁用
If, during server start, you receive warnings like:
如果在服务器启动期间,您收到如下警告:
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
You may also need to run the following:
您可能还需要运行以下命令:
cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/common common
sudo ln -s /var/lib/tomcat7/server server
sudo ln -s /var/lib/tomcat7/shared shared
回答by Joe
This is a known issue that can happens, to resolve this error, try one or all of the following:
这是一个可能发生的已知问题,要解决此错误,请尝试以下一种或所有方法:
Go to
去
Window–>Preferences–>Server–>Runtime Environments
窗口->首选项->服务器->运行时环境
and fix the broken path/link for the server.
并修复服务器的损坏路径/链接。
Or rename the
或重命名
org.eclipse.jst.server.tomcat.core.prefs
to
org.eclipse.jst.server.tomcat.core.prefs.bak
org.eclipse.jst.server.tomcat.core.prefs
到
org.eclipse.jst.server.tomcat.core.prefs.bak
(or you can delete this file). This file can be found at \workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
(或者您可以删除此文件)。这个文件可以在\workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
Rename the
重命名
org.eclipse.wst.server.core.prefs to
org.eclipse.wst.server.core.prefs.bak
(or delete the file).
org.eclipse.wst.server.core.prefs to
org.eclipse.wst.server.core.prefs.bak
(或删除文件)。
This file also can be found at the same location as above.
该文件也可以在与上述相同的位置找到。
回答by user2395616
I had Eclipse working with Tomcat for several days, then suddenly got error 'could not load tomcat server configuration may be corrupt or incomplete' - fix for me was to remove Tomcat under Windows > preferences > server > runtime Environment -- and then re-add same server, and it began working again without error -
我让 Eclipse 与 Tomcat 一起工作了几天,然后突然出现错误“无法加载 tomcat 服务器配置可能已损坏或不完整” - 对我来说修复是在 Windows > 首选项 > 服务器 > 运行时环境下删除 Tomcat - 然后重新 -添加相同的服务器,它再次开始工作,没有错误 -
回答by springhibernatetutes
Navigate to windows->Preferences->RuntimeEnvironments, it will show you existing tomcate configuration.Click on edit button and check whether tomcat installation directory is correct or not.If the tomcat installation directory is in wrong location you will get this kind of error.
导航到windows->Preferences->RuntimeEnvironments,它会显示你现有的tomcate配置。点击编辑按钮并检查tomcat安装目录是否正确。如果tomcat安装目录在错误的位置你会得到这种错误。
回答by Gab
Windows > preferences > server > runtime environments > add
Windows > 首选项 > 服务器 > 运行时环境 > 添加
Select your target server location
选择您的目标服务器位置
retry
重试
回答by michael zhang
I have solution it, just correct the user rights, as in Ubuntu command: sudo chown -R yourname:yourgroup /opt/apache-tomcat-7.0.55, then restart eclipse, will be ok.
我有解决方案,只需更正用户权限,如Ubuntu命令:sudo chown -R yourname:yourgroup /opt/apache-tomcat-7.0.55,然后重新启动eclipse,就可以了。
回答by Anand Maheshwari
Hiii.. I got the same issue in Windows 7 OS in Eclipse JUNO version. And found the solution from the google.
Hiii.. 我在 Eclipse JUNO 版本的 Windows 7 操作系统中遇到了同样的问题。并从谷歌找到了解决方案。
When you create a server first time it will done with normal steps. But for some reason we need to delete the server. Mostally we delete from Server tab in eclipse by right click on server and click on delete. At this time the server is deleted from server tab, but not permanently delete from workspace. Because of that when we re-create the server with same version we don't able to click on next button after selecting the server version.
当您第一次创建服务器时,它将按照正常步骤完成。但出于某种原因,我们需要删除服务器。大多数情况下,我们通过右键单击服务器并单击删除从 Eclipse 中的服务器选项卡中删除。此时服务器会从服务器选项卡中删除,但不会从工作区中永久删除。因此,当我们重新创建具有相同版本的服务器时,我们无法在选择服务器版本后单击下一步按钮。
So here is the complete guide with screen shot, How to solve this type of issue.
所以这里是完整的屏幕截图指南,如何解决此类问题。
http://codeofjava.blogspot.in/2014/08/solution-of-getting-error-when-re.html
http://codeofjava.blogspot.in/2014/08/solution-of-getting-error-when-re.html
回答by onlyme
i had the same issue in debian. the link bellow helped me http://crunchify.com/eclipse-how-to-fix-installing-apache-tomcat-server-issue-blank-server-name-field/
我在 debian 中遇到了同样的问题。下面的链接帮助了我 http://crunchify.com/eclipse-how-to-fix-installing-apache-tomcat-server-issue-blank-server-name-field/
Note: the default workspace-directory of eclipse on debian is /home/userNameFolder/workspace
注意:debian 上 eclipse 的默认工作区目录是 /home/userNameFolder/workspace