在 ubuntu 上使用 Eclipse IDE 创建 Tomcat 6 服务器

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

Tomcat 6 server creation using eclipse IDE on ubuntu

eclipseubuntutomcat6

提问by tsaid

I'm having a problem running tomcat 6 with eclipse 3 in ubuntu.

我在 ubuntu 中使用 eclipse 3 运行 tomcat 6 时遇到问题。

I installed tomcat 6 on my machine and when I tested it using http://localhost:8080, it worked fine.

我在我的机器上安装了 tomcat 6,当我使用 测试它时http://localhost:8080,它运行良好。

But whenever i want to create a server in eclipse, i select Tomcat 6 , i get the following message "Cannot create a server using the selected type", and i can't click next.

但是每当我想在 eclipse 中创建一个服务器时,我选择了 Tomcat 6,我收到以下消息 "Cannot create a server using the selected type",我无法单击下一步。

Any idea why?

知道为什么吗?

回答by tsaid

There's a better workaround so you can keep Ubuntu's Tomcat6 (taken from http://ubuntuforums.org/showthread.php?p=8541057, by DisDis)

有一个更好的解决方法,因此您可以保留 Ubuntu 的 Tomcat6(取自http://ubuntuforums.org/showthread.php?p=8541057,来自 DisDis)

In a terminal:

在终端中:

sudo apt-get install tomcat6
cd /usr/share/tomcat6
sudo ln -s /var/lib/tomcat6/conf conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat6 log
sudo chmod -R 777 /usr/share/tomcat6/conf

There. Now just go to Window/Preferences/Sever/Runtime Environments, add the Apache Tomcat6 Server and use /usr/share/tomcat6 as the installation directory!

那里。现在只需转到 Window/Preferences/Sever/Runtime Environments,添加 Apache Tomcat6 Server 并使用 /usr/share/tomcat6 作为安装目录!

回答by tsaid

ok, so here's what worked for me: you must go to Window>Preferences

好的,这对我有用:您必须转到“窗口”>“首选项”

here, go to Server>Runtime Environments

在这里,转到服务器>运行时环境

remove the old server or add your server or change the server location...

删除旧服务器或添加您的服务器或更改服务器位置...

(in my case, this problem arised when i changed the tomcat server location)

(在我的情况下,当我更改tomcat服务器位置时出现了这个问题)

now you should be able to add new servers to your environment :)

现在您应该能够将新服务器添加到您的环境中 :)

回答by Olaf Kock

Have you been using the ubuntu-tomcat version (e.g. "aptitude install tomcat6")? If so, please download a plain vanilla version from tomcat.apache.organd use this. The Debian/Ubuntu version relocates some jars around and eclipse expects the "pure" version and jar locations.

您是否使用过 ubuntu-tomcat 版本(例如“aptitude install tomcat6”)?如果是这样,请从tomcat.apache.org下载一个普通的 vanilla 版本并使用它。Debian/Ubuntu 版本在周围重新定位了一些 jar,而 eclipse 需要“纯”版本和 jar 位置。

(Also: see Eclipse bug 239179)

