gpt4 book ai didi

java - 无法在 Netbeans 中运行 Web 应用程序

转载 作者:行者123 更新时间:2023-12-01 12:12:44 25 4
gpt4 key购买 nike

我在 Ubuntu 14.04 中使用 NetBeans 8.0.1,我有以下设置。我已经从 apt-get 安装了 tomcat7,并且能够通过手动创建 servlet 文件并将它们放在/webapps 文件夹中来运行简单的 servlet。

现在我想在netbeans中创建一个Web应用程序,因此我在netbeans中添加了tomcat7作为服务器,并使用netbeans提供的默认模板创建了一个Hello world项目。现在,当我运行该项目时,出现以下错误。我使用/usr/share/tomcat7 作为我的 Catalina 主目录和 Catalina 基地。但是我也尝试过/etc/tomcat7 作为我的 Catalina 基础,但随后它给出了错误,例如基础文件夹应该为空或仅包含 conf/tomcat-users.xml。

构建错误是:

The module has not been deployed. See the server log for details.

现在我检查了服务器日志,它是空的。我的服务器输出文件如下所示:

Nov 28, 2014 5:17:33 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Nov 28, 2014 5:17:33 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]

Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
Nov 28, 2014 5:17:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 705 ms
Nov 28, 2014 5:17:34 PM org.apache.catalina.users.MemoryUserDatabase open
SEVERE: The specified user database [/usr/share/tomcat7/conf/tomcat-users.xml] could not be found
Nov 28, 2014 5:17:34 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 28, 2014 5:17:34 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
Nov 28, 2014 5:17:34 PM org.apache.catalina.valves.AccessLogValve getLogFile
SEVERE: Failed to create directory [/usr/share/tomcat7/logs] for access logs
Nov 28, 2014 5:17:34 PM org.apache.catalina.valves.AccessLogValve getLogFile
SEVERE: Failed to create directory [/usr/share/tomcat7/logs] for access logs
Nov 28, 2014 5:17:34 PM org.apache.catalina.valves.AccessLogValve open
SEVERE: Failed to open access log file [/usr/share/tomcat7/logs/localhost_access_log.2014-11-28.txt]
java.io.FileNotFoundException: /usr/share/tomcat7/logs/localhost_access_log.2014-11-28.txt (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at org.apache.catalina.valves.AccessLogValve.open(AccessLogValve.java:1200)
at org.apache.catalina.valves.AccessLogValve.startInternal(AccessLogValve.java:1261)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:185)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1137)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.HostConfig start
SEVERE: Unable to create directory for deployment: /usr/share/tomcat7/webapps
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.HostConfig start
SEVERE: Unable to create directory for deployment: /usr/share/tomcat7/conf/Catalina/localhost
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.HostConfig start
SEVERE: Application base [/usr/share/tomcat7/webapps] for host [localhost] does not exist or is not a directory. deployOnStartUp and autoDeploy have been set to false to prevent deployment errors. Other errors may still occur.
Nov 28, 2014 5:17:34 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 28, 2014 5:17:34 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 67 ms

在创建服务器时我使用了以下内容:

任何人都可以帮助我开始使用这个吗?

最佳答案

尝试建立一个到 tomcat 日志文件夹的符号链接(symbolic link):

sudo ln -s /var/log/tomcat7

并更改其访问权限:

sudo chmod -Rf 777 /var/log/tomcat7

希望对大家有帮助!

关于java - 无法在 Netbeans 中运行 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com