Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasource Issues with JBoss EAP 7.1 #248

Open
mafriedel opened this issue Jul 13, 2018 · 2 comments
Open

Datasource Issues with JBoss EAP 7.1 #248

mafriedel opened this issue Jul 13, 2018 · 2 comments

Comments

@mafriedel
Copy link

Using the code as described in the readme documentation:

wildfly::deployment { 'db2jcc4.jar':
source => 'http://artifacts/support/db2jcc4.jar',
}

wildfly::datasources::datasource { 'DB2T':
config => {
'driver-name' => 'db2jcc4.jar',
'connection-url' => 'jdbc:db2://10.0.0.1:3110/DB2T',
'jndi-name' => 'java:/jdbc/DB2T',
'use-ccm' => true,
'user-name' => 'USER',
'password' => 'PASS',
'initial-pool-size' => '10',
'max-pool-size' => '50',
'min-pool-size' => '10',
'jta' => true,
'enabled' => true,
'driver-class' => 'com.ibm.db2.jcc.DB2Driver',
'valid-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker',
'backgroud-validation' => true,
'exception-sorter-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter',
'stale-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker',
},
}

Will create the datasource the first time through.

jbossgha: Debug: Wildfly_resource[/subsystem=datasources/data-source=DB2T](provider=http_api): Exists? /subsystem=datasources/data-source=DB2T
jbossgha: Debug: Wildfly_resource[/subsystem=datasources/data-source=DB2T](provider=http_api): Creating /subsystem=datasources/data-source=DB2T with state {"driver-name"=>"db2jcc4.jar", "connection-url"=>"jdbc:db2://10.0.0.1:3110/DB2T", "jndi-name"=>"java:/jdbc/DB2T", "use-ccm"=>true, "user-name"=>"USER", "password"=>"PASS", "initial-pool-size"=>"10", "max-pool-size"=>"50", "min-pool-size"=>"10", "jta"=>true, "enabled"=>true, "driver-class"=>"com.ibm.db2.jcc.DB2Driver", "valid-connection-checker-class-name"=>"org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker", "backgroud-validation"=>true, "exception-sorter-class-name"=>"org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter", "stale-connection-checker-class-name"=>"org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"}
jbossgha: Notice: /Stage[main]/Profile::Mvh_rest_services_app/Wildfly::Datasources::Datasource[DB2T]/Wildfly::Resource[/subsystem=datasources/data-source=DB2T]/Wildfly_resource[/subsystem=datasources/data-source=DB2T]/ensure: created
jbossgha: Debug: /Stage[main]/Profile::Mvh_rest_services_app/Wildfly::Datasources::Datasource[DB2T]/Wildfly::Resource[/subsystem=datasources/data-source=DB2T]/Wildfly_resource[/subsystem=datasources/data-source=DB2T]: The container Wildfly::Resource[/subsystem=datasources/data-source=DB2T] will propagate my refresh event
jbossgha: Debug: Wildfly::Resource[/subsystem=datasources/data-source=DB2T]: The container Wildfly::Datasources::Datasource[DB2T] will propagate my refresh event

But it will barf on subsequent runs.

