对于使用本地Infinispan容器的应用程序,我似乎无法在一台服务器上运行两台独立服务器。这失败了,因为两个实例都会启动相同的默认本地Infinispan缓存容器,并且一个尝试在另一个的JGroups上下文中注册它们(因为即使JGroups不包含在独立配置中,使用Infinispan似乎启动JGroups实例侦听不遵守jboss.socket.binding.port-offset的本地端口。
失败了:
2018-02-16 15:25:51,045 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "iris-server.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"iris-server.war#athena\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"iris-server.war#athena\": javax.persistence.PersistenceException: [PersistenceUnit: athena] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: athena] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
Caused by: org.hibernate.cache.CacheException: HHH025009: Unable to start region factory
Caused by: org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
Caused by: org.infinispan.commons.CacheException: Channel connected, but unable to register MBeans
Caused by: javax.management.MBeanRegistrationException: The @MBean objectName is not unique
Caused by: javax.management.InstanceAlreadyExistsException: org.infinispan:type=protocol,cluster=\"infinispan-hibernate-cluster\",protocol=UNICAST3"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.persistenceunit.\"iris-server.war#athena\""],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
完整的堆栈跟踪:
2018-02-16 15:25:41,404 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 66) MSC000001: Failed to start service jboss.persistenceunit."iris-server.war#athena": org.jboss.msc.service.StartException in service jboss.persistenceunit."iris-server.war#athena": javax.persistence.PersistenceException: [PersistenceUnit: athena] Unable to build Hibernate SessionFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:179)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:121)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:193)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: athena] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:161)
... 7 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:271)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:80)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:244)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
... 9 more
Caused by: org.hibernate.cache.CacheException: HHH025009: Unable to start region factory
at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:476)
at org.hibernate.cache.spi.RegionFactory.start(RegionFactory.java:63)
at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:71)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:28)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:20)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:59)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
... 15 more
Caused by: org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:249)
at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:663)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:310)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.createCacheManager(InfinispanRegionFactory.java:517)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.createCacheManager(InfinispanRegionFactory.java:513)
at org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:464)
... 21 more
Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:172)
at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:859)
at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:628)
at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:617)
at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:542)
at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:236)
... 26 more
Caused by: org.infinispan.commons.CacheException: Channel connected, but unable to register MBeans
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:217)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
... 31 more
Caused by: javax.management.MBeanRegistrationException: The @MBean objectName is not unique
at org.jgroups.jmx.JmxConfigurator.internalRegister(JmxConfigurator.java:184)
at org.jgroups.jmx.JmxConfigurator.register(JmxConfigurator.java:122)
at org.jgroups.jmx.JmxConfigurator.registerChannel(JmxConfigurator.java:59)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:214)
... 37 more
Caused by: javax.management.InstanceAlreadyExistsException: org.infinispan:type=protocol,cluster="infinispan-hibernate-cluster",protocol=UNICAST3
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.registerMBean(PluggableMBeanServerImpl.java:1527)
at org.jboss.as.jmx.PluggableMBeanServerImpl.registerMBean(PluggableMBeanServerImpl.java:871)
at org.jgroups.jmx.JmxConfigurator.internalRegister(JmxConfigurator.java:181)
... 40 more
希望有人可以帮我构建一个standalone.xml变通方法,以便两个实例都有一个独立的JGroups实例。
答案 0 :(得分:2)
你在使用什么Hibernate地区工厂?你可以发布你的hibernate.cfg.xml吗?
鉴于堆栈跟踪,我猜你正在使用org.hibernate.cache.infinispan.InfinispanRegionFactory,当你应该使用 org.jboss.as.jpa.hibernate5.infinispan.InfinispanRegionFactory。此实现旨在使用WildFly的Infinispan子系统中包含的缓存配置。