java - Tomcat + Grails 集群不工作

标签 java apache hibernate tomcat

我在 Debian Jessie 上有一个 Tomcat 集群,Tomcat 8.0.29 2 个实例,PostgreSQL 9.5,Apache 2.4,Mod_jk。当我尝试在此环境中运行我的项目时,出现错误。我用示例项目进行了测试,效果很好。我的日志是这样的

01-Feb-2016 19:07:39.474 SEVERE [main] org.apache.catalina.ha.deploy.FarmWarDeployer.start FarmWarDeployer can only work as host cluster subelement!
01-Feb-2016 19:07:39.537 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Despliegue del archivo /opt/tomcat8_nodo1/webapps/clusterjsp.war de la aplicación web
01-Feb-2016 19:07:40.886 INFO [MessageDispatch15Interceptor.MessageDispatchThread1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:1 messages
        Sent:0.00 MB (total)
        Sent:0.00 MB (application)
        Time:0.01 seconds
        Tx Speed:0.06 MB/sec (total)
        TxSpeed:0.06 MB/sec (application)
        Error Msg:0
        Rx Msg:2 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:0.00 MB]

01-Feb-2016 19:07:42.068 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1.489] milliseconds.

01-Feb-2016 19:07:42.088 INFO [localhost-startStop-1] org.apache.catalina.tribes.tipis.AbstractReplicatedMap.init Initializing AbstractReplicatedMap with context name:localhost#/clusterjsp-map

01-Feb-2016 19:07:42.310 INFO [localhost-startStop-1] org.apache.catalina.tribes.tipis.AbstractReplicatedMap.init AbstractReplicatedMap[localhost#/clusterjsp-map] initialization was completed in 222 ms.

01-Feb-2016 19:07:42.585 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /opt/tomcat8_nodo1/webapps/clusterjsp.war has finished in 3.048 ms

01-Feb-2016 19:07:45.652 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Despliegue del archivo /opt/tomcat8_nodo1/webapps/abacus.war de la aplicación web
01-Feb-2016 
19:14:05.387 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP .
feb 01, 2016 7:14:05 PM org.apache.catalina.core.ApplicationContext log
INFORMACIÓN: Initializing AtmosphereFramework

feb 01, 2016 7:14:05 PM org.apache.catalina.core.ApplicationContext log
INFORMACIÓN: No Spring WebApplicationInitializer types detected on classpath
feb 01, 2016 7:14:06 PM org.apache.catalina.core.ApplicationContext log

INFORMACIÓN: Initializing Spring root WebApplicationContext
feb 01, 2016 7:14:54 PM org.apache.tomcat.jdbc.pool.ConnectionPool init
ADVERTENCIA: maxActive is smaller than 1, setting maxActive to: 100

<strong>
2016-02-01 19:14:59,345 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more
2016-02-01 19:14:59,346 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more
feb 01, 2016 7:14:59 PM org.apache.catalina.core.StandardContext listenerStart

GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor()] threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
        ... 5 more

01-Feb-2016 19:14:59.347 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
01-Feb-2016 19:14:59.349 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Falló en arranque del Contexto [/abacus] debido a errores previos
feb 01, 2016 7:14:59 PM org.apache.catalina.core.ApplicationContext log
INFORMACIÓN: Closing Spring root WebApplicationContext
01-Feb-2016 19:14:59.363 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc La aplicación web [abacus] registró el conductor JDBC [org.postgresql.Driver] pero falló al anular el registro mientras la aplicación web estaba parada. Para prevenir un fallo de memoria, se ha anulado el registro del conductor JDBC por la fuerza.
</strong>

01-Feb-2016 19:14:59.371 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /opt/tomcat8_nodo1/webapps/abacus.war has finished in 433.719 ms
01-Feb-2016 19:14:59.373 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Despliegue del directorio /opt/tomcat8_nodo1/webapps/ROOT de la aplicación web
01-Feb-2016 19:14:59.434 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat8_nodo1/webapps/ROOT has finished in 61 ms

01-Feb-2016 19:14:59.435 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Despliegue del directorio /opt/tomcat8_nodo1/webapps/manager de la aplicación web
01-Feb-2016 19:14:59.479 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat8_nodo1/webapps/manager has finished in 45 ms
01-Feb-2016 19:14:59.479 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Despliegue del directorio /opt/tomcat8_nodo1/webapps/examples de la aplicación web
01-Feb-2016 19:14:59.726 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat8_nodo1/webapps/examples has finished in 247 ms
01-Feb-2016 19:14:59.726 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Despliegue del directorio /opt/tomcat8_nodo1/webapps/host-manager de la aplicación web
01-Feb-2016 19:14:59.743 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /opt/tomcat8_nodo1/webapps/host-manager has finished in 17 ms
01-Feb-2016 19:14:59.750 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]

01-Feb-2016 19:14:59.760 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 442905 ms
01-Feb-2016 22:35:59.831 INFO [Tribes-Task-Receiver-5] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:10,000 messages
        Sent:6.81 MB (total)
        Sent:6.81 MB (application)
        Time:2.39 seconds
        Tx Speed:2.85 MB/sec (total)
        TxSpeed:2.85 MB/sec (application)
        Error Msg:0
        Rx Msg:10,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:6.81 MB]

