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

时间:2014-11-28 11:53:00

标签: java servlets netbeans tomcat7

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

现在我想在netbeans中创建一个WebApplication,所以我在netbeans中添加了tomcat7作为服务器并使用netbeans提供的默认模板创建了一个Hello world项目。现在,当我运行它时,我得到了错误。 我使用/ usr / share / tomcat7作为我的Catalina家和Catalina基地。 但是我也试过/ etc / tomcat7作为我的Catalina基地,但是它给出了像基本文件夹这样的错误应该是emplty或者只包含conf / tomcat-users.xml。

构建错误是:

  

尚未部署该模块。有关详细信息,请参阅服务器日志。

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

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

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

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

1 个答案:

答案 0 :(得分:1)

尝试创建一个指向tomcat日志文件夹的符号链接:

  

sudo ln -s / var / log / tomcat7

并更改其访问权限:

  

sudo chmod -Rf 777 / var / log / tomcat7

希望它可以提供帮助!