Datasource not working in JBoss 7.2 - datasource

When I create a datasource, a service restart is required to make it work, regardless of the method used to create it (standalone.xml, JBoss CLI, JBoss Administration Console). Attached is the procedure I have written for my team (exported from our Wiki space). The datasource gets created successfully, but when I test the connection, I get this:
From JBoss Administration Console
Unknown error
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "dsMyApp")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010442: failed to match pool. Check JndiName: java:/dsMyApp",
"rolled-back" => true,
"response-headers" => {"process-state" => "reload-required"}
}
From JBoss CLI
JBAS010440: failed to invoke operation: JBAS010442: failed to match pool. Check JndiName: java:/dsMyApp
If I restart the JBoss server, the datasource works fine (server, port, username and password are all correct).
Any thoughts?
Thank you

The Quick Answer: YES, restarting makes a reload and then activates the datasource
I suggest you doing a reload with jboss-cli (It´s the quickest way)
I´ve created all my datasources with jboss-cli and I always need to
perform this action to allow them to work. After the reload, the datasource connection can be tested.
/opt/wildfly/bin/jboss-cli.sh --connect --controller=192.168.119.116:9990 --commands="reload --host=master"
Hope it helps

Related

Database proxy in karate

I am using karate framework for my API testing in our organization. I am able to execute my project in local where DB connections are successful, when i execute in cloud jenkins we are getting below error
Error : Failed to obtain JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
DB class used: https://github.com/intuit/karate/blob/master/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java
Do we have any option to set proxy for DB only, i have also gone through proxy setup in karate-config.js like karate.configure('proxy', { uri: 'http://my.proxy.host:8080', username: 'john', password: 'secret' ,nonProxyHosts:['http://example.com'] }. This is setting up proxy to my API and not for DB instance.
I am also trying to check whether my jenkins server firewall is blocking to create a connection to my db.
Any help from karate framework creators or implementer's?
whether my jenkins server firewall is blocking
That is most likely the case, nothing Karate (or anyone associated with it) can do here to help.
Also please read this: https://stackoverflow.com/a/52078427/143475

Spring Cloud Config Basic Security throwing 401 error

I have following configuration on server side:
server:
port: 8888
spring:
profiles:
active: native
cloud:
config:
server:
native:
search-locations: "classpath:/config"
security:
user:
name: test
password: test
And following configuration on client side:
spring:
cloud:
config:
fail-fast: true
profile: "${spring.profiles.active}"
uri: "${SPRING_CLOUD_CONFIG_URI:http://localhost:8888/}"
username: test
password: test
I can successfully access properties from browser using user/pwd as test/test, but when my client tries to fetch it failed with 401 error:
INFO 7620 --- [5cee934b64bfd92] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
WARN 7620 --- [5cee934b64bfd92] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: 401 null
I tried setting the log level for spring cloud to DEBUG but nothing additional got logged, so I have no clue why I'm getting a 401 from client while I can access properties successfully via browser using the same credentials.
I've also tried removing the security from server and client and it worked perfectly, which means rest of the configurations are quite ok. But then the question is, what am I overlooking when I apply basic security and why it is not working and throwing a 401 instead?
Try checking these configurations:
spring.cloud.config.username
spring.cloud.config.password
Both properties should be defined at bootstrap.properties (not application.properties)
Please check if the way you are specifying profile name is correct and if it is getting resolved properly in Java code. You can implement CommandLineRunner and print active profiles from Environment variable.
If you specified property spring.profiles.active as native in pom.xml, you can resolve it in application/yaml file as #spring.profiles.active#
If you specified property file as VM argument, then it should work with current implementation.
If you did not specify spring.profiles.active in pom or VM argument, it will resolve to default profile, not native profile. Profile in config client and config server should be same.
Yes we have to use bootstrap properties because When the Spring Cloud application starts, it creates a bootstrap context. The bootstrap context is searching for a bootstrap.properties or a bootstrap.yaml file, whereas the application context is searching for an application.properties or an application.yaml file. The bootstrap context is the parent context for the main application

Unable to connect to IBM Mobile first 7.1 server from remote machine

Am trying to build a simple mobile first 7.1 application deployed on the windows server (Liberty profile). Am using the below code in the main.js file
WL.Client.connect({
onSuccess: function () {
console.log("Connected to MFP");
WL.Client.checkForDirectUpdate();
},
onFailure: function (f) {
console.log("Failed to connect to MFP, not sure what to do now.", f);
}
});
It is giving me the below error in client side.
Failed to connect to MFP, not sure what to do now.
class {status: 404, errorCode: "UNEXPECTED_ERROR", errorMsg: "The
server was unable to process the request from the application. Please
try again later.", invocationContext: undefined}
Note : The same setup works fine in mobile first server deployed in eclipse.
Steps I tried:
checked wlclient.properties which has correct values
tried to call the remote machine mfpconsole url from mobile and its works fine.
enabled trace logs logging
traceSpecification="com.ibm.puremeap.*=all:com.ibm.worklight.*=all:com.worklight.*=all"
but its logging any exception.

ZF2 project not working on virtual host

I have a project which is in zf2.
It runs properly on all other systems other than mine.I have checked the virtual host is running properly for other projects on my system.
when I hit xyx.loc it redirects properly but when I hit xyz.loc/user it gives error
An error occurred
An error occurred during execution; please try again
later.
Though I have enable error reporting.
I am not able to figure out whether its apache error or php error or zf2 error or something else.
The project uses ZF\Apigility
The same folder works on other systems very well.
This is the default error template message. ZF2 is catching any exceptions and hiding them from you due to the configuration settings.
Ensure you have the following configuration.
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
],

How to fix PDO sqlsrv connection timeout in Laravel?

developer!
I'm using Laravel framework and I need to connect to MS SQL 2014 Express database. I've made all the proper configurations in .env (and I even tried tried to put connection parameters straight away to the database.php config) but on the first request i'm always getting timeouted with error:
PDOException in Connector.php line 55:
SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
After the timeout I always get this php fatal:
FatalErrorException in Connector.php line 55
Invalid handle returned.
As a dev tools I'm using XAMPP, and when I'm restarting apache server, sometimes I can establish connection successfully, but only in 1 out of 20-30 tries.
Laravel is using PDO driver, so i tried to use sqlsrv_connect() - and it worked! No errors, everything is fine.
Can somebody help me configure PDO to work? Laravel only uses PDO driver, so I can't just switch to sqlsrv_connect.
I had this problem running on my local machine. I restarted the laravel server and ensured that the ms sql localdb was running and the problem resolved it self.
I had the same error.
After removing the
host // DB_HOST entries from your .env-File and from your config/database.php it worked for me.
What I did for connection are
Installed the correct version of sqlsrv dlls.
Updated doctrine dbal package in Laravel.
My database configuration is below
'sqlsrv3' => [
'driver' => 'sqlsrv',
'host' => '<host-name>',
'database' => '<database-name>',
'username' => '<your-username>',
'password' => '<your-password>',
]
After one day of search in this problem, I found that the problem in DB_PORT, when pass port number 1433 the problem happen, so leave it empty, if you change it in .env, change it like this:
DB_CONNECTION=sqlsrv
DB_HOST=YourHostName
DB_PORT=
DB_DATABASE=YourDBName
DB_USERNAME=YourDBUser
DB_PASSWORD=YourDBPassword
DB_TRUST_SERVER_CERTIFICATE=true
Or if you change it on config/database.php, change it like this:
'sqlsrv' => [
// ...
'port' => env('DB_PORT', null), // <<<< see here
],
Try it :)
Had the same error, turns out it was my password that was wrong. Do confirm you have the right values.
DB_HOST={youservername}.database.windows.net
DB_DATABASE={dbname}
DB_USERNAME={username}
DB_PASSWORD={yourpassword}
DB_PORT=1433
If it doesn't fix do reset the password and try again