2014-09-22 92 views
1

我正在嘗試爲在兩個JBoss 7.2上運行的lifery 6.2設置集羣。我的兩個應用程序服務器使用相同的配置,但行爲不一樣。一個開始並且運行良好,另一個在啓動時崩潰。它與羣集設置有關。Liferay ehcache集羣

cluster.link.enabled=true 
cluster.link.autodetect.address=10.170.121.184:1531 
# second points to db server 

如前所述,兩臺服務器都使用此設置。一旦我刪除這些行,第二臺服務器也會啓動。但是這會阻止我使用集羣環境。我在我的日誌文件中做了一些研究,發現了一些例外(在服務器啓動時的liferay部署過程中)。

這是來自liferays日誌文件。這並不令人興奮,因爲它並不真正提供有價值的信息。

​​

但這就是它變得有趣的地方。此日誌文件摘錄來自啓動期間的jboss日誌(同一時間)。

12:11:46,822 INFO [org.jboss.web] (ServerService Thread Pool -- 127) JBAS018210: Register web context: 
12:11:47,832 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/]] (ServerService Thread Pool -- 127) Initializing Spring root WebApplicationContext 
12:18:12,760 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/]] (ServerService Thread Pool -- 127) JBWEB000287: Exception sending context initialized event to listener instance of class com.liferay.portal.spring.context.PortalContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.cache.MultiVMPool' defined in class path resource [META-INF/util-spring.xml]: Cannot resolve reference to bean 'com.liferay.portal.kernel.cache.MultiVMPortalCacheManager' while setting bean property 'portalCacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.cache.MultiVMPortalCacheManager' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.cache.ehcache.EhcachePortalCacheManager#26eb6935' of type [com.liferay.portal.cache.ehcache.EhcachePortalCacheManager] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.cache.ehcache.EhcachePortalCacheManager#26eb6935' defined in class path resource [META-INF/util-spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //15.131.81.31:53440/com.liferay.portal.kernel.dao.orm.EntityCache.com.liferay.portal.model.impl.ResourcePermissionImpl. Initial cause was Connection refused to host: 15.131.81.31; nested exception is: 
    java.net.ConnectException: Connection timed out 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context.jar:3.0.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [spring-context.jar:3.0.7.RELEASE] 
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web.jar:3.0.7.RELEASE] 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web.jar:3.0.7.RELEASE] 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web.jar:3.0.7.RELEASE] 
    at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:233) [portal-impl.jar:] 
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.0.Final.jar:7.2.0.Final] 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.0.Final.jar:7.2.0.Final] 
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final] 
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final] 
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final] 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_29] 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_29] 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_29] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29] 
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29] 
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.cache.MultiVMPortalCacheManager' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.cache.ehcache.EhcachePortalCacheManager#26eb6935' of type [com.liferay.portal.cache.ehcache.EhcachePortalCacheManager] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.cache.ehcache.EhcachePortalCacheManager#26eb6935' defined in class path resource [META-INF/util-spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //15.131.81.31:53440/com.liferay.portal.kernel.dao.orm.EntityCache.com.liferay.portal.model.impl.ResourcePermissionImpl. Initial cause was Connection refused to host: 15.131.81.31; nested exception is: 
    java.net.ConnectException: Connection timed out 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:441) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:982) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:878) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) [spring-beans.jar:3.0.7.RELEASE] 
    ... 28 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.cache.ehcache.EhcachePortalCacheManager#26eb6935' defined in class path resource [META-INF/util-spring.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //15.131.81.31:53440/com.liferay.portal.kernel.dao.orm.EntityCache.com.liferay.portal.model.impl.ResourcePermissionImpl. Initial cause was Connection refused to host: 15.131.81.31; nested exception is: 
    java.net.ConnectException: Connection timed out 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270) [spring-beans.jar:3.0.7.RELEASE] 
    ... 40 more 
Caused by: net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //15.131.81.31:53440/com.liferay.portal.kernel.dao.orm.EntityCache.com.liferay.portal.model.impl.ResourcePermissionImpl. Initial cause was Connection refused to host: 15.131.81.31; nested exception is: 
    java.net.ConnectException: Connection timed out 
    at net.sf.ehcache.distribution.RMICacheManagerPeerListener.notifyCacheAdded(RMICacheManagerPeerListener.java:538) [ehcache.jar:] 
    at net.sf.ehcache.event.CacheManagerEventListenerRegistry.notifyCacheAdded(CacheManagerEventListenerRegistry.java:159) [ehcache.jar:] 
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1408) [ehcache.jar:] 
    at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:798) [ehcache.jar:] 
    at net.sf.ehcache.CacheManager.doInit(CacheManager.java:485) [ehcache.jar:] 
    at net.sf.ehcache.CacheManager.init(CacheManager.java:392) [ehcache.jar:] 
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:266) [ehcache.jar:] 
    at com.liferay.portal.cache.ehcache.CacheManagerUtil.createCacheManager(CacheManagerUtil.java:38) [portal-impl.jar:] 
    at com.liferay.portal.cache.ehcache.EhcachePortalCacheManager.afterPropertiesSet(EhcachePortalCacheManager.java:77) [portal-impl.jar:] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_29] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_29] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_29] 
    at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_29] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487) [spring-beans.jar:3.0.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419) [spring-beans.jar:3.0.7.RELEASE] 
    ... 43 more 
Caused by: java.rmi.ConnectException: Connection refused to host: 15.131.81.31; nested exception is: 
    java.net.ConnectException: Connection timed out 
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601) [rt.jar:1.6.0_29] 
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198) [rt.jar:1.6.0_29] 
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184) [rt.jar:1.6.0_29] 
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322) [rt.jar:1.6.0_29] 
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) [rt.jar:1.6.0_29] 
    at java.rmi.Naming.rebind(Naming.java:160) [rt.jar:1.6.0_29] 
    at net.sf.ehcache.distribution.RMICacheManagerPeerListener.bind(RMICacheManagerPeerListener.java:234) [ehcache.jar:] 
    at net.sf.ehcache.distribution.RMICacheManagerPeerListener.notifyCacheAdded(RMICacheManagerPeerListener.java:536) [ehcache.jar:] 
    ... 58 more 
Caused by: java.net.ConnectException: Connection timed out 
    at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.6.0_29] 
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) [rt.jar:1.6.0_29] 
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) [rt.jar:1.6.0_29] 
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) [rt.jar:1.6.0_29] 
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) [rt.jar:1.6.0_29] 
    at java.net.Socket.connect(Socket.java:529) [rt.jar:1.6.0_29] 
    at java.net.Socket.connect(Socket.java:478) [rt.jar:1.6.0_29] 
    at java.net.Socket.<init>(Socket.java:375) [rt.jar:1.6.0_29] 
    at java.net.Socket.<init>(Socket.java:189) [rt.jar:1.6.0_29] 
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22) [rt.jar:1.6.0_29] 
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128) [rt.jar:1.6.0_29] 
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595) [rt.jar:1.6.0_29] 
    ... 65 more 

12:18:12,774 ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 127) JBWEB001103: Error detected during context start, will stop it 
12:18:12,796 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/]] (ServerService Thread Pool -- 127) Closing Spring root WebApplicationContext 
12:18:12,816 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 127) MSC00001: Failed to start service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context 
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_29] 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_29] 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_29] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_29] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_29] 
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29] 
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) 
Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context 
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161) 
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) 
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) 
    ... 7 more 

12:18:13,062 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "liferay-marketplace-portlet.war" (runtime-name : "marketplace-portlet.war") 
12:18:13,063 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "liferay-portal-6.2-ee-sp7-20140807114015311.war" (runtime-name : "liferay-portal-6.2-ee-sp7-20140807114015311.war") 
12:18:13,066 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report 
JBAS014777: Services which failed to start:  service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context 

12:18:13,070 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.2.0.Final "Janus" started (with errors) in 405064ms - Started 1695 of 1814 services (2 services failed or missing dependencies, 115 services are passive or on-demand) 

這兩行(來自上面的jboss摘錄)對我很可疑。

Caused by: net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //15.131.81.31:53440/com.liferay.portal.kernel.dao.orm.EntityCache.com.liferay.portal.model.impl.ResourcePermissionImpl. Initial cause was Connection refused to host: 15.131.81.31; nested exception is: 
    ... 
Caused by: java.rmi.ConnectException: Connection refused to host: 15.131.81.31; nested exception is: 

我不知道爲什麼這樣的Liferay試圖打開這個IP的連接,我不知道這個地址配置(從未被自己這樣做),我不知道哪個系統這個地址屬於(不是來自我的網絡的IP),我不知道爲什麼我的其他服務器(具有相同的配置)沒有遇到這樣的問題。也許這個地址是某種默認或回退?

當我首先啓動麻煩的服務器或完全獨立時,此行爲不會改變。這個問題總是遇到問題。

我確實在portal-ext.properties中引用了一些額外的ehcache設置來使用單播而不是多播,但這個配置對於​​兩臺服務器都是一樣的,所以最初的原因必須在其他地方。但也許我可以使用這些額外的ehcache設置來調整這個IP?

我遵循Liferay的博客條目之一來設置我的環境。截至目前我的ehcache設置與本文中提到的一樣(因爲我的第二臺服務器沒有啓動,所以我無法檢查是否需要進行一些更改)。 https://www.liferay.com/de/web/fimez/blog/-/blogs/configuring-a-liferay-cluster-and-make-it-use-unicast-

有沒有人有一些expirience設置liferay 6.2羣集或可能有一些洞察ehcache/jgroups設置可能會變得有幫助?我真的很感激它。

+0

似乎要回答[這裏](https://www.liferay.com/de/community/forums//message_boards/message/41898981)。 – 2015-05-20 14:16:34

回答

1

我在一個非常相似的場景中,使用在兩個JBoss 6.3上運行的Liferay 6.2,和你一樣「我的兩個應用服務器使用相同的配置,但行爲不一樣,一個是啓動並運行良好,另一個在啓動時崩潰。「

測試了很多配置之後,對我來說這一個工作,我刪除了這條線從它運行到給定的問題的服務器:

cluster.link.enabled=true 

留行只是在開始罰款服務器。

令人驚訝的羣集配置工作得很好。

PD。對不起,我的英語不好。

0

必須符合以下問題.....

造成的:java.rmi.ConnectException:拒絕連接主機:15.131.81.31;嵌套的異常是: java.net.ConnectException:連接超時

這可能是因爲防火牆的配置。或者是因爲其他網絡相關的原因...或者期望的服務, - RMI serice沒有運行在15.131.81.31

一旦這個問題解決了....我希望你能解決問題...