jdbc driver class not loaded when connecting to SAP HANA DB - hana

I have below logstash.conf which connects to SAP HANA DB
input {
jdbc{
jdbc_connection_string => "jdbc:sap://<host>:<port>"
jdbc_driver_library => "/app/tomcat/jdbc_lib/ngdbc-2.4.61.jar"
jdbc_driver_class => "com.sap.db.jdbc.Driver"
jdbc_user => "xxx"
jdbc_password => "xxx"
statement => "SELECT coumn1 FROM table1 "
use_column_value => true
tracking_column => "NOMINEE_ID"
tracking_column_type => numeric
}
}
But when I starting logstash.conf, below error occurs. Does anyone have idea?
[2019-10-15T13:15:48,683][ERROR][logstash.javapipeline ] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"xxx", use_column_value=>true, tracking_column=>"NOMINEE_ID", jdbc_password=><password>, statement=>"SELECT NOMINEE_ID, NOMINATION_ID, NOMINEE_USER_ID, READINESS, CREATED_DATE, CREATED_BY FROM SFBIZX3_TALSHELLEYH.SM_NOMINEE", tracking_column_type=>"numeric", jdbc_driver_library=>"/app/tomcat/jdbc_lib/ngdbc-2.4.61.jar", jdbc_connection_string=>"jdbc:sap://<host>:<port>", id=>"4a9ee1ee41b1f9376ca7e0c2d199233d62c0e09cd555272d527de0745ee102c8", jdbc_driver_class=>"com.sap.db.jdbc.Driver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_212f3f66-0328-42f0-87e0-7b078904b8e9", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>0}, last_run_metadata_path=>"C:\\Users\\I073341/.logstash_jdbc_last_run", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: com.sap.db.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Exception: LogStash::ConfigurationError
Stack: C:/elkstack/logstash-7.0.1/logstash-7.0.1/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:163:in `open_jdbc_connection'

Related

UnSupportedEntityException when trying to create/render records containing slug extension

I am trying to implement slugs in my bundle, but when i try to create a record and run my message consumer i get the following error:
Unexpected exception occurred during Direct URL generation ["exception" => Oro\Bundle\RedirectBundle\Exception\UnsupportedEntityException { …}] ["processor" => "Oro\Bundle\RedirectBundle\Async\DirectUrlProcessor","message_id" => "oro.6256de2124b630.96491198","message_body" => ["createRedirect" => true,"id" => [3],"class" => "Phpro\OroBundleBlogBundle\Entity\BlogPostCategory"],"message_properties" => ["oro.message_queue.client.topic_name" => "oro.redirect.generate_direct_url.entity","oro.message_queue.client.queue_name" => "oro.default","oro.security.token" => "organizationId=1;userId=1;userClass=Oro\Bundle\UserBundle\Entity\User;roles=ROLE_ADMINISTRATOR"],"message_headers" => ["content_type" => "application/json","message_id" => "oro.6256de2124b630.96491198","timestamp" => "1649860129","priority" => "2"],"elapsed_time" => "34 ms","memory_usage" => "107.57 MB"]
The slugs are stored, but the use of the get_slug_urls_for_prototypes twig filter results in the following error An exception has been thrown during the rendering of a template (""). Again because of the UnsupportedEntityException
Am i missing some configuration?
As mentioned in the OroCommerce documentation the entity must implement the interface to support slugs. Make sure you fulfilled this requirement.

Unable to run migrations on GCP with CakePHP 3.8

I am trying to set up my CakePHP 3.8 project on a GCP "Compute Engine" VM.
I have set up my app.php to use the following DB configuration:
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'user',
'password' => 'password',
'database' => 'dbname',
'prefix' => '',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'log' => false,
'flags' => [
PDO::MYSQL_ATTR_INIT_COMMAND => "SET ##SESSION.sql_mode='';",
// uncomment below for use with Google Cloud SQL
PDO::MYSQL_ATTR_SSL_KEY => CONFIG.'ssl/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => CONFIG.'ssl/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => CONFIG.'ssl/server-ca.pem',
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false
],
'cacheMetadata' => true,
'log' => false,
My problem happens when I try to run migrations. The site works just fine with the above configuration, however, if I run
$> php bin/cake.php migrations migrate
I get a slew of errors saying that it cannot connect, access denied for user#host.
If I add
'ssl_key' => CONFIG .'ssl/client-key.pem',
'ssl_cert' => CONFIG . 'ssl/client-cert.pem',
'ssl_ca' => CONFIG . 'ssl/server-ca.pem',
I get an error:
Caused by: [PDOException] PDO::__construct(): Peer certificate CN=`gcpname:gcpserver' did not match expected CN=`111.111.111.111' in /var/www/mydomain.com/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 79
I guess this is because the migrations plugin still doesn't pass the flags or custom mysql_attr_* options over to the Phinx connection configuration, see this issue:
https://github.com/cakephp/migrations/issues/374
I don't think there's much that can be done here, other than adding support for flags / attribute options, or using Phinx directly (ie without the Migrations plugin).
I've pushed a PR that would add support for driver specific flags, you might want to give it a try and comment on the issue or the PR whether it works for you (it's for CakePHP 4.x (Migrations 3.x), I'll backport it for CakePHP 3.x (Migrations 2.x) in case it's being accepted):
https://github.com/cakephp/migrations/pull/478

Connect to another database if one is not available

I would like my site to connect to another database with the same credentials as the current one if the current one is unavailable or not found.
You can try a connection by using a query and if it fails change the connection.
try {
User::find(1); // or any other SQL query you want to check
} catch (\Exception $e) {
config(['database.connections.data' => array( // you don't have to add the connection runtime but it can be done.
'driver' => 'sqlsrv',
'host' => $connection['Database_Server'],
'database' => $connection['Database_Name'],
'username' => $connection['Database_User'],
'password' => $connection['Database_Pass'
)]);
DB::setDefaultConnection('data'); // change the default connection

How do I configure rabbitmq queue via puppet

I'm trying to install rabbitmq via puppet. I'm using the puppetlabs-rabbitmq module. It also has section to configure queues and exchanges, which are Native Types. I can't figure out how to use these native types.
My code for rabbitmq installation:
class rabbitmq-concrete{
$tools = ["vim-enhanced","mc"]
package { $tools: ensure => "installed" }
$interface = "enp0s8"
$address = inline_template("<%= scope.lookupvar('::ipaddress_${interface}') -%>")
class { 'rabbitmq':
config_cluster => true,
cluster_nodes => ['rml01', 'rml02'],
cluster_node_type => 'disc',
manage_repos => true,
node_ip_address => $address,
erlang_cookie => 'rmq_secret',
}
rabbitmq_exchange { "logging#${node_name}":
type => 'topic',
ensure => present,
}
rabbitmq_queue { "logging#${node_name}":
durable => true,
auto_delete => false,
arguments => {
x-message-ttl => 123,
x-dead-letter-exchange => 'other'
},
ensure => present,
}
rabbitmq_binding { "logging#logging#${node_name}":
destination_type => 'logging',
routing_key => '#',
arguments => {},
ensure => present,
}
}
include rabbitmq-concrete
I get following error:
==> rml01: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rabbitmq_queue at /tmp/vagrant-puppet-2/manifests/site.pp:35 on node rml01
==> rml01: Wrapped exception:
==> rml01: Invalid resource type rabbitmq_queue
==> rml01: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type rabbitmq_queue at /tmp/vagrant-puppet-2/manifests/site.pp:35 on node rml01
Note: When I leave out these native types, rabbit installation works well.
How do I use Native Types to configure rabbitmq_queue, rabbitmq_exchange and rabbitmq_binding ?
Do you have the required prerequisites? You need the following packages from the Forge:
puppetlabs/stdlib
stahnma/epel
nanliu/staging
garethr/erlang
To your manifest I added:
include epel
include staging
class { 'erlang': epel_enable => true}
Your question is dated 13th Feb, yet looking on the Puppet Forge those features were only added to that module in the most recent release on 10th March in version 5.1.0.
Full changelog => https://forge.puppetlabs.com/puppetlabs/rabbitmq/changelog
Abridged:
"2015-03-10 - Version 5.1.0
Summary
This release adds several features for greater flexibility in configuration of rabbitmq, includes a number of bug fixes, and bumps the minimum required version of puppetlabs-stdlib to 3.0.0.
Features
Add rabbitmq_queue and rabbitmq_binding types"

Spring jms listener configuration - Websphere MQ resource adapter 7.5 - JBoss EAP 6.2

I'm looking for some help.
Context:
Application configuration,
JBoss EAP 6.2,
WebSphere MQ 7.5 Resource Adapter,
Spring
Current Status:
Application manages to send messages just fine, but unless we "boost" the number of connections related to message consumption, we have a warning message popping up in the logs:
WARN [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-28) Setup of JMS message listener invoker failed for destination 'jms/workflowInputQueue' - trying to recover. Cause: MQJCA1018: Only one session per connection is allowed.
Research result:
After some research, I identified the root cause from the following 2 links,
and is referenced here Removal of internal Connection Pooling for WebSphere MQ Classes
and here IBM MQ - Configuring the resource adapter for inbound communication
The root cause of the issue can be summarized by this quote:
For Inbound Communications, the JMS Connection Pools and JMS Session Pools are implemented by the WebSphere MQ JCA resource adapter.
What I'm looking for:
I don't have prior Spring knowledge, my tasks usually were focused on Linux/Unix Administration, Application Server setup and configuration.
I'd like:
A sample configuration for a jms listener (MDP), with some indication of what can be configured in JBoss, and what cannot and should be configured in spring or other xml configuration (Activation Spec being an example
Additional sources I can read to better understand the spring configuration
Some explanation on how to reference the resource adapter in the Spring configuration, while the wmq.jmsra.rar resource adapter has been uploaded in the JBoss Content Repository, and assigned to the same server group as the application.
The ideal form of the solution:
A sample Spring configuration (xml based), with Resource adapter, ActivationSpec, MessageEndpointListener or (jca-?)listener-container, that would provide a good overview of the configuration necessary
Possibly explanations on how to define all this configuration in JBos, and make reference to it in spring through jndi lookup.
I already asked this question through the JBoss Community forum but haven't received much feedback
Current problematic configuration:
/profile=myapp/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/connection-definitions=myappListenerQCF:read-resource(include-defaults=true,recursive=true)
{
"outcome" => "success",
"result" => {
"allocation-retry" => undefined,
"allocation-retry-wait-millis" => undefined,
"background-validation" => false,
"background-validation-millis" => undefined,
"blocking-timeout-wait-millis" => undefined,
"class-name" => "com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl",
"enabled" => true,
"flush-strategy" => "FailingConnectionOnly",
"idle-timeout-minutes" => undefined,
"interleaving" => false,
"jndi-name" => "java:/jms/myappListenerQCF",
"max-pool-size" => "100",
"min-pool-size" => "100",
"no-recovery" => false,
"no-tx-separate-pool" => false,
"pad-xid" => false,
"pool-prefill" => "true",
"pool-use-strict-min" => "true",
"recovery-password" => undefined,
"recovery-plugin-class-name" => undefined,
"recovery-plugin-properties" => undefined,
"recovery-security-domain" => "wsmq_security",
"recovery-username" => undefined,
"same-rm-override" => undefined,
"security-application" => false,
"security-domain" => "wsmq_security",
"security-domain-and-application" => undefined,
"use-ccm" => true,
"use-fast-fail" => false,
"use-java-context" => true,
"use-try-lock" => undefined,
"wrap-xa-resource" => true,
"xa-resource-timeout" => undefined,
"config-properties" => {
"hostName" => {"value" => "mqserverhostname"},
"port" => {"value" => "1520"},
"channel" => {"value" => "channelname"},
"transportType" => {"value" => "CLIENT"},
"queueManager" => {"value" => "qmname"}
}
}
}
/profile=myapp/subsystem=resource-adapters/resource-adapter=wmq.jmsra.rar/admin-objects=workflowInputQueue:read-resource(include-defaults=true,recursive=true)
{
"outcome" => "success",
"result" => {
"class-name" => "com.ibm.mq.connector.outbound.MQQueueProxy",
"enabled" => true,
"jndi-name" => "java:/jms/workflowInputQueue",
"use-java-context" => true,
"config-properties" => {"baseQueueName" => {"value" => "QUEUE.IN"}}
}
}
Also worth noting that there is another post on Stack Overflow entitled "Spring JMS and WebSphere MQ", which covers at least partly the subject, but not at all the jboss aspect.
I'd favor being able to push most of the configuration at jboss level and just look it up in Spring if possible.
Thanks in advance for all the input the community could provide