Error: Failed with: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:"=>{"Operation step-4"=>"WFLYCTL0201: Unknown attribute 'backgroud-validation'"}} for {"address":[],"operation":"composite","steps":[{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"initial-pool-size","value":"10"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"max-pool-size","value":"50"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"min-pool-size","value":"10"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"backgroud-validation","value":true}],"operation-headers":{}}
Error: /Stage[main]/Profile::Mvh_rest_services_app/Wildfly::Datasources::Datasource[DB2T]/Wildfly::Resource[/subsystem=datasources/data-source=DB2T]/Wildfly_resource[/subsystem=datasources/data-source=DB2T]/state: change from {
'allocation-retry' => undef,
'allocation-retry-wait-millis' => undef,
'allow-multiple-users' => false,
'authentication-context' => undef,
'background-validation' => undef,
'background-validation-millis' => undef,
'blocking-timeout-wait-millis' => undef,
'capacity-decrementer-class' => undef,
'capacity-decrementer-properties' => undef,
'capacity-incrementer-class' => undef,
'capacity-incrementer-properties' => undef,
'check-valid-connection-sql' => undef,
'connectable' => false,
'connection-listener-class' => undef,
'connection-listener-property' => undef,
'connection-url' => 'jdbc:db2://10.0.0.1:3110/DB2T',
'credential-reference' => undef,
'datasource-class' => undef,
'driver-class' => 'com.ibm.db2.jcc.DB2Driver',
'driver-name' => 'db2jcc4.jar',
'elytron-enabled' => false,
'enabled' => true,
'enlistment-trace' => false,
'exception-sorter-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter',
'exception-sorter-properties' => undef,
'flush-strategy' => undef,
'idle-timeout-minutes' => undef,
'initial-pool-size' => 10,
'jndi-name' => 'java:/jdbc/DB2T',
'jta' => true,
'max-pool-size' => 50,
'mcp' => 'org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool',
'min-pool-size' => 10,
'new-connection-sql' => undef,
'password' => 'PASS',
'pool-fair' => undef,
'pool-prefill' => undef,
'pool-use-strict-min' => undef,
'prepared-statements-cache-size' => undef,
'query-timeout' => undef,
'reauth-plugin-class-name' => undef,
'reauth-plugin-properties' => undef,
'security-domain' => undef,
'set-tx-query-timeout' => false,
'share-prepared-statements' => false,
'spy' => false,
'stale-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker',
'stale-connection-checker-properties' => undef,
'statistics-enabled' => false,
'track-statements' => 'NOWARN',
'tracking' => false,
'transaction-isolation' => undef,
'url-delimiter' => undef,
'url-selector-strategy-class-name' => undef,
'use-ccm' => true,
'use-fast-fail' => false,
'use-java-context' => true,
'use-try-lock' => undef,
'user-name' => 'USER',
'valid-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker',
'valid-connection-checker-properties' => undef,
'validate-on-match' => undef,
'connection-properties' => undef,
'statistics' => {
'jdbc' => undef,
'pool' => undef
}
} to {
'driver-name' => 'db2jcc4.jar',
'connection-url' => 'jdbc:db2://10.0.0.1:3110/DB2T',
'jndi-name' => 'java:/jdbc/DB2T',
'use-ccm' => true,
'user-name' => 'USER',
'password' => 'PASS',
'initial-pool-size' => '10',
'max-pool-size' => '50',
'min-pool-size' => '10',
'jta' => true,
'enabled' => true,
'driver-class' => 'com.ibm.db2.jcc.DB2Driver',
'valid-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker',
'backgroud-validation' => true,
'exception-sorter-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter',
'stale-connection-checker-class-name' => 'org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker'
} failed: Failed with: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:"=>{"Operation step-4"=>"WFLYCTL0201: Unknown attribute 'backgroud-validation'"}} for {"address":[],"operation":"composite","steps":[{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"initial-pool-size","value":"10"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"max-pool-size","value":"50"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"min-pool-size","value":"10"},{"address":[{"subsystem":"datasources"},{"data-source":"DB2T"}],"operation":"write-attribute","name":"backgroud-validation","value":true}],"operation-headers":{}}
Notice: /Stage[main]/Profile::Mvh_rest_services_app/Wildfly::Datasources::Datasource[DB2T]/Wildfly::Cli[Enable DB2T]/Wildfly_cli[Enable DB2T]: Dependency Wildfly_resource[/subsystem=datasources/data-source=DB2T] has failures: true
Warning: /Stage[main]/Profile::Mvh_rest_services_app/Wildfly::Datasources::Datasource[DB2T]/Wildfly::Cli[Enable DB2T]/Wildfly_cli[Enable DB2T]: Skipping because of failed dependencies

@mafriedel
Copy link
Author

mafriedel commented Jul 18, 2018

Gave up on the wildfly::datasources::datasource since it no longer works with EAP 7.1. Solution for others interested is below.

wildfly::deployment { 'db2jcc4.jar':
  source => 'http://artifacts/support/db2jcc4.jar',
}
$parameters = [
  '--name=DB2T ',
  '--jndi-name=java:/jdbc/DB2T ',
  '--driver-name=db2jcc4.jar ',
  '--connection-url=jdbc:db2://10.0.0.1:3110/DB2T ',
  '--use-ccm=true ',
  '--user-name=USER ',
  '--password=PASS ',
  '--initial-pool-size=10 ',
  '--max-pool-size=50 ',
  '--jta=true ',
  '--enabled=true ',
  '--driver-class=com.ibm.db2.jcc.DB2Driver ',
  '--valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker ',
  '--background-validation=true ',
  '--exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter ',
  '--stale-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker ',
  ]
$parameters_string = join($parameters)
$database_command = "data-source add ${parameters_string}"
exec { 'DB2T':
command => "jboss-cli.sh -u=${wildfly::mgmt_user['username']} -p='${wildfly::mgmt_user['password']}' -c --command='${database_command}'",
  unless  => "grep -c \'DB2T\' ${wildfly::dirname}/${wildfly::mode}/configuration/${wildfly::config}",
  path    => ['/bin', '/usr/bin', '/sbin', "${wildfly::dirname}/bin", "${wildfly::java_home}/bin"],
  require => Wildfly::Deployment['db2jcc4.jar'],
}

@mafriedel
Copy link
Author

Although this works like crap if you ever want to change parameters, so it's not really a solution, more of a stopgap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant