简体   繁体   English

Jboss 6.4 Infinispan 8.2和JGroups-ClassNotFoundException

[英]Jboss 6.4 Infinispan 8.2 and JGroups - ClassNotFoundException

I need some features from Infinispan 8+. 我需要Infinispan 8+的一些功能。 Therefore I have updated my company app pom.xml with the newest Infinispan pom. 因此,我用最新的Infinispan pom更新了我的公司应用pom.xml。

It was quite straightforward, but the app uses jgroups (or its default config in default-configs/default-jgroups-udp.xml - this location is different from previous versions of infinispan). 它非常简单,但是该应用程序使用jgroups(或其默认配置在default-configs / default-jgroups-udp.xml中-此位置与infinispan的先前版本不同)。 The default versions have some parameters (and the XSD from Jgroups version 3.6) - so I also bumped jgroups to 3.6.8.Final as it looks like it is the intended version (and the version that does not complain about unknown parameters in default config in infinispan 8.2) 默认版本有一些参数(以及Jgroups 3.6版的XSD)-所以我也将jgroups升级到3.6.8.Final,因为它看起来像是预期的版本(并且该版本不会抱怨默认配置中的未知参数)在infinispan 8.2中)

so the pom is the following: 所以pom如下:

         <dependency>
            <groupId>org.jgroups</groupId>
            <artifactId>jgroups</artifactId>
            <version>3.6.8.Final</version>
        </dependency>
        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-core</artifactId>                
            <version>8.2.0.Final</version>
        </dependency>

Anyway - this application starts with no problems using spring-boot with Jetty. 无论如何-使用Jetty的spring-boot可以毫无问题地启动该应用程序。 I am pretty sure it would start on any application server. 我很确定它将在任何应用程序服务器上启动。

But then I have no choice but to run it on JBoss 6.4. 但是然后我别无选择,只能在JBoss 6.4上运行它。 There I got an exception involving some jboss.as classes (this is kind of unexpected) during the deployment: 在部署期间,我遇到了涉及某些jboss.as类的异常(这是意外的):

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:234)
    ... 141 more
Caused by: java.lang.ExceptionInInitializerError
    at org.jgroups.conf.XmlConfigurator.<clinit>(XmlConfigurator.java:35)
    at org.jgroups.conf.ConfiguratorFactory.getStackConfigurator(ConfiguratorFactory.java:62)
    at org.jgroups.JChannel.<init>(JChannel.java:129)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:419)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannel(JGroupsTransport.java:320)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannelAndRPCDispatcher(JGroupsTransport.java:366)
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:190)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
    ... 146 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.jboss.as.clustering.jgroups.LogFactory from [Module "deployment.mymodule-5.0.0.0-SNAPSHOT.ear.appName.war:main" from Service Module Loader]
    at org.jgroups.logging.LogFactory.<clinit>(LogFactory.java:31)
    ... 158 more
Caused by: java.lang.ClassNotFoundException: org.jboss.as.clustering.jgroups.LogFactory from [Module "deployment.mymodule-5.0.0.0-SNAPSHOT.ear.appName.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.jgroups.logging.LogFactory.<clinit>(LogFactory.java:28)
    ... 158 more

My guess is that org.jgroups.logging.LogFactory somehow discovers that is is running on a Jboss and tries to use org.jboss.as.clustering.jgroups.LogFactory but this version of Jboss does not have one. 我的猜测是org.jgroups.logging.LogFactory以某种方式发现它正在Jboss上运行,并尝试使用org.jboss.as.clustering.jgroups.LogFactory,但是此版本的Jboss没有。 (the server directory EAP-6.4.0\\modules\\system\\layers\\base\\org\\jgroups\\main contains jgroups version 3.2.X). (服务器目录EAP-6.4.0 \\ modules \\ system \\ layers \\ base \\ org \\ jgroups \\ main包含jgroups 3.2.X版)。

Is there any walkaround to use this jgroups version (and so Infinispan 8.2) in Jboss 6.4? 在Jboss 6.4中是否有使用该jgroups版本(以及Infinispan 8.2)的解决方法?

This is (the application) an ear file so I can manipulate jboss-deployment-structure.xml file, but so far I only came with excluding Jboss original jgroups, and this did not help. 这是(该应用程序)耳文件,因此我可以操纵jboss-deployment-structure.xml文件,但是到目前为止,我只附带了排除Jboss原始jgroup的文件,但这没有帮助。

 <exclusions>
        <module name="org.jgroups"/>
 </exclusions>

This is currently bug with Infinispan 8 + EAP 6.4 combination. 当前是Infinispan 8 + EAP 6.4组合的错误。 The reason is exactly as @Flavius says in comments. 原因与@Flavius在评论中所说的完全相同。 Currently there is discussion where to fix it, but it'll mostly likely be fixed in EAP 6.4. 当前正在讨论在哪里修复它,但是它很可能会在EAP 6.4中修复。 I'm sure it will be done soon. 我相信它将很快完成。

I can only offer you a working workarounds. 我只能为您提供一个解决方法。

  1. Use WildFly - the issue is not present there anymore 使用WildFly-该问题不再存在
  2. Little nasty workaround, but it works: 有点讨厌的解决方法,但它可以工作:
    1. Call System.clearProperty("jgroups.logging.log_factory_class"); 调用System.clearProperty("jgroups.logging.log_factory_class"); in the deployment 在部署中
    2. Include JBoss Logging of version specified in infinispan-bom in your deployment (eg add jboss-logging Maven dependency in your pom.xml) 在您的部署中包括infinispan-bom中指定的版本的JBoss日志记录(例如,在pom.xml中添加jboss-logging Maven依赖项)
    3. Provide jboss-deployment-structure.xml to your deployment, which excludes the server's JBoss logging, see below: 为您的部署提供jboss-deployment-structure.xml ,其中不包括服务器的JBoss日志记录,请参见以下内容:

    <jboss-deployment-structure>
        <deployment>
            <exclusions>
                <module name="org.jboss.logging" />
            </exclusions>
        </deployment>
    </jboss-deployment-structure>

Another possibility if none of the above workarounds work (for instance the app uses other log mechanisms) is to implement an own http://www.jgroups.org/javadoc/org/jgroups/logging/CustomLogFactory.html 如果上述解决方法都不起作用(例如,应用程序使用其他日志机制),则另一种可能性是实现自己的http://www.jgroups.org/javadoc/org/jgroups/logging/CustomLogFactory.html

The log factory must return a log instance, implementing it for any other logger is straightforward with methods trace/error/debug etc. 日志工厂必须返回一个日志实例,可以使用trace / error / debug等方法直接为其他任何记录器实现该实例。

Then this logger class can be set with System.setProperty("jgroups.logging.log_factory_class","my.company.logging.MyJgroupsLog"); 然后可以使用System.setProperty("jgroups.logging.log_factory_class","my.company.logging.MyJgroupsLog");设置此记录器类System.setProperty("jgroups.logging.log_factory_class","my.company.logging.MyJgroupsLog");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM