Connecting to HSQL via Ruby and shutting server down - ruby

I'm trying to write a Ruby script to kill a database server on my localhost.
When I run an 'ant hsql' it starts the database (output below) and I have to keep that terminal window open.
Buildfile: /Users/cparaiso/dev/src/testproject-src/build.xml
hsql:
install-parent-pom:
[artifact:install] [INFO] Installing /Users/cparaiso/dev/src/testproject-src/pom.xml to /Users/cparaiso/.m2/repository/org/jasig/portal/uportal-parent/4.0.3/uportal-parent-4.0.3.pom
[touch] Creating /var/folders/8v/1k2gkj412q1_8084x6lvtbqr0000gn/T/jasig/uportal-parent.pom-110044247-marker
[echo] Starting HSQL on 8887
[echo] Using: file:/Users/cparaiso/dev/src/testproject-src/data/uPortal
[java] [Server#6f507fb2]: [Thread[main,5,main]]: checkRunning(false) entered
[java] [Server#6f507fb2]: [Thread[main,5,main]]: checkRunning(false) exited
[java] [Server#6f507fb2]: Startup sequence initiated from main() method
[java] [Server#6f507fb2]: Could not load properties from file
[java] [Server#6f507fb2]: Using cli/default properties only
[java] [Server#6f507fb2]: Initiating startup sequence...
[java] [Server#6f507fb2]: Server socket opened successfully in 10 ms.
[java] [Server#6f507fb2]: Database [index=0, id=0, db=file:/Users/cparaiso/dev/src/testproject-src/data/uPortal, alias=uportal] opened sucessfully in 377 ms.
[java] [Server#6f507fb2]: Startup sequence completed in 388 ms.
[java] [Server#6f507fb2]: 2012-03-07 15:32:25.198 HSQLDB server 2.2.8 is online on port 8887
[java] [Server#6f507fb2]: To close normally, connect and execute SHUTDOWN SQL
[java] [Server#6f507fb2]: From command line, use [Ctrl]+[C] to abort abruptly
My question is how can I shutdown the server without using a kill command in Ruby to kill the process?
If I try to kill the process via kill command I get 'BUILD FAILED' and it gets stuck until I Ctrl+C out. This is not what I want. Any ideas? TIA

I don't know how you issue an SQL statement in Ruby, but if you connect to the database server and issue the SQL statement SHUTDOWN, it will shutdown the server process.

Related

I can't start Apache Nifi

When I run run-nifi.bat it pops up for a split second but then auto closes. I don't really understand this, I just need it for a university class and it hadn't been properly explained, so I'm just trying on my own really.
I get this in my nifi-app.log:
2021-05-29 17:07:30,179 INFO [main] org.apache.nifi.NiFi Launching NiFi...
2021-05-29 17:07:30,450 INFO [main] org.apache.nifi.security.kms.CryptoUtils Determined default nifi.properties path to be 'D:\SYSTEM\Downloads\nifi-1.13.2-bin\nifi-1.13.2\.\conf\nifi.properties'
2021-05-29 17:07:30,454 INFO [main] o.a.nifi.properties.NiFiPropertiesLoader Loaded 188 properties from D:\SYSTEM\Downloads\nifi-1.13.2-bin\nifi-1.13.2\.\conf\nifi.properties
2021-05-29 17:07:30,465 INFO [main] org.apache.nifi.NiFi Loaded 188 properties
2021-05-29 17:07:30,705 INFO [main] org.apache.nifi.BootstrapListener Started Bootstrap Listener, Listening for incoming requests on port 63487
2021-05-29 17:07:30,711 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:576)
at java.base/sun.nio.ch.Net.connect(Net.java:565)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
at java.base/java.net.Socket.connect(Socket.java:645)
at java.base/java.net.Socket.connect(Socket.java:595)
at org.apache.nifi.BootstrapListener.sendCommand(BootstrapListener.java:102)
at org.apache.nifi.BootstrapListener.start(BootstrapListener.java:74)
at org.apache.nifi.NiFi.<init>(NiFi.java:102)
at org.apache.nifi.NiFi.<init>(NiFi.java:71)
at org.apache.nifi.NiFi.main(NiFi.java:303)
2021-05-29 17:07:30,712 INFO [Thread-0] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
2021-05-29 17:07:30,712 INFO [Thread-0] org.apache.nifi.NiFi Jetty web server shutdown completed (nicely or otherwise).
I've tried editing the web properties in the config files in case the default was wrong. Right now it's on, but the errors are the same:
nifi.web.http.host=localhost
nifi.web.http.port=9090
nifi.web.http.network.interface.default=
I have Windows 10 Home Edition.
NiFi requires Java 8 or Java 11 to run. So your environment variables should point to the correct directory with Java 8 or Java 11.
Have you tried setting the JAVA_HOME environment variable? I would recommend checking the config files and telling the configs where to find the Java installation
You might be missing URL ACL
Maybe you can try below command:
netsh http add urlacl url=http://computername:port/ user=username
Source: https://serverfault.com/a/246798/191420

Unable to connect to Metabase h2 DB

I can not initialize the metabase setup, as I am getting error when connecting metabase to h2 db.
I did so far as below
1.Downloaded metabase.jar from here
2.From cmd prompt i executed java -jar metabase.jar
I am getting Below error
04-25 12:03:07 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...
04-25 12:03:07 INFO metabase.db :: Verifying h2 Database Connection ...
04-25 12:03:12 ERROR metabase.driver :: Failed to connect to database: Timed out after 5000 milliseconds.
java.lang.AssertionError: Assert failed: Unable to connect to Metabase h2 DB.
(binding [*allow-potentailly-unsafe-connections* true] (require (quote metabase.driver)) ((resolve (quote metabase.drive
r/can-connect-with-details?)) engine details))
at metabase.db$verify_db_connection.invokeStatic(db.clj:320)
at metabase.db$verify_db_connection.invoke(db.clj:313)
at metabase.db$verify_db_connection.invokeStatic(db.clj:316)
at metabase.db$verify_db_connection.invoke(db.clj:313)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:368)
at metabase.db$setup_db_BANG_.doInvoke(db.clj:362)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at metabase.core$init_BANG_.invokeStatic(core.clj:102)
at metabase.core$init_BANG_.invoke(core.clj:81)
at metabase.core$start_normally.invokeStatic(core.clj:186)
at metabase.core$start_normally.invoke(core.clj:180)
at metabase.core$_main.invokeStatic(core.clj:278)
at metabase.core$_main.doInvoke(core.clj:273)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
04-25 12:03:12 ERROR metabase.core :: Metabase Initialization FAILED: Assert failed: Unable to connect to Metabase h2 D
B.
(binding [*allow-potentailly-unsafe-connections* true] (require (quote metabase.driver)) ((resolve (quote metabase.drive
r/can-connect-with-details?)) engine details))
04-25 12:03:12 INFO metabase.core :: Metabase Shutting Down ...
04-25 12:03:12 INFO metabase.core :: Metabase Shutdown COMPLETE
Initially I didn't get an error. I did everything in metabase. After 2 days, when I tried the same, I am getting this error. Even after deleting everything and tried from start again and also with admin permisions. Nothing worked same error.
Try Opening command prompt with admin credentials and run the below command
java -jar metabase.jar
this is because of your antivirus protects your system to get data from outside. please check firewalls are on. once you turn off. it will work. I have spent almost 2 days to solve this problem
Try with root login: "sudo su - ". I faced the same issue and realised that I wasn't logged in as root user.

Dspace change from postgresql to oracle

Some knows the proccess to install or update dspace with Oracle database, i have problems with my dspace 4.2, i installed with postgresql without any problems, but when y try to change to oracle y have the next error:
build_webapps_wars:
check_geolite:
init_geolite:
[java] 2015-10-23 17:18:58,899 INFO org.dspace.core.ConfigurationManager # Loading system provided config property (-Ddspace.configuration): config/dspace.cfg
[java] 2015-10-23 17:18:58,919 INFO org.dspace.core.ConfigurationManager # Using default log4j provided log configuration. If unintended, check your dspace.cfg for (log.init.config)
[java] Started: 1445638738887
[java] Ended: 1445638744119
[java] Elapsed time: 5 secs (5232 msecs)
[java] 2015-10-23 17:19:04,573 INFO org.dspace.core.ConfigurationManager # Loading system provided config property (-Ddspace.configuration): config/dspace.cfg
[java] 2015-10-23 17:19:04,594 INFO org.dspace.core.ConfigurationManager # Using default log4j provided log configuration. If unintended, check your dspace.cfg for (log.init.config)
[java] 2015-10-23 17:19:30,184 INFO org.dspace.search.DSIndexer # Updating and Cleaning Index
[java] Started: 1445638744638
[java] Ended: 1445638770497
[java] Elapsed time: 25 secs (25859 msecs)
[java] Exception in thread "main" java.lang.NullPointerException
[java] at org.dspace.search.DSIndexer.cleanIndex(DSIndexer.java:604)
[java] at org.dspace.search.DSIndexer.main(DSIndexer.java:507)
BUILD FAILED
/build/dspace-4.3-src-release/dspace/target/dspace-build/build.xml:968: Java returned: 1
Total time: 14 minutes 43 seconds
I Use oracle 11g XE , and i have the same problem testing with an oracle 11g EnterPrise Edition, my dspace.cfg is correctly with de db.name ant the driver with oracle, ifsomeone than can helpme with the error please.

Access denied for Sonar database

I encounter an 'Access denied' error when connecting to the Sonar database. Below the trace:
[workspace] $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar/bin/sonar-runner -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://tridev002.xxxxx.net:3306/sonar ******** ******** -Dsonar.host.url=http://tridev002.xxxx.net:9000/ ******** ******** "-Dsonar.projectBaseDir=/var/lib/jenkins/jobs/Test Sonar/workspace"
SonarQube Runner 2.4
Java 1.7.0_72 Oracle Corporation (64-bit)
Linux 3.2.0-4-amd64 amd64
INFO: Runner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /var/lib/jenkins/jobs/Test Sonar/workspace/.sonar
INFO: SonarQube Server 4.5.1
13:44:54.656 INFO - Load global referentials...
13:44:54.825 INFO - Load global referentials done: 173 ms
13:44:54.833 INFO - User cache: /var/lib/jenkins/.sonar/cache
13:44:54.841 INFO - Install plugins
13:44:54.920 INFO - Install JDBC driver
13:44:54.926 INFO - Create JDBC datasource for jdbc:mysql://tridev002.xxxxx.net:3306/sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1.494s
Final Memory: 8M/241M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to connect to database
ERROR: Caused by: Cannot create PoolableConnectionFactory (Access denied for user 'jenkins-sonar'#'tridev002.xxxxx.net' (using password: YES))
ERROR: Caused by: Access denied for user 'jenkins- sonar'#'tridev002.xxxxx.net' (using password: YES)
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
In the Jenkins configuration the Database URL, Database login en Database password are set correctly. With this URL and credentials it is possible to log in via a mysql command line client and we can view the sonar database tables.
We also checked the permissions of the database user and these are set correctly.
We checked the sonar.properties file and everything is commented out.
If we add sonar.jdbc.username and sonar.jdbc.password to the project properties, the connection with the database is successfull. But the password is in plain text then, which is unadvisable.
Does anyone know why the credentials of the system configuration is not used? And what is the solution? Is this a bug in SonarQube?

Selenium Grid - Remote Controls always being unregistered by hub

I have Selenium Grid 1.0.8 running well with the hub and several remote controls on the same machine. My testNG tests all run successfully.
When I start a remote control on a different machine, everything initially appears to be fine. The hub console shows the remote control to be available with the default environment "*firefox".
However, when I run the tests (still on the hub machine), the remote controls on the other box never work properly. They keep getting deregistered from the hub.
I've disabled the firewalls and I can ping betweeen the two boxes. Has anyone encountered similar issues?
The Remote Control Log:
[java] 21:34:19.479 WARN - Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539 does not have us as registered
[java] 21:34:49.496 INFO - Checking connection to hub...
[java] 21:34:49.496 INFO - Ping Hub at http://192.168.1.129:4444/heartbeat?host=localhost&port=5539
The hub log:
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[java] Jun 16, 2011 9:39:52 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
[java] INFO: Retrying request
Are you passing the correct host value when you register your node? In order to deal with proxies properly, the node must provide a routable hostname to that node when registering with the hub. Without this value, the hub will be unable to communicate with the node and will unregister it.

Resources