java – infinispan服务器上的JDBC_PING无法正常工作

我正处于infinispan服务器的实验阶段,我在本地机器上设置infinispan集群时遇到问题.
配置文件:
我通过使用udp stack和jdbc_ping discovery更改jgroup堆栈的一部分来更改配置文件cluster.xml.

 <subsystem xmlns="urn:infinispan:server:jgroups:7.0" default-stack="${jboss.default.jgroups.stack:udp-jdbc}">
        <stack name="udp-jdbc">
            <transport type="UDP" socket-binding="jgroups-udp">
                <property name="ip_mcast">false</property>
    </transport>
            <protocol type="JDBC_PING">
                <property name="connection_url">jdbc:mysql://localhost/jgroups</property>
                <property name="connection_username">root</property>
                <property name="connection_password">root</property>            
                <property name="connection_driver">com.mysql.jdbc.Driver</property>
    </protocol>                
            <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
            <protocol type="FD_ALL"/>
            <protocol type="VERIFY_SUSPECT"/>
            <protocol type="pbcast.NAKACK2"/>
            <protocol type="UNICAST3"/>
            <protocol type="pbcast.STABLE"/>
            <protocol type="pbcast.GMS"/>
            <protocol type="UFC"/>
            <protocol type="MFC"/>
            <protocol type="FRAG2"/>
            <protocol type="RSVP"/>
        </stack>

我把mysql驱动程序放在文件夹独立/部署中,运行服务器,这就是我输出的内容

20:13:15,389 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "mysql-connector-java-5.1.34-bin.jar" (runtime-name: "mysql-connector-java-5.1.34-bin.jar")
20:13:15,461 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.jgroups.channel.clustered: org.jboss.msc.service.StartException in service jboss.jgroups.channel.clustered: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'
    at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:74)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Caused by: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'
    at org.jgroups.protocols.JDBC_PING.loadDriver(JDBC_PING.java:267)
    at org.jgroups.protocols.JDBC_PING.init(JDBC_PING.java:93)
    at org.jgroups.stack.ProtocolStack.initProtocolStack(ProtocolStack.java:860)
    at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:481)
    at org.jgroups.JChannel.init(JChannel.java:848)
    at org.jgroups.JChannel.<init>(JChannel.java:159)
    at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:87)
    at org.jboss.as.clustering.jgroups.subsystem.ChannelService.start(ChannelService.java:69)
    ... 5 more

20:13:15,559 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
20:13:15,561 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
20:13:15,563 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = mysql-connector-java-5.1.34-bin.jar_com.mysql.jdbc.Driver_5_1
20:13:15,564 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010417: Started Driver service with driver-name = mysql-connector-java-5.1.34-bin.jar_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
20:13:15,597 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 18) JBAS018559: Deployed "mysql-connector-java-5.1.34-bin.jar" (runtime-name : "mysql-connector-java-5.1.34-bin.jar")
20:13:15,599 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.jgroups.channel.clustered: org.jboss.msc.service.StartException in service jboss.jgroups.channel.clustered: java.lang.IllegalArgumentException: JDBC Driver required for JDBC_PING protocol could not be loaded: 'com.mysql.jdbc.Driver'

从jboss日志中可以看出,子系统infinispan:server:jgroups无法启动,因为没有加载JDBC驱动程序(JDBC_PING需要),但在该步骤之后infinispan服务器成功部署了mysql jdbc驱动程序.在我使用数据源的情况下,同样的错误占用.
有没有办法告诉infinispan:服务器:jgroups子系统在驱动程序加载之前或jndi命名创建之前启动?
或任何有用的解决方法

提前致谢

解决方法:

对于直接JDBC使用,您需要允许JGroups模块加载JDBC驱动程序模块.为此,请将JDBC驱动程序jar作为模块安装,然后打开modules / system / layers / base / org / jgroups / main / module.xml,在依赖项部分下添加JDBC驱动程序模块.

对于使用EAGER缓存进行数据源查找,我认为目前无法在JGroups尝试使用数据源之前确保数据源可用.服务引导顺序由程序依赖性控制,但无法通过配置文件声明依赖性,因此JGroups不会等待数据源.

上一篇:java – Infinispan操作模式


下一篇:java – Infinispan JMX错误