eclipse 无法将服务器添加到移动的工作区

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/93900/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:23:47  来源:igfitidea点击:

Can't add server to a moved workspace

eclipsetomcatjakarta-eeworkspace

提问by Tomasz

I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace.

我从网上下载了这个工作区,并尝试从全新安装的 Eclipse Ganymede 在 tomcat 服务器上运行它。这个特定的项目带有自己的工作区。

When I select Tomcat v6.0 I get a message

当我选择 Tomcat v6.0 时,我收到一条消息

Cannot create a server using the selected type

无法使用所选类型创建服务器

Older tomcat versions are available, though.

不过,旧版的 tomcat 版本是可用的。

I guess I have to recreate some configuration setting. The question is which one? This seems to be some odd error as creating a new dynamic web project lets me configure tomcat for both of them

我想我必须重新创建一些配置设置。问题是哪一个?这似乎是一些奇怪的错误,因为创建一个新的动态 Web 项目让我为它们配置了 tomcat

回答by

I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.

我有一个类似的问题,但我的解决方案更简单一些。该问题是由重命名服务器定义引用的原始文件夹引起的。

Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomcat version, click next and you'll see the incorrect path reference. Fix it. Move on.

转到 Window/Preferences/Server/Runtime Environments,删除损坏的引用。然后,单击“添加”以创建新引用,选择合适的 tomcat 版本,单击下一步,您将看到不正确的路径引用。修理它。继续前行。

回答by Tomasz

I had this same problem on Ubuntu 8.10 with Ganymede and Tomcat6. This appears to be some sort of bug with Eclipse. If you try and create a server, and it barfs, you can't create another tomcat6 server. To correct this problem, do the following:

我在使用 Ganymede 和 Tomcat6 的 Ubuntu 8.10 上遇到了同样的问题。这似乎是 Eclipse 的某种错误。如果您尝试创建一个服务器,但它会阻塞,您将无法创建另一个 tomcat6 服务器。要更正此问题,请执行以下操作:

  • close eclipse
  • go to the {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings directory and remove a file called org.eclipse.wst.server.core.prefs.
  • start eclipse
  • add your tomcat6 server in the server tab
  • 日食
  • 转到 {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings 目录并删除名为 org.eclipse.wst.server.core.prefs 的文件。
  • 开始日食
  • 在服务器选项卡中添加您的 tomcat6 服务器

kotfu

kotfu

回答by Tomasz

@id thanks for the solution but something is also hidden in org.eclipse.jst.server.tomcat.core.prefs

@id 感谢您的解决方案,但有些东西也隐藏在 org.eclipse.jst.server.tomcat.core.prefs 中

So in order to solve the problem

所以为了解决问题

  • close eclipse
  • go to {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
  • remove the files org.eclipse.wst.server.core.prefs and org.eclipse.jst.server.tomcat.core.prefs
  • 日食
  • 转到 {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
  • 删除文件 org.eclipse.wst.server.core.prefs 和org.eclipse.jst.server.tomcat.core.prefs

Tomcat 5.5

雄猫 5.5

I order to be able to use the tomcat5.5 server you need to have a writeable catalina.policy file as mentioned in

我为了能够使用 tomcat5.5 服务器,你需要有一个可写的 catalina.policy 文件,如中所述

Tomcat 6

雄猫6

In order to be able to use the tomcat6 server the proper solution is to have a user instance of the tomcat6 server as described in

为了能够使用 tomcat6 服务器,正确的解决方案是拥有一个 tomcat6 服务器的用户实例,如中所述

  • /usr/share/doc/tomcat6-common/RUNNING.txt.gz
  • RUNNING.txt(on the WEB)
  • /usr/share/doc/tomcat6-common/RUNNING.txt.gz
  • RUNNING.txt(在网络上)

My configuration is Debian/Sid, Eclipse 3.4.1. Ganymede

我的配置是 Debian/Sid,Eclipse 3.4.1。木卫三

回答by Tomasz

i finally got mine to work with the default Ubuntu 8.10 tomcat. (the debug command-line on eclipse is a wonderful thing) First i had to make a couple of symbolic links and then change the permissions to a file. (you might want to think twice about changing the permissions depending on your configuration, but if eclipse can't read the file it throws and exception and the gui won't let you continue)

我终于可以使用默认的 Ubuntu 8.10 tomcat 了。(eclipse 上的调试命令行是一件很棒的事情)首先我必须创建几个符号链接,然后更改文件的权限。(您可能需要考虑根据您的配置更改权限,但如果 eclipse 无法读取它抛出的文件和异常,并且 gui 不会让您继续)

sudo ln -s /etc/tomcat6 /usr/share/tomcat6/conf
sudo ln -s  /etc/tomcat6/policy.d/03catalina.policy /usr/share/tomcat6/conf/catalina.policy
sudo chmod a+r /usr/share/tomcat6/conf/tomcat-users.xml

回答by Jim Kiley

The error view really is key. There is a lot of detail in there -- if necessary, right-click on the entries and copy their contents into your favorite text editor. One problem that can come up, for instance, is that if you have a server configuration already in place, and one of the configuration XML files is unparseable, the server can't be added. This happened to me this evening -- my <Context>element had a linebreak in it, so it was <C(linebreak)ontext>. This prevented Eclipse from recreating the server configuration.

错误视图确实是关键。那里有很多细节——如有必要,右键单击条目并将其内容复制到您喜欢的文本编辑器中。例如,可能出现的一个问题是,如果您已经有一个服务器配置,并且其中一个配置 XML 文件无法解析,则无法添加服务器。这发生在我今晚 - 我的<Context>元素中有一个换行符,所以它是<C(linebreak) ontext>。这阻止了 Eclipse 重新创建服务器配置。

回答by Jim Kiley

The only way I found to use the Tomcat 6 is changing the ownership of the Tomcat directory to my user. It seems that is not enough to have r/w permissions.

我发现使用 Tomcat 6 的唯一方法是将 Tomcat 目录的所有权更改为我的用户。拥有 r/w 权限似乎还不够。

BTW, removing org.eclipse.wst.server.core.prefs erases you workspace configuration.

顺便说一句,删除 org.eclipse.wst.server.core.prefs 会删除您的工作区配置。

回答by MatthieuGD

Hum it can tricky. Bring the "server" view. If your project has already been deployed, remove it from the server to clean the binding between your project and the server.

嗯,这可能很棘手。带上“服务器”视图。如果您的项目已经部署,请将其从服务器中删除以清除您的项目和服务器之间的绑定。

Or you can right-click on your project in the project explorer and choose debug on the server. If you don't done it already, Eclipse should ask you to create a server runtime and here you can specify Tomcat 6 and specify the location of your server installation.

或者您可以在项目资源管理器中右键单击您的项目并选择在服务器上调试。如果您还没有这样做,Eclipse 应该会要求您创建一个服务器运行时,您可以在此处指定 Tomcat 6 并指定您的服务器安装位置。

You can also see the "problems" view to see any problm in the project imported like the JDK etc...

您还可以查看“问题”视图以查看导入的项目中的任何问题,如 JDK 等...

回答by MatthieuGD

Look in the error view. If you tried to set one up once and failed, Eclipse seems to try and look there again later just before allowing you to create a new one. If you've deleted the folder or its not there any more, you need to replace it so that you can proceed.

在错误视图中查看。如果您尝试设置一次但失败了,那么 Eclipse 似乎会在稍后允许您创建新的之前再次尝试并查看那里。如果您已删除该文件夹或不再存在该文件夹,则需要替换它以便您可以继续。

回答by Mantas

I had had same problem until I went to tomcat6 configuration directory and added ownership to my user in addition to root:

我遇到了同样的问题,直到我进入 tomcat6 配置目录并为我的用户添加了除 root 之外的所有权:

cd /usr/share/tomcat6/conf

chown root:myusername ./*

chmod 777 ./*

cd /usr/share/tomcat6/conf

chown 根:我的用户名 ./*

chmod 777 ./*

You can choose some better chmod for security, 777 is just a quick brutal fix. I have Eclipse 3.5 (Galileo) + Fedora 12 + Tomcat 6 extracted from tar(which is why Eclipse could not access it). Eclipse had been complaining "Cannot create a server using the selected type".

你可以选择一些更好的 chmod 来保证安全,777 只是一个快速的野蛮修复。我有从 tar 中提取的 Eclipse 3.5 (Galileo) + Fedora 12 + Tomcat 6(这就是 Eclipse 无法访问它的原因)。Eclipse 一直在抱怨“无法使用所选类型创建服务器”。

回答by Raymond Chenon

This Question is maybe old. But I just ran into this problem. My project was not recognized as a web project (no globe icon in Eclipse ).

这个问题可能是旧的。但我刚刚遇到了这个问题。我的项目未被识别为 Web 项目(Eclipse 中没有地球图标)。

Suppose you use maven plugin , it failed to convert to web project with command

假设您使用 maven 插件,它无法使用命令转换为 web 项目

mvn eclipse:eclipse -Dwtpversion=1.5

In package Explorer, right-click on the project / configure / Convert to Java Facets project/ Dynamic Web project in Eclipse Et Voilà

在包资源管理器中,右键单击 Eclipse 中的项目/配置/转换为 Java Facets 项目/动态 Web 项目 Et Voilà

Check the .project file at the root before and after the convert. You will see new natures.

在转换之前和之后检查根目录下的 .project 文件。你会看到新的性质。

<natures>
    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>