热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

不能将任何东西放入/var/lib/tomcat7/webapps/?-Cannotputanythinginto/var/lib/tomcat7/webapps/

IwasstartingonJAVAwebdevelopmenttodayandencounteredsomeproblems,Iinstalledmytomcat7o

I was starting on JAVA web development today and encountered some problems, I installed my tomcat7 on my ubuntu machine. Now when I browse to //localhost:8080, I get the default welcome page saying:

我今天从JAVA web开发开始,遇到了一些问题,我在我的ubuntu机器上安装了tomcat7。现在,当我浏览到//localhost:8080时,我得到默认的欢迎页面:

This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat7/webapps/ROOT/index.html

这是默认的Tomcat主页。它可以在本地文件系统上找到:/var/lib/tomcat7/webapps/ROOT/index.html。

Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat7 and CATALINA_BASE in /var/lib/tomcat7, following the rules from /usr/share/doc/tomcat7-common/RUNNING.txt.gz.

Tomcat7的退役人员可能会很高兴地得知,这一系统实例是在/usr/share/tomcat7和CATALINA_BASE中与CATALINA_HOME一起安装的,这是在/usr/share/doc/tomcat7-common/RUNNING.txt.gz的规则下完成的。

But strangely when I try echo $CATALINA_HOME nothing shows up. Also I can not copy/create anything in the default /var/lib/tomcat7/ROOT though it's just a matter of providing few permissions but I was wondering whether it is the right way to do it?,

但奇怪的是,当我尝试echo $CATALINA_HOME时,什么也没有出现。另外,我不能复制/创建默认的/var/lib/tomcat7/ root中的任何东西,尽管这只是提供一些权限的问题,但是我想知道这是否是正确的方法?

What I would like to do is create a separate directory in my home where I can put my web application and tomcat can read hem from there. Is there a way to do it? In apache I can do it by changing the document-root and directory but I don't know how to do it for tomcat

我想做的是在我的家里创建一个单独的目录,我可以将我的web应用程序和tomcat从那里读取。有办法吗?在apache中,我可以通过更改文档根目录和目录来实现它,但是我不知道如何为tomcat执行它。

3 个解决方案

#1


10  

But strangely when I try echo $CATALINA_HOME nothing shows up.

但奇怪的是,当我尝试echo $CATALINA_HOME时,什么也没有出现。

This is because the packaged version sets CATALINA_HOME just prior to launching Tomcat, after reading it from a configuration file (typically somewhere in /etc).

这是因为在从一个配置文件(通常是在/etc)中读取它之前,打包的版本在启动Tomcat之前设置了CATALINA_HOME。

Also I can not copy/create anything in the default /var/lib/tomcat7/ROOT though it's just a matter of providing few permissions but I was wondering whether it is the right way to do it?

另外,我不能复制/创建默认的/var/lib/tomcat7/ root中的任何东西,尽管这只是提供一些权限的问题,但是我想知道这是否是正确的方法?

The permissions problem has to do with you not being root (or the Tomcat user). Most packaged Tomcat installations (deb or RPM) tend to install with a specific user in mind, and copying stuff in as a different sometimes won't work.

权限问题与您不作为根(或Tomcat用户)有关。大多数打包的Tomcat安装(deb或RPM)都倾向于将特定的用户放在脑海中,而将其复制到不同的地方有时是行不通的。

/usr/share/tomcat7 is your CATALINA_HOME directory, and it has links to the other directories, such as /var/lib/tomcat7/webapps, /etc/tomcat7, etc. You shouldn't copy directly into a web application, you should package the web application into a WAR file and "deploy" it. The advantages are numerous.

/usr/share/tomcat7是您的CATALINA_HOME目录,它与其他目录有链接,比如/var/lib/tomcat7/webapps、/etc/tomcat7等。您不应该直接复制到web应用程序中,您应该将web应用程序打包到WAR文件中并“部署”它。有很多的优势。

What I would like to do is create a separate directory in my home where I can put my web application and tomcat can read hem from there. Is there a way to do it?

我想做的是在我的家里创建一个单独的目录,我可以将我的web应用程序和tomcat从那里读取。有办法吗?

Yes, one is created when "deploying a web app". Look to the standard Tomcat7 documentation, and consider installing the "manager" web application if you like a non-command line interface. Now that you know what "installation" of a web app is called, it will likely be an easier task.

是的,一个是在“部署一个web应用程序”时创建的。看看标准的Tomcat7文档,如果您喜欢一个非命令行界面,可以考虑安装“manager”web应用程序。既然您已经知道了web应用程序的“安装”,那么它可能是一项更简单的任务。

In apache I can do it by changing the document-root and directory but I don't know how to do it for tomcat

在apache中,我可以通过更改文档根目录和目录来实现它,但是我不知道如何为tomcat执行它。

Tomcat has a different, slightly more restrictive set of requirements for a document-root. You need to learn it, and just come to terms with the idea that it's never going to be the same. Basically under the "webapps" directory, is a WAR file or a expanded directory that came from a WAR file. Editing in-place is not a good idea for Tomcat, as the CGI-equivalents are not read from disk each time they are ran, they are linked into the memory of Tomcat. This means that a change in the directory might not affect your web application, which is good enough reason to not bother changing the on-disk files for a deployed web application.

Tomcat对文档根有一个不同的、略微更严格的需求集。你需要学习它,并且接受它永远不会是一样的观点。基本上在“webapps”目录下,是WAR文件,或者是来自WAR文件的扩展目录。对Tomcat来说,对其进行编辑不是一个好主意,因为它们每次运行时都不会从磁盘上读取,它们会链接到Tomcat的内存中。这意味着目录中的更改可能不会影响您的web应用程序,这足以使您不必为已部署的web应用程序更改磁盘上的文件。