(另请参阅Eclipse 错误 239179

回答by Abhinav Upadhyay

I wrote a patch for solving this problem and it has been merged in Ubuntu and Debian. Now its possible to configure tomcat6 inside Eclipse without any pains.

我写了一个补丁来解决这个问题,它已被合并到 Ubuntu 和 Debian 中。现在可以毫不费力地在 Eclipse 中配置 tomcat6。

In Ubuntu 11.04 you can install tomcat6-user package. Then configure a user instance of tomcat6 by running this command

在 Ubuntu 11.04 中,您可以安装 tomcat6-user 包。然后通过运行这个命令配置一个 tomcat6 的用户实例

$tomcat6-instance-create ~/my-tomcat-dir

$tomcat6-instance-create ~/my-tomcat-dir

A user instance of tomcat6 will be configured in ~/my-tomcat-dir directory.

tomcat6 的用户实例将在 ~/my-tomcat-dir 目录中配置。

Now to add tomcat6 inside eclipse to setup your development environment, simply point eclipse towards this directory and you will be ready to go.

现在在 eclipse 中添加 tomcat6 来设置你的开发环境,只需将 eclipse 指向这个目录,你就可以开始了。

If you are running an older version of Ubuntu, then you can simply download the latest version of tomcat6-user package from the Debian FTP: http://packages.debian.org/hu/sid/all/tomcat6-user/download

如果您运行的是旧版本的 Ubuntu,那么您只需从 Debian FTP 下载最新版本的 tomcat6-user 软件包:http://packages.debian.org/hu/sid/all/tomcat6-user/download

回答by Abhinav Upadhyay

Remove (or edit the apache tomcat v6.0 entry in) workspace.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs

删除(或编辑 apache tomcat v6.0 条目)workspace.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jst.server.tomcat.core.prefs

I think you also need to restart

我想你也需要重新启动

回答by Abhinav Upadhyay

I had the same problem, but with tomcat 5.5. Changing the permissions on the /etc/tomcat5.5/conf (symlink from /usr/share/tomcat5.5/conf) worked. Thanks!

我遇到了同样的问题,但使用的是 tomcat 5.5。更改 /etc/tomcat5.5/conf (来自 /usr/share/tomcat5.5/conf 的符号链接)的权限有效。谢谢!

回答by buendiapdx

I had the same problem but thanks to all your feedback I got it fixed. In summary...

我遇到了同样的问题,但多亏了您的所有反馈,我才解决了这个问题。总之...

I have Ubuntu 9.04, Eclipse Galileo (java EE developers platform 3.5.1).

我有 Ubuntu 9.04、Eclipse Galileo(java EE 开发人员平台 3.5.1)。

I installed Tomcat as follows:

我安装Tomcat如下:

sudo tar zxvf apache-tomcat-6.0.20.tar.gz

须藤焦油 zxvf apache-tomcat-6.0.20.tar.gz

sudo cp -R apache-tomcat-6.0.20 /usr/share/tomcat6

须藤cp -R apache-tomcat-6.0.20 /usr/share/tomcat6

as explained at: http://www.ubuntugeek.com/tomcat-6-installation-on-ubuntu-feisty.html

如在解释:http: //www.ubuntugeek.com/tomcat-6-installation-on-ubuntu-feisty.html

Then I change permissions to the conf folder /usr/share/tomcat6/conf$ sudo chmod a+rw *

然后我将权限更改为 conf 文件夹 /usr/share/tomcat6/conf$ sudo chmod a+rw *

I removed it from Windows->Preferences->Server->Runtime Environment (but I don't think this step was necessary after all)

我从 Windows->Preferences->Server->Runtime Environment 中删除了它(但我认为这一步毕竟不是必需的)

Voila!

瞧!

回答by buendiapdx

I was suffering the same problem

我遇到了同样的问题

I've got the lattest eclipse 3.4.1 GanyMede. Changed the Ubuntu Tomcat 6 install to the plain one from tomcat.apache.org

我有最新的 eclipse 3.4.1 GanyMede。将 Ubuntu Tomcat 6 安装更改为来自 tomcat.apache.org 的普通安装

chmod 666 /usr/share/tomcat6/conf*

chmod 666 /usr/share/tomcat6/conf*

and the problem was solved

问题解决了

回答by Walker

Go to window > preferences -- Go to runtime environments --- you will probably find the location of the old install of Tomcat. Changing it to the current location will help.

转至窗口 > 首选项 -- 转至运行时环境 --- 您可能会找到旧版 Tomcat 安装的位置。将其更改为当前位置会有所帮助。

回答by Spidey

You have to symlink various folders that are scattered across the file system to the desired tomcat6 main (or installation) folder.

您必须将分散在文件系统中的各种文件夹符号链接到所需的 tomcat6 主(或安装)文件夹。

tsaid suggested symlinking to /usr/share/tomcat6, I rather use /var/lib/tomcat6.

tsaid 建议符号链接到 /usr/share/tomcat6,我宁愿使用 /var/lib/tomcat6。

My /var/lib/tomcat6 directory (see the symlinks I've made):

我的 /var/lib/tomcat6 目录(请参阅我制作的符号链接):

$ ls -g -o /var/lib/tomcat6
lrwxrwxrwx 1   22 2010-07-20 18:15 bin -> /usr/share/tomcat6/bin
drwxr-xr-x 3 4096 2010-07-20 12:22 common
lrwxrwxrwx 1   12 2010-07-20 12:22 conf -> /etc/tomcat6
lrwxrwxrwx 1   22 2010-07-20 18:14 lib -> /usr/share/tomcat6/lib
lrwxrwxrwx 1   17 2010-07-20 12:22 logs -> ../../log/tomcat6
drwxr-xr-x 3 4096 2010-07-20 12:22 server
drwxr-xr-x 3 4096 2010-07-20 12:22 shared
drwxrwxr-x 3 4096 2010-07-20 12:22 webapps
lrwxrwxrwx 1   19 2010-07-20 12:22 work -> ../../cache/tomcat6

Also, don't forget to give full rw permission to your configuration files, in my case in /etc/tomcat6. Since you'll also need to symlink catalina.policy from Catalina/localhost/catalina.policy, don't forget giving execute permission to those folders. You can simplify with full permission to the conf folder, but it's only advised if you're the only user of the computer.

另外,不要忘记为您的配置文件授予完全的 rw 权限,在我的例子中是在 /etc/tomcat6.conf 中。由于您还需要从 Catalina/localhost/catalina.policy 符号链接 catalina.policy,所以不要忘记为这些文件夹授予执行权限。您可以通过对 conf 文件夹的完全权限进行简化,但仅当您是计算机的唯一用户时才建议这样做。

cd /var/lib/tomcat6/conf
chmod -R a+xrw *

Now, delete the entry in Eclipse under Window -> Preferences -> Server -> Runtime Environment and add a new server through Run on Server or anywhere else.

现在,删除 Eclipse 中 Window -> Preferences -> Server -> Runtime Environment 下的条目,并通过 Run on Server 或其他任何地方添加新服务器。