6 Replies Latest reply on Feb 11, 2020 1:47 PM by pferraro

    Wildfly 10 AWS using JDBC_PING for JGROUPS

    mc11

      Hi All

       

      I am getting this error when shutting down wildfly node on my EC2 instances.  Has anyone else seen this?  Can I ignore?

       

                     <datasource jndi-name="java:jboss/datasources/ClusterDS" pool-name="ClusterDS" enabled="true" use-java-context="true">

                          <connection-url>${ds.jgroups.connection-url}</connection-url>

                          <connection-property name="url">

                              ${ds.jgroups.connection-url}

                          </connection-property>

       

              <subsystem xmlns="urn:jboss:domain:jgroups:4.0">

                  <channels default="ee">

                      <channel name="ee" stack="tcp" cluster="ejb"/>

                  </channels>

                  <stacks>

                      <stack name="tcp">

                          <transport type="TCP" socket-binding="jgroups-tcp"/>

                          <protocol type="TCPGOSSIP">

                          </protocol>

                          <protocol type="org.jgroups.protocols.JDBC_PING">

                              <property name="datasource_jndi_name">

                                  java:jboss/datasources/ClusterDS

                              </property>

                          </protocol>

                          <protocol type="MERGE3"/>

                          <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                          <protocol type="FD"/>

                          <protocol type="VERIFY_SUSPECT"/>

                          <protocol type="pbcast.NAKACK2"/>

                          <protocol type="UNICAST3"/>

                          <protocol type="pbcast.STABLE"/>

                          <protocol type="pbcast.GMS"/>

                          <protocol type="FRAG2"/>

                      </stack>

                  </stacks>

              </subsystem>

       

      2019-01-02 11:06:25,297 ERROR [org.jgroups.protocols.JDBC_PING] (MSC service thread 1-3) JGRP000115: Could not open connection to database: java.sql.SQLException: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:jboss/datasources/ClusterDS

              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)

              at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)

              at org.jgroups.protocols.JDBC_PING.getConnection(JDBC_PING.java:348)

              at org.jgroups.protocols.JDBC_PING.delete(JDBC_PING.java:379)

              at org.jgroups.protocols.JDBC_PING.deleteSelf(JDBC_PING.java:395)

              at org.jgroups.protocols.JDBC_PING.stop(JDBC_PING.java:144)

              at org.jgroups.stack.ProtocolStack.stopStack(ProtocolStack.java:1016)

              at org.jgroups.JChannel.stopStack(JChannel.java:1001)

              at org.jgroups.JChannel.disconnect(JChannel.java:373)

              at org.wildfly.clustering.jgroups.spi.service.ChannelConnectorBuilder.stop(ChannelConnectorBuilder.java:103)

              at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:2056)

              at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:2017)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java)

              at java.lang.Thread.run(Thread.java:748)

      Caused by: javax.resource.ResourceException: IJ000470: You are trying to use a connection factory that has been shut down: java:jboss/datasources/ClusterDS

              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:735)

              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)

              ... 14 more

        • 1. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
          pferraro

          Use this configuration instead:

          <protocol type="JDBC_PING" data-source="ClusterDS"/>

           

          This establishes a service dependency between the protocol and the DataSource and prevents problems like you've described.

          1 of 1 people found this helpful
          • 2. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
            mc11

            Hi Paul

             

            my config is now

             

                    <subsystem xmlns="urn:jboss:domain:jgroups:4.0">

                        <channels default="ee">

                            <channel name="ee" stack="tcp" cluster="ejb"/>

                        </channels>

                        <stacks>

                            <stack name="tcp">

                                <transport type="TCP" socket-binding="jgroups-tcp"/>

                                <protocol type="JDBC_PING" data-source="ClusterDS"/>

                                <protocol type="MERGE3"/>

                                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                                <protocol type="FD"/>

                                <protocol type="VERIFY_SUSPECT"/>

                                <protocol type="pbcast.NAKACK2"/>

                                <protocol type="UNICAST3"/>

                                <protocol type="pbcast.STABLE"/>

                                <protocol type="pbcast.GMS"/>

                                <protocol type="FRAG2"/>

                            </stack>

                        </stacks>

                    </subsystem>

            • 3. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
              aberesneva

              Hi Paul,

              Did this config change help?
              I have the same problem and my config is like


              <stack name="tcp">

                                  <transport type="TCP" socket-binding="jgroups-tcp"/>

                                  <protocol type="org.jgroups.protocols.JDBC_PING">

                                      <property name="datasource_jndi_name">java:jboss/datasources/KeycloakDS</property>

                                      <property name="break_on_coord_rsp">true</property>

                                      <property name="initialize_sql">CREATE TABLE IF NOT EXISTS JGROUPSPING (own_addr varchar(200) NOT NULL, creation_timestamp timestamp NOT NULL, cluster_name varchar(200) NOT NULL, ping_data bytea, constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name))</property>

                                      <property name="insert_single_sql">INSERT INTO JGROUPSPING (own_addr, creation_timestamp, cluster_name, ping_data) values (?, NOW(), ?, ?)</property>

                                  </protocol>

                                  <protocol type="MERGE3"/>

                                  <socket-protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                                  <protocol type="FD"/>

                                  <protocol type="VERIFY_SUSPECT"/>

                                  <protocol type="pbcast.NAKACK2"/>

                                  <protocol type="UNICAST3"/>

                                  <protocol type="pbcast.STABLE"/>

                                  <protocol type="pbcast.GMS">

                                      <property name="max_join_attempts">5</property>

                                  </protocol>

                                  <protocol type="MFC"/>

                                  <protocol type="FRAG2"/>

                              </stack>



              • 4. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
                pferraro

                Yes - see my previous comment.  You need to reference the data-source by name, not jndi name.  This ensures the DataSource service is started before it is needed by JDBC_PING.

                • 5. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
                  aberesneva

                  Thank you, Paul. But I need your help again
                  I tried this:


                  <stack name="tcp">

                                      <transport type="TCP" socket-binding="jgroups-tcp"/>

                                      <protocol type="org.jgroups.protocols.JDBC_PING">

                                          <property name="data-source">KeycloakDS</property>

                                          <property name="break_on_coord_rsp">true</property>

                                          <property name="initialize_sql">CREATE TABLE IF NOT EXISTS JGROUPSPING (own_addr varchar(200) NOT NULL, creation_timestamp timestamp NOT NULL, cluster_name varchar(200) NOT NULL, ping_data bytea, constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name))</property>

                                          <property name="insert_single_sql">INSERT INTO JGROUPSPING (own_addr, creation_timestamp, cluster_name, ping_data) values (?, NOW(), ?, ?)</property>

                                      </protocol>

                                      <protocol type="MERGE3"/>

                  and this:

                  <stack name="tcp">

                                      <transport type="TCP" socket-binding="jgroups-tcp"/>

                                      <protocol type="org.jgroups.protocols.JDBC_PING" data-source="KeycloakDS">

                                          <property name="break_on_coord_rsp">true</property>

                                          <property name="initialize_sql">CREATE TABLE IF NOT EXISTS JGROUPSPING (own_addr varchar(200) NOT NULL, creation_timestamp timestamp NOT NULL, cluster_name varchar(200) NOT NULL, ping_data bytea, constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name))</property>

                                          <property name="insert_single_sql">INSERT INTO JGROUPSPING (own_addr, creation_timestamp, cluster_name, ping_data) values (?, NOW(), ?, ?)</property>

                                      </protocol>

                                      <protocol type="MERGE3"/>


                  But didn't success( I had next Error:

                  ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([

                      ("subsystem" => "jgroups"),

                      ("channel" => "ee")

                  ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.jgroups.channel.ee" => "java.lang.IllegalStateException: java.lang.IllegalArgumentException: Either the 4 configuration properties starting with 'connection_' or the datasource_jndi_name must be set

                      Caused by: java.lang.IllegalStateException: java.lang.IllegalArgumentException: Either the 4 configuration properties starting with 'connection_' or the datasource_jndi_name must be set

                      Caused by: java.lang.IllegalArgumentException: Either the 4 configuration properties starting with 'connection_' or the datasource_jndi_name must be set"}}

                  Please, give me an advice, how to add data-source to my config!


                  • 6. Re: Wildfly 10 AWS using JDBC_PING for JGROUPS
                    pferraro

                    Try this:

                     

                    <protocol type="JDBC_PING" data-source="KeycloakDS">...</protocol>