0 Replies Latest reply on Feb 16, 2018 9:36 AM by Jan-Willem Gmelig Meyling

    Can't run two standalone instances on one server that use local Infinispan containers

    Jan-Willem Gmelig Meyling Newbie

      It seems I am unable to run two standalone servers on one server, for an application that uses local Infinispan containers. This fails because both instances will start up the same default local Infinispan cache containers, and one tries to register them within the JGroups context of the other (because even though JGroups is not included in the standalone configuration, using Infinispan seems to boot up a JGroups instance listening to a local port that disobeys the jboss.socket.binding.port-offset).

       

      It fails with:

       

      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
      }

       

      And the full stack trace:

       

      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.(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.(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.(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

      Hopefully someone can help me with constructing a standalone.xml workaround so that both instances have an isolated JGroups instance as well.