01-Feb-2016 22:35:59.832 INFO [Tribes-Task-Receiver-5] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:10,000 messages
        Sent:6.81 MB (total)
        Sent:6.81 MB (application)
        Time:2.39 seconds
        Tx Speed:2.85 MB/sec (total)
        TxSpeed:2.85 MB/sec (application)
        Error Msg:0
        Rx Msg:10,001 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:6.81 MB]

02-Feb-2016 02:04:23.818 INFO [Tribes-Task-Receiver-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:20,000 messages
        Sent:13.62 MB (total)
        Sent:13.62 MB (application)
        Time:4.07 seconds
        Tx Speed:3.35 MB/sec (total)
        TxSpeed:3.35 MB/sec (application)
        Error Msg:0
        Rx Msg:20,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:13.62 MB]

02-Feb-2016 02:04:23.820 INFO [GroupChannel-Heartbeat-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:20,000 messages
        Sent:13.62 MB (total)
        Sent:13.62 MB (application)
        Time:4.07 seconds
        Tx Speed:3.35 MB/sec (total)
        TxSpeed:3.35 MB/sec (application)
        Error Msg:0
        Rx Msg:20,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:13.62 MB]

02-Feb-2016 05:32:47.761 INFO [Tribes-Task-Receiver-6] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:30,000 messages
        Sent:20.43 MB (total)
        Sent:20.43 MB (application)
        Time:5.72 seconds
        Tx Speed:3.57 MB/sec (total)
        TxSpeed:3.57 MB/sec (application)
        Error Msg:0
        Rx Msg:30,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:20.42 MB]

02-Feb-2016 05:32:47.763 INFO [Tribes-Task-Receiver-6] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:30,000 messages
        Sent:20.43 MB (total)
        Sent:20.43 MB (application)
        Time:5.72 seconds
        Tx Speed:3.57 MB/sec (total)
        TxSpeed:3.57 MB/sec (application)
        Error Msg:0
        Rx Msg:30,001 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:20.42 MB]

02-Feb-2016 09:01:11.617 INFO [Tribes-Task-Receiver-5] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:40,000 messages
        Sent:27.23 MB (total)
        Sent:27.24 MB (application)
        Time:7.38 seconds
        Tx Speed:3.69 MB/sec (total)
        TxSpeed:3.69 MB/sec (application)
        Error Msg:0
        Rx Msg:40,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:27.23 MB]

02-Feb-2016 09:01:11.618 INFO [GroupChannel-Heartbeat-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:40,001 messages
        Sent:27.24 MB (total)
        Sent:27.24 MB (application)
        Time:7.38 seconds
        Tx Speed:3.69 MB/sec (total)
        TxSpeed:3.69 MB/sec (application)
        Error Msg:0
        Rx Msg:40,002 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:27.23 MB]

02-Feb-2016 12:29:35.561 INFO [Tribes-Task-Receiver-2] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:49,999 messages
        Sent:34.04 MB (total)
        Sent:34.04 MB (application)
        Time:8.99 seconds
        Tx Speed:3.79 MB/sec (total)
        TxSpeed:3.79 MB/sec (application)
        Error Msg:0
        Rx Msg:50,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:34.04 MB]

02-Feb-2016 12:29:36.108 INFO [GroupChannel-Heartbeat-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:50,000 messages
        Sent:34.04 MB (total)
        Sent:34.05 MB (application)
        Time:8.99 seconds
        Tx Speed:3.79 MB/sec (total)
        TxSpeed:3.79 MB/sec (application)
        Error Msg:0
        Rx Msg:50,001 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:34.04 MB]

02-Feb-2016 15:57:59.873 INFO [Tribes-Task-Receiver-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:59,999 messages
        Sent:40.85 MB (total)
        Sent:40.85 MB (application)
        Time:10.64 seconds
        Tx Speed:3.84 MB/sec (total)
        TxSpeed:3.84 MB/sec (application)
        Error Msg:0
        Rx Msg:60,000 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:40.85 MB]

02-Feb-2016 15:58:00.431 INFO [GroupChannel-Heartbeat-1] org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor.report ThroughputInterceptor Report[
        Tx Msg:60,000 messages
        Sent:40.85 MB (total)
        Sent:40.85 MB (application)
        Time:10.64 seconds
        Tx Speed:3.84 MB/sec (total)
        TxSpeed:3.84 MB/sec (application)
        Error Msg:0
        Rx Msg:60,001 messages
        Rx Speed:0.00 MB/sec (since 1st msg)
        Received:40.85 MB]

最佳答案

这个问题有很多不同的可能原因。两个头号嫌疑犯是:

  • 您正在使用触发 Spring 类组件扫描的插件。
  • 您的代码添加了一个组件扫描,该组件扫描命中了 Spring 类。

在整个项目中搜索“组件扫描”可以帮助您检查这两个原因。

关于java - Tomcat + Grails 集群不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35164534/

相关文章:

java - PrimeFaces 自动完成功能在更新后失去值(value)

apache - 除了 CORS 预检外,所有请求都需要客户端证书

javascript - 通过 JSP 或 JS 连接的 Hibernate 和 SQL 2008 前端

java - 将已删除的数据与其他数据一起包含到审核查询中

java - 了解hibernate中的多对多映射

java - 尝试计算两个物体位置之间的距离

java - 用于关闭 JDBC 对象的通用助手

Java单元测试: Test from public method or package private method

html - 如何从子目录中包含/链接 css(和 html)?

apache - 基于CL的在IBMi系统上添加HTTP服务器的方法