Spring应用程序的Tomcat配置

发布于 2024-09-08 19:02:46 字数 1218 浏览 3 评论 0原文

我已经构建了在 Tomcat 中使用的 Web 应用程序。这取决于春天。我在尝试访问它时遇到以下异常:

java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

我阅读了tomcat文档,发现我需要配置安全性。我将以下几行添加到
“/usr/share/tomcat/conf/catalina.policy”:

grant codeBase "file:${catalina.home}/webapps/MyProject/-" {
    permission java.lang.RuntimePermission;
};

但这没有帮助。要补充的是,我通过粘贴以下命令安装了Tomcat:

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

我已重新启动服务器。该项目存在于指定位置。

我做错了什么?

我真的很想在服务器上修改尽可能少的东西,而不将额外的 jar 复制到服务器 lib 文件夹中。


我的

Tomcat 版本 = Apache Tomcat/6.0.20

Spring 版本 = 3.0.1.RELEASE


堆栈跟踪太大,无法在此处发布,因此请按照 链接即可查看。


有人可以帮助我吗?补充一下,它在我的 Apache Geronimo 上毫无异常地执行。

I have built web application for use in Tomcat. It depends on Spring. I have the following exception when trying to access it:

java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

I read tomcat docs, and found that I need to configure security. I added following lines to
"/usr/share/tomcat/conf/catalina.policy":

grant codeBase "file:${catalina.home}/webapps/MyProject/-" {
    permission java.lang.RuntimePermission;
};

But it didn't help. To add, I installed Tomcat by pasting following commands:

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

I have restarted server. The project exist in specified location.

What am I doing wrong?

I would really like to modify as few things on server as it is possible, without copying additional jars into servers lib folder.


My

Tomcat version = Apache Tomcat/6.0.20

Spring version = 3.0.1.RELEASE


The stack trace is too big to post it here, so please, follow link to see it.


Can anybody help me? To add, it is executed without exceptions on my Apache Geronimo.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一世旳自豪 2024-09-15 19:02:46

我不会使用这些符号链接。相反,我会部署在 $CATALINA_BASE/webapps(查看 /etc/init.d/tomcat6)。然后在策略文件(/etc/tomcat6/policy.d/03catalina.policy)中:

grant codeBase "file:${catalina.base}/webapps/MyProject/WEB-INF/lib/-" {
    permission java.lang.RuntimePermission "createClassLoader";
};

另一个选项可以编辑/etc/tomcat6/policy.d/04webapps.policy。

前一段时间这对我有用。

问候。

I wouldn't use those symbolic links. Instead I would deploy at $CATALINA_BASE/webapps (check out /etc/init.d/tomcat6). Then in the policy file (/etc/tomcat6/policy.d/03catalina.policy):

grant codeBase "file:${catalina.base}/webapps/MyProject/WEB-INF/lib/-" {
    permission java.lang.RuntimePermission "createClassLoader";
};

Another option can be editing /etc/tomcat6/policy.d/04webapps.policy.

That worked for me some time ago.

Regards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文