我正在尝试从 Netbeans 8.1 运行 Tomcat 7,但在服务器控制台上得到以下输出。
java.util.logging.ErrorManager: 4: Unable to create [/usr/share/tomcat7/logs]
java.util.logging.ErrorManager: 4: Unable to create [/usr/share/tomcat7/logs]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
May 20, 2016 8:34:47 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:210)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
可能出了什么问题?
答案1
您必须已将 NetBeans 配置为使用系统 tomcat 实例,但该实例失败,因为 NetBeans 没有并且不应该具有写入权限/usr/share/...
(即,不要按照其他答案中所说的操作)。
而是将 NetBeans 配置为使用主目录中的 tomcat 实例,例如从其下载站点下载 zip 文件,解压它并让 NetBeans 在相应的服务器设置中找到它(假设您正在寻找 Java Web 服务器)。
答案2
您必须尝试chown -R /usr/share/tomcat7/logs
获取当前用户 ID(有权在 tomcat7 中创建日志目录。看来您用于启动 NetBeans 的用户 ID 没有该权限。