Calling liquibase commandline from Cygwin - bash

Trying to run a call to liquibase from command line (bash script). This works if I run it on a server (Red hat linux) but i get an error if I run it from a cygwin prompt:
java -cp ../liquibase-core-3.1.1:../ojdbc6-11.2.0.3.jar liquibase.integration.commandline.Main --driver=oracle.jdbc.OracleDriver \
--changeLogFile=database/master.xml --url=${schema_url} --username=${schema_username} --password=${schema_password} \
--contexts=${schema_context} migrate
I get the error:
Error: Could not find or load main class liquibase.integration.commandline.Main
Can't see why.

Found a way around the problem. Created a liquibase.properties file with the information,
url: <url>
username: <username>
password: <password>
contexts: global,dev
driver: oracle.jdbc.OracleDriver
classpath: ../ojdbc6-11.2.0.3.jar
changeLogFile: database/master.xml
And called the liquibase CLI using
java -jar ../liquibase-core-3.1.1.jar --defaultsFile=../foo/fum/liquibase.properties migrate
This worked fine both on the server and on cygwin.

The issue arises because Java expects a windows style path but the liquibase script issues a unix style path. See also the discussion how to run Java from cygwin. The proposed solution is to fix it by means of cygpath.
The root case is something different though. If you look into the startup script for liquibase you see the following piece of code
# build classpath from all jars in lib
if [ -f /usr/bin/cygpath ]; then
CP=.
for i in "$LIQUIBASE_HOME"/liquibase*.jar; do
i=`cygpath --windows "$i"`
CP="$CP;$i"
done
for i in "$LIQUIBASE_HOME"/lib/*.jar; do
i=`cygpath --windows "$i"`
CP="$CP;$i"
done
else
if [[ $(uname) = MINGW* ]]; then
CP_SEPARATOR=";"
else
CP_SEPARATOR=":"
fi
CP=.
for i in "$LIQUIBASE_HOME"/liquibase*.jar; do
CP="$CP""$CP_SEPARATOR""$i"
done
for i in "$LIQUIBASE_HOME"/lib/*.jar; do
CP="$CP""$CP_SEPARATOR""$i"
done
fi
That is the script checks for the existence of cygpath and will fix the issue if it finds it. Chances are that you are lacking cygpath.
If which cygpath results in /usr/bin/cygpath then everything should work as expected. Otherwise you have found the root cause.
This raises the question why cygpath is missing and how to get it. In my case I removed my (outdated) installation of git / gitbash and installed the newest version. This came with an up to date gitbash which included cygpath as desired.

The problem is that Java on CYGWIN has problems to resolve PATHs. To make this add
cygwinpath -wp
To fix this problem replace
java -cp ../liquibase-core-3.1.1:../ojdbc6-11.2.0.3.jar
with
java -classpath \`cygpath -wp ../liquibase-core-3.1.1:../ojdbc6-11.2.0.3.jar\`
Remember to surround cygwint -wp <path> with this mark `

check the main class jar file "liquibase.jar" in the main

Related

can't run integrated WebLogic 12.2.1.4 server on Windows 10

I have windows 10 machine, and JDeveloper 12.2.1.4.0 , when i try to run the weblogic server for the first time i get this error :
Adding environment variable to WLST script USER_MEM_ARGS = -Xms32m -Xmx1024m -XX:MaxPermSize=384m
Log File: C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\o.j2ee.adrs\BuildDefaultDomain.log
Label: JDEVADF_PT.12.2.1.4.0_GENERIC_190911.2248.S
Product Home: D:\Oracle\Middleware\BPM_12.4\jdeveloper\jdev\
Domain: C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\DefaultDomain
BuildDefaultDomain1.py 2020-06-05 09:14:45
cmd.exe /c ""D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin\wlst.cmd" "C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\o.j2ee.adrs\BuildDefaultDomain1.py""
Cannot run program "cmd.exe" (in directory "D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin"): Malformed argument has embedded quote: "D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin\wlst.cmd" "C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\o.j2ee.adrs\BuildDefaultDomain1.py"
java.io.IOException: Cannot run program "cmd.exe" (in directory "D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin"): Malformed argument has embedded quote: "D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin\wlst.cmd" "C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\o.j2ee.adrs\BuildDefaultDomain1.py"
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at oracle.jdevimpl.adrs.weblogic.wlst.ScriptRunnerImpl.runScript(ScriptRunnerImpl.java:106)
at oracle.jdevimpl.adrs.weblogic.builder.DomainScriptRunnerImpl.runScript(DomainScriptRunnerImpl.java:146)
at oracle.jdevimpl.adrs.weblogic.builder.DefaultDomainBuilder.createDomain(DefaultDomainBuilder.java:606)
at oracle.jdevimpl.adrs.weblogic.builder.DefaultDomainBuilder.build(DefaultDomainBuilder.java:274)
at oracle.jdevimpl.adrs.weblogic.builder.DefaultDomainBuilder$1.run(DefaultDomainBuilder.java:225)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Caused by: java.lang.IllegalArgumentException: Malformed argument has embedded quote: "D:\Oracle\Middleware\BPM_12.4\oracle_common\common\bin\wlst.cmd" "C:\Users\OSMOHAME\AppData\Roaming\JDeveloper\system12.2.1.4.42.190911.2248\o.j2ee.adrs\BuildDefaultDomain1.py"
at java.lang.ProcessImpl.needsEscaping(ProcessImpl.java:279)
at java.lang.ProcessImpl.createCommandLine(ProcessImpl.java:202)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:436)
at java.lang.ProcessImpl.start(ProcessImpl.java:140)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
i did some research and most people tell that the solution in the following url is fixing the problem
http://unversioned.blogspot.com/2015/12/jdeveloper-12c-generic-installer-cannot-create-weblogic-domain.html
but the problem is when i open the javashell.py file , i don't find an entry for
_osTypeMap =
it Doesn't Exist in the file
Also , another solution the people said it worked is by adding this line
Djdk.lang.Process.allowAmbiguousCommands=true
but they didn't said where to add it and what is the exact steps !
There is a known issue with JDeveloper, WLS 12.2.1.4 and JDK 8 opened at My Oracle Support : Bug 30670839 : INTEGRATED WLS CANNOT BE CREATED WHEN USING JDK1.8.0_231
There is no patch available for now but you can try the workaround provided in the bug note : Revert back to JDK shipped with JDeveloper
If we see, problem is with the type of command that JDeveloper executes to start the weblogic instance is old and therefore does not work correctly, however below solution is working. It did solve the issue in my machine
We must modify this file:
C:<JDEVELOPER Install Path>\ide\bin\ide.conf
Add the following line:
AddVMOption -Djdk.lang.Process.allowAmbiguousCommands = true
Post modification, save the file.
Restart the Jdeveloper, compile and launch the weblogic server.

oracledb_exporter binary files

There is Prometheus Oracle database exporter https://github.com/iamseth/oracledb_exporter
Under Running section, "/path/to/binary -l log.level error -l web.listen-address 9161" is not clear me.
Here I am not getting what is "/path/to/binary" mean, is it oracle client or /usr/bin/ path, or which file I need to replace with? I have RHEL7.3
After setting DATA_SOURCE_NAME is set correctly and running below commman, its throwing error (no such cmd - /path/to/binary)
/path/to/binary -l log.level error -l web.listen-address 9161
Please refer ZIP/clone from location :-https://github.com/iamseth/oracledb_exporter
Oracle database exporter should start and fetch required values/status from oracle database.
In case you're still looking for the answer:
The easiest way is to download the pre-compiled version. Otherwise you will need to compile it yourself: https://github.com/iamseth/oracledb_exporter/releases
Download the version you want e.g. 'oracledb_exporter.0.2.2.linux-amd64.tar.gz' and unzip it.
You will get a folder 'oracledb_exporter.0.2.2.linux-amd64' which conatins two files:
default-metrics.toml
oracledb_exporter
The second one is the one you need to execute:
-> /path_to/oracledb_exporter.0.2.2.linux-amd64/oracledb_exporter log.level error web.listen-address 9161

--grpc_out: protoc-gen-grpc: Plugin failed with status code 1 on osx. (Java)

I am following a tutorial about using grpc and I am supposed to use a plugin to generate source code but I am stuck on how to use the --grpc_out and --plugin flag.
Below are the current challenges.
The protocol generator downloaded from https://search.maven.org/ as in the tutorial is an executable file for osx operating system https://search.maven.org/search?q=a:protoc-gen-grpc-java. This is the first confusion.
If I dont use these plugin flags (--plugin,--grpc_out) my code is generated okay with this command
protoc -I /proto --java_out /hello/grpc/grpc/revamp/services
/proto/messages.proto
This above works okay
Adding the flags, with the downloaded plugin from confusion 1 throws this error with this command;
protoc -I /proto --java_out /hello/grpc/grpc/revamp/services /proto/messages.proto --grpc_out /hello/grpc/grpc/revamp/services --plugin=protoc-gen-grpc=/proto/lib/protoc-gen-grpc-java-1.19.0-osx-x86_64.exe
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
Has anyone used this plugin on osx?, can anyone help see what I am doing wrong.
Thanks in advance
To resolve this, first I removed the .exe extension from the file downloaded from maven,
then allow the file to be executable by running the following command
chmod +x protoc-gen-grpc-java
After this the query worked okay. (Special thanks from the #author of the Course
Michael Van Sickle)

How to find interface/ftdi/esp32_devkitj_v1.cfg in procedure 'script'?

I'm trying to debug esp32 with ft2232d debugger , however at the openocd running script i'm getting this below mentioned error.
./openocd -s share/openocd/scripts -f ../interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg
Open On-Chip Debugger 0.10.0+dev-00703-g21687eb (2019-03-04-16:30)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:63: Error: Can't find ../interface/ftdi/esp32_devkitj_v1.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 63
Now, i understand that my interface directory is not finding the esp32 cfg file but i searched and there is no such file.
Also Building openocd from the scatch has let to no bin files present in the main directory but these files are found in src folder.
Thanks for your help.
If you're using Eclipse, try wrapping the file path of your config in double quotes. I had a similar error, and changing the argument to -f "interface/stm32f429.cfg" seemed to fix that error for me.

How to run FHIR Validator (java jar)

I had downloaded "Validation Pack" from http://www.hl7.org/implement/standards/fhir/downloads.html.
After unzip 'validator.zip' and read 'readme.txt', I tried to run 'org.hl7.fhir.validator.jar' file on Windows Command Prompt.
java -jar org.hl7.fhir.validator.jar mysourcefile.xml
I encountered the following error:
java.lang.Exception: Unknown command 'mysourcefile.xml' at org.hl7.fhir.instance.test.ToolsHelper.main(ToolsHelper.java:77)
java.lang.ArrayIndexOutOfBoundsException: 1 at org.hl7.fhir.instance.test.ToolsHelper.main(ToolsHelper.java:81)
Why is 'mysourcefile.xml' an unknown command? Please help. Thanks!
The jar file is set up to load the wrong class. The correct class is org.hl7.fhir.instance.validation.Validator.
You can name that class explicitly when you run the jar, and you'll get the help, which will say:
Usage: FHIRValidator.jar [source] (-defn [definitions]) (-output [output]) (-noxslt)
you'll got more documentation as well.
Else you edit the manifest inside the jar and change the main class.
If you want to validate your resource against the base specification run the following command:
java -jar org.hl7.fhir.validator.jar your-fhir-resource.xml -defn validation.zip
If you want to validate your resource against a profile (structure definition) run the following command:
java -jar org.hl7.fhir.validator.jar your-fhir-resource.xml -defn validation.zip -profile your-structure-definition.xml
Updated docmentation
Validation Instructions:
You need java 1.7 jre or jdk installed
Download the validator tool and the validation pack (java executable, and dictionary of FHIR definitions, respectively), and unzip the validator (but not the validation pack)
Execute the validator with the following command line: java –jar org.hl7.fhir.validator.jar [source] (-defn [definitions]) (-profile [profile]) (-output [output]) where:
[source] is a file name or url of the resource or bundle feed to validate
 [definitions] is the file name or url of the validation pack
(validation.zip). Default: get it from inside the jar file
[profile] is an optional filename or URL for a specific profile to
validate a resource against. In the absence of this parameter, the
resource will be checked against the base specification using the
definitions.
[output] is a filename for the results (OperationOutcome). Default: results are sent to the std out.
Note: at this time, the validator is only able to validate XML resources, not JSON ones.
Here’s a windows batch file that will do all this:
REM get the validator and unzip it
wget.exe http://hl7-fhir.github.io/validator.zip
7z.exe x validator.zip
7z.exe x saxon.zip
REM Get the validation source file (dictionary)
wget.exe http://hl7-fhir.github.io/validation-min.zip
REM get an example to validate
wget.exe http://ec2-54-87-74-90.compute-
1.amazonaws.com/open/Patient/1234 -O daf-patient.xml
REM validate it. The DAF profile will be loaded out of the
definitions in validation-min.zip
java -jar org.hl7.fhir.validator.jar daf-patient.xml -defn
validation-min.zip -profile
http://hl7.org/fhir/StructureDefinition/patient-daf-dafpatient
pause
The documentation needs updating. Try:
java -jar org.hl7.fhir.validator.jar round mysourcefile.xml output.xml
But I don't think the DSTU validation.jar is applying the XSD or Schematrons. If this is your goal, then you can use other tools.
For XSD:
xmllint --noout --schema <XSD_FILE> mysourcefile.xml
For Schematron, using probatron4j
java -jar probatron.jar mysourcefile.xml fhir-atom.sch

Resources