【发布时间】:2016-01-28 06:24:52
【问题描述】:
附录:我已经设法让我的 Clojure 应用程序在本地安装的 Tomcat 8.0.28 上运行,所以我真的不知道发生了什么。它涉及将我的数据库连接的 IP 绑定到主机名(以便在部署时它将使用某种 sym-link)和一堆其他修复,例如基于上下文的路由,所以我真的不知道为什么我不能尽管可以直接访问它,但不能让这个东西在另一台机器上的 Tomcat 安装上运行......
我正在使用我命名为
emt-admin 的 Ring 和 Compojure(结合 YESQL 和 Friend)在 Clojure 中构建一个相对基本的 CRUD 应用程序,到目前为止,我的代码的构建方式是使用 lein ring server-headless 对其进行测试导致基本没有问题。然而,在使用lein ring uberwar 写成in this website 之后,我发现在导航到/webapps/emt-admin/ 中指示的路径后,这将类似于http://<address>:8080/emt-admin(因为我的Tomcat 安装在与我的开发机器分开的服务器上运行)我得到一个空白页并自动定向到http://<address>:8080/login。
我想确认一下,在Tomcat安装部署WAR文件时,应该只有WEB-INF和META-INF这两个文件夹吧?我所有的静态资源都在 WEB-INF 文件夹的子目录中,我不知道是否正在提供我的静态文件,因为当我导航到我部署的网络应用程序时,我得到一个空白页面。
who made this 的人在 StackOverflow 上提出了一个关于它的问题,对他的代码进行了一些修改,以使应用程序更加“上下文友好”,但我并不完全理解他的 diff 更改。
编辑:我一直在尝试自己解决这个问题,并且一直在调查我的 Tomcat 安装日志:
29-Oct-2015 11:47:15.145 INFO [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/apache-tomcat-8.0.15/webapps/emt-admin.war
29-Oct-2015 11:49:31.133 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.startInternal Error listenerStart
29-Oct-2015 11:49:31.145 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.startInternal Context [/emt-admin] startup failed due to previous errors
29-Oct-2015 11:49:31.147 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [emt-admin] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
29-Oct-2015 11:49:31.148 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [emt-admin] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
29-Oct-2015 11:49:31.150 INFO [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /opt/apache-tomcat-8.0.15/webapps/emt-admin.war has finished in 136,005 ms
“Error listenerStart”背后的含义是什么?
我的核心处理程序如下所示:
(ns reporter.core
(:require [reporter.views.start :as start]
[reporter.routes.home :as home]
[compojure.core :as compojure :refer (GET defroutes)]
[taoensso.timbre :as timbre]
ring.adapter.jetty)
(:gen-class))
(def site-appli (compojure/routes
home/secured-appli))
(defn run
[]
(defonce privserver
(ring.adapter.jetty/run-jetty #'site-appli {:port 3000 :join? false})))
过了一会儿它就死了:
29-Oct-2015 11:53:35.767 SEVERE [http-nio-8080-exec-18] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
java.lang.OutOfMemoryError: PermGen space
进一步检查日志给了我我认为的罪魁祸首:
29-Oct-2015 11:49:31.133 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class reporter.listener
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
我将看看如果我修复我的数据库连接规范会发生什么
【问题讨论】:
标签: java tomcat clojure war compojure