Modify the web application, repackage it, and update the deployment. It's really the "right" way to go with Tomcat.

修改web应用程序,重新打包它,并更新部署。这是与Tomcat一起使用的“正确”方法。

#2


5  

Give permission 777 to the webroot folder

向webroot文件夹授予权限777。

sudo chmod -R 777 Webroot

After moving to the tomcat folder

移动到tomcat文件夹后。

#3


0  

But strangely when I try echo $CATALINA_HOME nothing shows up.

但奇怪的是,当我尝试echo $CATALINA_HOME时,什么也没有出现。

If you installed tomcat7 by using this command

如果您使用此命令安装tomcat7。

sudo apt-get install tomcat7

/usr/share/tomcat7 is your CATALINA_HOME though, you need to add this as an environment variable in the /.bashrc file.

/usr/share/tomcat7是您的CATALINA_HOME,您需要将其添加为/中环境变量。bashrc文件。(

sudo vi ~/.bashrc

You can add this information to the end of the file:

您可以将此信息添加到文件的末尾:

export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/usr/share/tomcat7

Save and exit out of .bashrc. You can make the changes effective by restarting the bashrc file.

保存并退出.bashrc。您可以通过重新启动bashrc文件使更改生效。

. ~/.bashrc

Now, you would see the path when echo $CATALINA_HOME.

现在,你会看到echo $CATALINA_HOME的路径。

Reference

参考


推荐阅读
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文介绍了一些Java开发项目管理工具及其配置教程,包括团队协同工具worktil,版本管理工具GitLab,自动化构建工具Jenkins,项目管理工具Maven和Maven私服Nexus,以及Mybatis的安装和代码自动生成工具。提供了相关链接供读者参考。 ... [详细]
  • Day2列表、字典、集合操作详解
    本文详细介绍了列表、字典、集合的操作方法,包括定义列表、访问列表元素、字符串操作、字典操作、集合操作、文件操作、字符编码与转码等内容。内容详实,适合初学者参考。 ... [详细]
  • Android日历提醒软件开源项目分享及使用教程
    本文介绍了一款名为Android日历提醒软件的开源项目,作者分享了该项目的代码和使用教程,并提供了GitHub项目地址。文章详细介绍了该软件的主界面风格、日程信息的分类查看功能,以及添加日程提醒和查看详情的界面。同时,作者还提醒了读者在使用过程中可能遇到的Android6.0权限问题,并提供了解决方法。 ... [详细]
  • JVM 学习总结(三)——对象存活判定算法的两种实现
    本文介绍了垃圾收集器在回收堆内存前确定对象存活的两种算法:引用计数算法和可达性分析算法。引用计数算法通过计数器判定对象是否存活,虽然简单高效,但无法解决循环引用的问题;可达性分析算法通过判断对象是否可达来确定存活对象,是主流的Java虚拟机内存管理算法。 ... [详细]
  • 本文介绍了关于apache、phpmyadmin、mysql、php、emacs、path等知识点,以及如何搭建php环境。文章提供了详细的安装步骤和所需软件列表,希望能帮助读者解决与LAMP相关的技术问题。 ... [详细]
  • Android系统移植与调试之如何修改Android设备状态条上音量加减键在横竖屏切换的时候的显示于隐藏
    本文介绍了如何修改Android设备状态条上音量加减键在横竖屏切换时的显示与隐藏。通过修改系统文件system_bar.xml实现了该功能,并分享了解决思路和经验。 ... [详细]
  • 在project.properties添加#Projecttarget.targetandroid-19android.library.reference.1..Sliding ... [详细]
  • 本文介绍了在Windows环境下如何配置php+apache环境,包括下载php7和apache2.4、安装vc2015运行时环境、启动php7和apache2.4等步骤。希望对需要搭建php7环境的读者有一定的参考价值。摘要长度为169字。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 一句话解决高并发的核心原则
    本文介绍了解决高并发的核心原则,即将用户访问请求尽量往前推,避免访问CDN、静态服务器、动态服务器、数据库和存储,从而实现高性能、高并发、高可扩展的网站架构。同时提到了Google的成功案例,以及适用于千万级别PV站和亿级PV网站的架构层次。 ... [详细]
  • 本文详细介绍了git常用命令及其操作方法,包括查看、添加、提交、删除、找回等操作,以及如何重置修改文件、抛弃工作区修改、将工作文件提交到本地暂存区、从版本库中删除文件等。同时还介绍了如何从暂存区恢复到工作文件、恢复最近一次提交过的状态,以及如何合并多个操作等。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • 如何提高PHP编程技能及推荐高级教程
    本文介绍了如何提高PHP编程技能的方法,推荐了一些高级教程。学习任何一种编程语言都需要长期的坚持和不懈的努力,本文提醒读者要有足够的耐心和时间投入。通过实践操作学习,可以更好地理解和掌握PHP语言的特异性,特别是单引号和双引号的用法。同时,本文也指出了只走马观花看整体而不深入学习的学习方式无法真正掌握这门语言,建议读者要从整体来考虑局部,培养大局观。最后,本文提醒读者完成一个像模像样的网站需要付出更多的努力和实践。 ... [详细]
  • 本文介绍了使用Spark实现低配版高斯朴素贝叶斯模型的原因和原理。随着数据量的增大,单机上运行高斯朴素贝叶斯模型会变得很慢,因此考虑使用Spark来加速运行。然而,Spark的MLlib并没有实现高斯朴素贝叶斯模型,因此需要自己动手实现。文章还介绍了朴素贝叶斯的原理和公式,并对具有多个特征和类别的模型进行了讨论。最后,作者总结了实现低配版高斯朴素贝叶斯模型的步骤。 ... [详细]
author-avatar
欣欣2602916441
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有