问题描述
我想在Tomcat容器中部署三个Grails Web应用程序。我正在使用Grails 1.3.7和Tomcat 7.0.23。我想把所有的commons jar放在tomcat / shared / lib目录下。为什么?我想拥有较小的war文件并减少PermGen所需的内存量。
我在 conf / catalina.properites中配置下一行
shared.loader = $ {catalina.base} / shared / lib,$ {catalina.base} / shared / lib / *。jar
$对于所有这三个应用程序,我都执行
grails war $ b
$ b
我将WEB-INF / lib下的所有* .jar复制到$ CATALINA_HOME / shared / lib
后来我为每个应用程序生成没有jar的war文件
grails war - -nojars
我把所有三个战争放在tomcat / webapps目录下。对于每个应用程序, conf / DataSource.groovy 中的生产数据源如下所示。
应用程序A)
生产{
dataSource {
dbCreate =update
username =userA
password =password
url =jdbc:mysql:// localhost:3306 / applicationA
driverClassName =org.gjt.mm.mysql.Driver
}
}
应用程式B)
production {
dataSource {
dbCreate =update
username =userB
password =password
url =jdbc:mysql:// localhost:3306 / applicationB
driverClassName =org.gjt.mm.mysql.Driver
}
}
应用程式C)
制作{
dataSource {
dbCreate =update
username =u serC
password =password
url =jdbc:mysql:// localhost:3306 / applicationC
driverClassName =org.gjt.mm.mysql.Driver
}
}
当我启动Tomcat时,日志如下所示:
2011年12月11日下午11:28:15 org.apache.catalina.core.AprLifecycleListener init
信息:基于APR在java.library.path上找不到在生产环境中实现最佳性能的Apache Tomcat Native库:。 2011年12月11日11:28:15 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告:[SetPropertiesRule] {Server / Service / Engine / Host / Context}将属性'debug'设置为'0 '没有找到匹配的财产。
2011年12月11日11:28:15 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告:[SetPropertiesRule] {Server / Service / Engine / Host / Context}设置属性'debug '到'0'没有找到匹配的属性。
2011年12月11日11:28:15 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告:[SetPropertiesRule] {Server / Service / Engine / Host / Context}设置属性'debug '到'0'没有找到匹配的属性。
2011年12月11日下午11:28:15 org.apache.coyote.AbstractProtocol init
INFO:初始化ProtocolHandler [http-bio-8080]
2011年12月11日上午11:28 :15 PM org.apache.coyote.AbstractProtocol init
INFO:初始化ProtocolHandler [ajp-bio-8009]
2011年12月11日下午11时28分15秒org.apache.catalina.startup。 Catalina加载
INFO:在652 ms中处理初始化
2011年12月11日下午11:28:15 org.apache.catalina.core.StandardService startInternal
INFO:启动服务Catalina
2011年12月11日下午11时28分15秒org.apache.catalina.core.StandardEngine startInternal
INFO:启动Servlet引擎:Apache Tomcat / 7.0.23
Dec 11,2011 11:28:16 PM org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:22 PM org.apache.catalina.startup.HostConfig deployWAR
INFO:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war
2011年12月11日下午11:28:22 org.apache。 catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
2011年12月11日下午11:28:23 org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序归档/Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war
2011年12月11日下午11:28:23 org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根目录WebApplicationContext
2011年12月11日上午11时28分24秒org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationC- 0.1war
2011-12-11 11:28:24 org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:25 PM org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/docs
2011年12月11日下午11时28分25秒组织。 apache.catalina.startup.HostConfig deployDire ctory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/examples
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule body
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core_rt已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core已经定义
2011年12月11日下午11时28分25秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/core已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/fmt_rt已经定义
2011年12月11日下午11时28分25秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/fmt已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/fmt已经定义
2011-12-11 11:28:25 org.apache.catalina.startup.TaglibUriRule body
INFO: TLD跳过。 URI:http://java.sun.com/jsp/jstl/functions已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/permittedTaglibs已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/scriptfree已经定义
2011年12月11日下午11时28分25秒org.apache.catalina.startup.TaglibUriRule正文
信息: TLD跳过。 URI:http://java.sun.com/jstl/sql_rt已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/sql已经定义
2011年12月11日下午11时28分25秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/sql已经被定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/xml_rt已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/xml已经定义
2011年12月11日下午11:28:25 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/xml已经定义
2011年12月11日下午11:28:25 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener:contextInitialized()
2011年12月11日下午11时28分25秒org.apache.catalina.core.ApplicationContext日志
INFO:SessionListener:contextInitialized()
2011年12月11日11: 28:25 PM org.apache.catalina.core.ApplicationContext log
INFO:ContextListener:attributeAdded('org.apache.jasper.compiler.TldLocationsCache','org.apache.jasper.compiler.TldLocationsCache@5f24aa56')
2011年12月11日上午11时28分25秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/host-manager
2011年12月11日上午11:28:25 org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/manager
Dec 11,2011 11:28:25 PM org.apache.catalina.core.ApplicationContext log
I NFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:26 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23 /webapps/ApplicationB-0.1war
2011年12月11日11:28:26 org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
2011年12月11日11 :28:26 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war
2011年12月11日11:28:26 PM org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:27 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war
2011年12月11日下午11:28:27 org.apache.catalina.core.ApplicationContext日志
INFO:初始化Spring根目录W ebApplicationContext
Dec 11,2011 11:28:27 PM org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/docs
2011年12月11日11:28:28 org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/examples
2011年12月11日下午11时28分28秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core_rt已经被定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core已经被定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/core已经被定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/fmt_rt已经被定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/fmt已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/fmt已经定义
2011年12月11日下午11时28分28秒org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jsp/jstl/functions已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/permittedTaglibs已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/scriptfree已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/sql_rt已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/sql已经被定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/sql已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/xml_rt已经定义
2011年12月11日下午11:28:28 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/xml已经定义
2011年12月11日下午11时28分28秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/xml已经定义
2011年12月11日下午11时28分28秒org.apache.catalina.core.ApplicationContext日志
INFO: ContextListener:contextInitialized()
2011年12月11日上午11时28分28秒org.apache.catalina.core.ApplicationContext日志
INFO:SessionListener:contextInitialized()
2011年12月11日11: 28:28 PM org.apache.catalina.core.ApplicationContext log
INFO:ContextListener:attributeAdded('org.apache.jasper.compiler.TldLocationsCache','org.apache.jasper.compiler.TldLocationsCache@55e610e3')
2011年12月11日上午11:28:28 org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/host-manager
2011年12月11日下午11时28分28秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/manager
Dec 11,2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log
I NFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:28 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23 /webapps/ApplicationB-0.1war
2011年12月11日11:28:28 org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
2011年12月11日11 :28:29 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war
2011年12月11日11:28:29 PM org.apache.catalina.core.ApplicationContext log
INFO:初始化Spring根WebApplicationContext
Dec 11,2011 11:28:29 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war
2011年12月11日下午11时28分29秒org.apache.catalina.core.ApplicationContext日志
INFO:初始化Spring根目录W ebApplicationContext
2011年12月11日上午11时28分30秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/docs
2011年12月11日11:28:30 org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/examples
2011年12月11日下午11时28分30秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core_rt已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core已经定义
2011年12月11日下午11时28分30秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/core已经定义
2011年12月11日11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/fmt_rt已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/fmt已经定义
2011年12月11日下午11时28分30秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/fmt已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jsp/jstl/functions已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/permittedTaglibs已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/scriptfree已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/sql_rt已经定义
2011年12月11日11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/sql已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/sql已经定义
2011年12月11日下午11时28分30秒org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/xml_rt已经被定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/xml已经定义
2011年12月11日下午11:28:30 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/xml已经被定义
2011年12月11日下午11:28:30 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener:contextInitialized()
2011年12月11日11:28:30 org.apache.catalina.core.ApplicationContext log
INFO:SessionListener:contextInitialized()
2011年12月11日11: 28:30 PM org.apache.catalina.core.ApplicationContext log
INFO:ContextListener:attributeAdded('org.apache.jasper.compiler.TldLocationsCache','org.apache.jasper.compiler.TldLocationsCache@75ea2543')
2011年12月11日11:28:30 org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/host-manager
2011年12月11日上午11时28分30秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/manager
Dec 11,2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployWAR
信息:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war
2011年12月11日下午11:28:31 org.apache.catalina.startup.HostConfig deployWAR
INFO:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war
2011年12月11日下午11:28:31 org.apache.catalina.startup.HostConfig deployWAR
INFO:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war
2011年12月11日下午11:28:32 org.apache.catalina.startup.HostConfig deployDirectory
INFO:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/docs
2011年12月11日下午11:28:32 org.apache.catalina.startup.HostConfig deployDirectory
INFO:部署web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/examples
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO :跳过TLD。 URI:http://java.sun.com/jstl/core_rt已经被定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/core已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/core已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/fmt_rt已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/fmt已经定义
2011年12月11日下午11时28分33秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/fmt已经定义
2011-12-11 11:28:33 org.apache.catalina.startup.TaglibUriRule body
INFO: TLD跳过。 URI:http://java.sun.com/jsp/jstl/functions已经定义
2011年12月11日下午11时28分33秒org.apache.catalina.startup.TaglibUriRule正文
信息: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/permittedTaglibs已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://jakarta.apache.org/taglibs/standard/scriptfree已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/sql_rt已经定义
2011年12月11日下午11时28分33秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/sql已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/sql已经定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO: TLD跳过。 URI:http://java.sun.com/jstl/xml_rt已经定义
2011年12月11日下午11时28分33秒org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jstl/xml已经被定义
2011年12月11日下午11:28:33 org.apache.catalina.startup.TaglibUriRule正文
INFO:TLD跳过。 URI:http://java.sun.com/jsp/jstl/xml已经定义
2011年12月11日下午11时28分33秒org.apache.catalina.startup.HostConfig deployDirectory
INFO:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/host-manager
2011年12月11日下午11时28分33秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署Web应用程序目录/Applications/apache-tomcat-7.0.23/webapps/manager
2011年12月11日下午11时28分33秒org.apache.catalina.startup.HostConfig deployDirectory
信息:部署网站应用程序目录/Applications/apache-tomcat-7.0.23/webapps/ROOT
2011年12月11日下午11:28:34 org.apache.coyote.AbstractProtocol start
INFO:Starting ProtocolHandler [http- bio-8080]
2011年12月11日下午11时28分34秒org.apache.coyote.AbstractProtocol start
INFO:启动ProtocolHandler [ajp-bio-8009]
Dec 11 ,2011 11:28:34 PM org.apache.catalina.startup.Catalina start
INFO:19073年服务器启动ms
应用程序启动,我可以与他们联系。 然而,具有工作数据源连接的唯一应用程序是加载的最后一个上下文。
INFO:部署Web应用程序存档/Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war
2011年12月11日下午11:28:29 org.apache.catalina.core.ApplicationContext log
INFO :初始化Spring根WebApplicationContext
我能做些什么来解决这个问题?
解决方案1.3.7
在grais war命令中生成的一些jar不能在每个应用程序之间共享。
无法共享的jar包应位于webapps / appA / WEB-INF / lib中
grails-bootstrap-1.3.7.jar
grails-gorm-1.3.7.jar
grails-web-1.3.7.jar
grails-core-1.3.7.jar
grails-resources-1.3.7.jar
spring-security-core-3.0.5.RELEASE.jar
grails-crud- 1.3.7.jar
grails-spring-1.3.7.jar
Jars可以共享,可以在tomcat / shared / lib中使用
antlr-2.7.6.jar
aopalliance-1.0.jar
asm-3.3.1.jar
asm-analysis-3.3.1.jar
asm-tree-3.3.1.jar
asm -util-3.3.1.jar
aspectjrt-1.6.8.jar
aspectjweaver-1.6.8.jar
c3p0-0.9.1.2.jar
cglib-nodep-2.1 _3.jar
commons-beanut ils-1.8.0.jar
commons-codec-1.4.jar
commons-collections-3.2.1.jar
commons-dbcp-1.3.jar
commons-el- 1.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-lang3-3.0.1。 jar
commons-pool-1.5.5.jar
commons-validator-1.3.1.jar
concurrentlinkedhashmap-lru-1.0_jdk5.jar
dom4j-1.6.1.jar
ehcache-core-1.7.1.jar
ejb3-persistence-1.0.2.GA.jar
groovy-all-1.7.8.jar
hibernate-annotations-3.4 .0.GA.jar
hibernate-commons-annotations-3.1.0.GA.jar
hibernate-core-3.3.1.GA.jar
hibernate-ehcache-3.3.1。 GA.jar
hibernate-validator-3.1.0.GA.jar
hsqldb-1.8.0 .10.jar
javassist-3.11.0.GA.jar
jcl-over-slf4j-1.5.8.jar
jsoup-1.6.1.jar
jstl-1.1 .jar
jta-1.1.jar
jul-to-slf4j-1.5.8.jar
log4j-1.2.16.jar
mysql-connector-java-5.1 .jar
org.springframework.aop-3.0.5.RELEASE.jar
org.springframework.asm-3.0.5.RELEASE.jar
org.springframework.aspects-3.0。 5.RELEASE.jar
org.springframework.beans-3.0.5.RELEASE.jar
org.springframework.context-3.0.5.RELEASE.jar
org.springframework.context.support -3.0.5.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework。 instrument-3.0.5.RELEASE.jar
org.springframework.jdbc-3.0.5.RELEASE.jar
org.springframework.jms-3.0.5.RELEASE.jar
org.springframework .orm-3.0.5.RELEASE.jar
org.springframework.oxm-3.0.5.RELEASE.jar
org.springframework.transaction-3.0.5.RELEASE.jar
org。 springframew ork.web-3.0.5.RELEASE.jar
org.springframework.web.servlet-3.0.5.RELEASE.jar
oro-2.0.8.jar
parboiled-core-1.0 .2.jar
parboiled-java-1.0.2.jar
pegdown-1.1.0.jar
remark-0.9.3.jar
sitemesh-2.4.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar
standard-1.1.2.jar
xmlbeans-2.3.0.jar
xpp3_min-1.1.3.4.O.jar
解决方案2.0.0
在grais war命令中生成的一些jar无法在每个应用程序之间共享。
无法共享的jar包应位于webapps / appA / WEB-INF / lib中
$ bgrails-bootstrap-2.0.0.jar
grails-core-2.0.0.jar
grails-crud-2.0.0.jar
grails-datastore-core-1.0.0.RELEASE.jar
grails-datastore-gorm-1.0.0.RELEASE.jar
grails-datastore-simple-1.0.0.RELEASE.jar
grails-hibernate-2.0.0.jar
grails-logging-2.0.0.jar
grails-plugin-codecs-2.0.0.jar
grails-plugin-controllers -2.0.0.jar
grails-plugin-converters-2.0.0.jar
grails-plugin-datasource-2.0.0.jar
grails-plugin-domain-class-2.0。 0.jar
grails-plugin-filters-2.0.0.jar
grails-plugin-gsp-2.0.0.jar
grails-plugin-i18n-2.0.0.jar
grails-plugin-log4j-2.0.0.jar
grails-plugin-mimetypes-2.0.0.jar
grails-plugin-scaffolding-2.0.0.jar
grails-plugin -services-2.0.0.jar
grails-plugin-servlets-2.0.0.jar
grails-plugin-url-mappings-2.0.0.jar
grails-plugin-validation- 2.0.0.jar
圣杯s-resources-2.0.0.jar
grails-spring-2.0.0.jar
grails-web-2.0.0.jar
可以共享的jar包,可以在tomcat / shared / lib中使用
antlr-2.7.6.jar
aopalliance-1.0.jar
asm-3.1.jar
asm-3.3.1.jar
asm -analysis-3.3.1.jar
asm-tree-3.3.1.jar
asm-util-3.3.1.jar
aspectjrt-1.6.10.jar
aspectjweaver -1.6.10.jar
cglib-2.2.jar
commons-beanutils-1.8.3.jar
commons-codec-1.5.jar
commons-collections-3.2.1 .jar
commons-dbcp-1.4.jar
commons-el-1.0.jar
commons-fileupload-1.2.2.jar
commons-io-2.1.jar
commons-lang-2.6.jar
commons-lang3-3.0.1.jar
commons-logging-1.1.1.jar
commons-pool-1.5.6.jar
commons-validator-1.3.1.jar
concurrentlinkedhashmap-lru-1.2_jdk5.jar
dom4j-1.6.1.jar
ecj-3.6.2.jar
ehcache -core-2.4.6.jar
fontbox-1.6.0.jar
h2-1.2.147.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.7.Final.jar
hibernate-ehcache-3.6.7.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.1.0.Final.jar
javassist-3.12.0.GA.jar
jcl-over-slf4j-1.6.2.jar
jsoup-1.6.1 .jar
jstl-1.1.2.jar
jta-1.1.jar
jul-to-slf4j-1.6.2.jar
log4j-1.2.16.jar
mysql-connector-java-5.1.18-bin.jar
oro-2.0.8.jar
parboiled-core-1.0.2.jar
parboiled-java-1.0.2 .jar
pdfbox-1.6.0.jar
pegdown-1.1.0.jar
poi-3.7-20101029.jar
poi-ooxml-3.7-20101029.jar
poi-ooxml-schemas-3.7-20101029.jar
remark-0.9.3.jar
sitemesh-2.4.jar
slf4j-api-1.6.2.jar
spring-aop-3.1.0.RELEASE.jar
spring-asm-3.1.0.RELEASE.jar
spring-aspects-3.1.0.RELEASE.jar
spring-beans-3.1 .0.RELEASE.jar
spring-context-3.1.0.RELEASE.jar
spring-context-support-3.1.0.RELEASE.jar
spring-core-3.1.0。 RELEASE.jar
spring-expression-3.1.0.RELEASE.jar
spring-jdbc-3.1.0.RELEASE.jar
s pring-jms-3.1.0.RELEASE.jar
spring-orm-3.1.0.RELEASE.jar
spring-security-core-3.0.7.RELEASE.jar
spring-security -web-3.0.7.RELEASE.jar
spring-tx-3.1.0.RELEASE.jar
spring-web-3.1.0.RELEASE.jar
spring-webmvc-3.1。 0.RELEASE.jar
validation-api-1.0.0.GA.jar
xmlbeans-2.3.0.jar
xpp3_min-1.1.4c.jar
$ c不幸的是,这在Grails中不起作用,并且还有一些问题比数据源更多。我们着眼于解决这个问题,但仍然存在问题,所以直到2.0.x版本才能使用。
问题是核心Grails中的静态变量罐子。由于这些jar中的类是由共享类加载器加载的,因此静态在Tomcat中共享。只要这些罐子在每个战争文件中,它们都是由特定于战争的类加载器加载的,并且静态变量之间没有冲突。所以在解决这个问题之前,你需要部署完整的战争,或者至少将grails - *。jar文件保存在战争中。
I want to deploy three Grails web applications in a Tomcat container. I am using Grails 1.3.7 and Tomcat 7.0.23. I want to put all commons jars in a tomcat/shared/lib directory. Why? I want to have smaller war files and reduce the amount of memory required in PermGen.
I configure the next line in conf/catalina.properites
shared.loader=${catalina.base}/shared/lib,${catalina.base}/shared/lib/*.jar
For all three applications, I execute
grails war
I copy all the *.jars under WEB-INF/lib into $CATALINA_HOME/shared/lib
Later I generate the war files without jars for every application
grails war --nojars
I put all three wars in the tomcat/webapps directory. The production dataSource in conf/DataSource.groovy looks as follows for every app.
App A)
production { dataSource { dbCreate = "update" username = "userA" password="password" url = "jdbc:mysql://localhost:3306/applicationA" driverClassName = "org.gjt.mm.mysql.Driver" } }
App B)
production { dataSource { dbCreate = "update" username = "userB" password="password" url = "jdbc:mysql://localhost:3306/applicationB" driverClassName = "org.gjt.mm.mysql.Driver" } }
App C)
production { dataSource { dbCreate = "update" username = "userC" password="password" url = "jdbc:mysql://localhost:3306/applicationC" driverClassName = "org.gjt.mm.mysql.Driver" } }
When I start up Tomcat the logs look like this:
Dec 11, 2011 11:28:15 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java Dec 11, 2011 11:28:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property. Dec 11, 2011 11:28:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property. Dec 11, 2011 11:28:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property. Dec 11, 2011 11:28:15 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Dec 11, 2011 11:28:15 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Dec 11, 2011 11:28:15 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 652 ms Dec 11, 2011 11:28:15 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Dec 11, 2011 11:28:15 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.23 Dec 11, 2011 11:28:16 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:22 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war Dec 11, 2011 11:28:22 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:23 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war Dec 11, 2011 11:28:23 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:24 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war Dec 11, 2011 11:28:24 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/docs Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/examples Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined Dec 11, 2011 11:28:25 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Dec 11, 2011 11:28:25 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Dec 11, 2011 11:28:25 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5f24aa56') Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/host-manager Dec 11, 2011 11:28:25 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/manager Dec 11, 2011 11:28:25 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:26 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war Dec 11, 2011 11:28:26 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:26 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war Dec 11, 2011 11:28:26 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:27 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war Dec 11, 2011 11:28:27 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:27 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/docs Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/examples Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined Dec 11, 2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Dec 11, 2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Dec 11, 2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@55e610e3') Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/host-manager Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/manager Dec 11, 2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:28 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war Dec 11, 2011 11:28:28 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:29 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war Dec 11, 2011 11:28:29 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:29 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war Dec 11, 2011 11:28:29 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/docs Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/examples Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined Dec 11, 2011 11:28:30 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Dec 11, 2011 11:28:30 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Dec 11, 2011 11:28:30 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@75ea2543') Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/host-manager Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/manager Dec 11, 2011 11:28:30 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationB-0.1war Dec 11, 2011 11:28:31 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationA-0.1war Dec 11, 2011 11:28:31 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war Dec 11, 2011 11:28:32 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/docs Dec 11, 2011 11:28:32 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/examples Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/host-manager Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/manager Dec 11, 2011 11:28:33 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /Applications/apache-tomcat-7.0.23/webapps/ROOT Dec 11, 2011 11:28:34 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Dec 11, 2011 11:28:34 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Dec 11, 2011 11:28:34 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 19073 ms
The applications start up and I can reach them. However, The only Application which has a working datasource connection is the last context loaded.
INFO: Deploying web application archive /Applications/apache-tomcat-7.0.23/webapps/ApplicationC-0.1war Dec 11, 2011 11:28:29 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext
What can I do to solve this?
SOLUTION FOR 1.3.7
Some of the jars generated in a grais war command cannot be shared between every application.
Jars which cannot be shared and should be in webapps/appA/WEB-INF/lib
grails-bootstrap-1.3.7.jar grails-gorm-1.3.7.jar grails-web-1.3.7.jar grails-core-1.3.7.jar grails-resources-1.3.7.jar spring-security-core-3.0.5.RELEASE.jar grails-crud-1.3.7.jar grails-spring-1.3.7.jar
Jars which can be shared and can be in tomcat/shared/lib
antlr-2.7.6.jar aopalliance-1.0.jar asm-3.3.1.jar asm-analysis-3.3.1.jar asm-tree-3.3.1.jar asm-util-3.3.1.jar aspectjrt-1.6.8.jar aspectjweaver-1.6.8.jar c3p0-0.9.1.2.jar cglib-nodep-2.1_3.jar commons-beanutils-1.8.0.jar commons-codec-1.4.jar commons-collections-3.2.1.jar commons-dbcp-1.3.jar commons-el-1.0.jar commons-fileupload-1.2.1.jar commons-io-1.4.jar commons-lang-2.4.jar commons-lang3-3.0.1.jar commons-pool-1.5.5.jar commons-validator-1.3.1.jar concurrentlinkedhashmap-lru-1.0_jdk5.jar dom4j-1.6.1.jar ehcache-core-1.7.1.jar ejb3-persistence-1.0.2.GA.jar groovy-all-1.7.8.jar hibernate-annotations-3.4.0.GA.jar hibernate-commons-annotations-3.1.0.GA.jar hibernate-core-3.3.1.GA.jar hibernate-ehcache-3.3.1.GA.jar hibernate-validator-3.1.0.GA.jar hsqldb-1.8.0.10.jar javassist-3.11.0.GA.jar jcl-over-slf4j-1.5.8.jar jsoup-1.6.1.jar jstl-1.1.2.jar jta-1.1.jar jul-to-slf4j-1.5.8.jar log4j-1.2.16.jar mysql-connector-java-5.1.6.jar org.springframework.aop-3.0.5.RELEASE.jar org.springframework.asm-3.0.5.RELEASE.jar org.springframework.aspects-3.0.5.RELEASE.jar org.springframework.beans-3.0.5.RELEASE.jar org.springframework.context-3.0.5.RELEASE.jar org.springframework.context.support-3.0.5.RELEASE.jar org.springframework.core-3.0.5.RELEASE.jar org.springframework.expression-3.0.5.RELEASE.jar org.springframework.instrument-3.0.5.RELEASE.jar org.springframework.jdbc-3.0.5.RELEASE.jar org.springframework.jms-3.0.5.RELEASE.jar org.springframework.orm-3.0.5.RELEASE.jar org.springframework.oxm-3.0.5.RELEASE.jar org.springframework.transaction-3.0.5.RELEASE.jar org.springframework.web-3.0.5.RELEASE.jar org.springframework.web.servlet-3.0.5.RELEASE.jar oro-2.0.8.jar parboiled-core-1.0.2.jar parboiled-java-1.0.2.jar pegdown-1.1.0.jar remark-0.9.3.jar sitemesh-2.4.jar slf4j-api-1.5.8.jar slf4j-log4j12-1.5.8.jar standard-1.1.2.jar xmlbeans-2.3.0.jar xpp3_min-1.1.3.4.O.jar
SOLUTION FOR 2.0.0
Some of the jars generated in a grais war command cannot be shared between every application.
Jars which cannot be shared and should be in webapps/appA/WEB-INF/lib
grails-bootstrap-2.0.0.jar grails-core-2.0.0.jar grails-crud-2.0.0.jar grails-datastore-core-1.0.0.RELEASE.jar grails-datastore-gorm-1.0.0.RELEASE.jar grails-datastore-simple-1.0.0.RELEASE.jar grails-hibernate-2.0.0.jar grails-logging-2.0.0.jar grails-plugin-codecs-2.0.0.jar grails-plugin-controllers-2.0.0.jar grails-plugin-converters-2.0.0.jar grails-plugin-datasource-2.0.0.jar grails-plugin-domain-class-2.0.0.jar grails-plugin-filters-2.0.0.jar grails-plugin-gsp-2.0.0.jar grails-plugin-i18n-2.0.0.jar grails-plugin-log4j-2.0.0.jar grails-plugin-mimetypes-2.0.0.jar grails-plugin-scaffolding-2.0.0.jar grails-plugin-services-2.0.0.jar grails-plugin-servlets-2.0.0.jar grails-plugin-url-mappings-2.0.0.jar grails-plugin-validation-2.0.0.jar grails-resources-2.0.0.jar grails-spring-2.0.0.jar grails-web-2.0.0.jar
Jars which can be shared and can be in tomcat/shared/lib
antlr-2.7.6.jar aopalliance-1.0.jar asm-3.1.jar asm-3.3.1.jar asm-analysis-3.3.1.jar asm-tree-3.3.1.jar asm-util-3.3.1.jar aspectjrt-1.6.10.jar aspectjweaver-1.6.10.jar cglib-2.2.jar commons-beanutils-1.8.3.jar commons-codec-1.5.jar commons-collections-3.2.1.jar commons-dbcp-1.4.jar commons-el-1.0.jar commons-fileupload-1.2.2.jar commons-io-2.1.jar commons-lang-2.6.jar commons-lang3-3.0.1.jar commons-logging-1.1.1.jar commons-pool-1.5.6.jar commons-validator-1.3.1.jar concurrentlinkedhashmap-lru-1.2_jdk5.jar dom4j-1.6.1.jar ecj-3.6.2.jar ehcache-core-2.4.6.jar fontbox-1.6.0.jar h2-1.2.147.jar hibernate-commons-annotations-3.2.0.Final.jar hibernate-core-3.6.7.Final.jar hibernate-ehcache-3.6.7.Final.jar hibernate-jpa-2.0-api-1.0.1.Final.jar hibernate-validator-4.1.0.Final.jar javassist-3.12.0.GA.jar jcl-over-slf4j-1.6.2.jar jsoup-1.6.1.jar jstl-1.1.2.jar jta-1.1.jar jul-to-slf4j-1.6.2.jar log4j-1.2.16.jar mysql-connector-java-5.1.18-bin.jar oro-2.0.8.jar parboiled-core-1.0.2.jar parboiled-java-1.0.2.jar pdfbox-1.6.0.jar pegdown-1.1.0.jar poi-3.7-20101029.jar poi-ooxml-3.7-20101029.jar poi-ooxml-schemas-3.7-20101029.jar remark-0.9.3.jar sitemesh-2.4.jar slf4j-api-1.6.2.jar spring-aop-3.1.0.RELEASE.jar spring-asm-3.1.0.RELEASE.jar spring-aspects-3.1.0.RELEASE.jar spring-beans-3.1.0.RELEASE.jar spring-context-3.1.0.RELEASE.jar spring-context-support-3.1.0.RELEASE.jar spring-core-3.1.0.RELEASE.jar spring-expression-3.1.0.RELEASE.jar spring-jdbc-3.1.0.RELEASE.jar spring-jms-3.1.0.RELEASE.jar spring-orm-3.1.0.RELEASE.jar spring-security-core-3.0.7.RELEASE.jar spring-security-web-3.0.7.RELEASE.jar spring-tx-3.1.0.RELEASE.jar spring-web-3.1.0.RELEASE.jar spring-webmvc-3.1.0.RELEASE.jar validation-api-1.0.0.GA.jar xmlbeans-2.3.0.jar xpp3_min-1.1.4c.jar
解决方案Unfortunately this doesn't work in Grails, and there are a few more issues than the datasource. We looked at fixing this for 2.0 but there are still issues, so it won't work until a 2.0.x release.
The problem is static variables in the core Grails jars. Since the classes in those jars are loaded by the shared classloader, the statics are shared throughout Tomcat. As long as the jars are in each war file they're loaded by the war-specific classloader and there's no conflict between static variables. So until this is fixed you need to deploy full wars, or at least keep the grails-*.jar files in the wars.
这篇关于如何在Tomcat中部署多个应用程序,共享jar并拥有不同的数据源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!