OCI CLI fails to load default profile from config file even if I have proper default profile - oracle-cloud-infrastructure

When I run any oci cli command I'm getting below error:
ERROR: Profile '<DEFAULT>' not found in config file C:\Users\user1\.oci\config
Below is my config file for OCI CLI:
[DEFAULT]
user=<admin user ocid>
fingerprint=<fingerprint>
key_file=<path/to/private/key>
tenancy=<tenancy ocid>
region=ap-mumbai-1

I had a similar problem to this. If you use Python and have changed some of the libraries it's possible you may have updated some of the needed dependencies. Upgrade/reinstall oci ie.
pip install oci-cli --upgrade
This sorted the problem for me.

I would suggest you take a backup of this config file, delete it and reconfigure CLI automatically by executing "oci setup config"

I guest that you are using pacman to install oci-cli. You should remove it and reinstall with official method.
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"

Please refer this document on Configuring the CLI and tally it with the config file of yours.
And refer the discussion in this forum OCI Config not found issue, this might be useful as well.

Related

unable to use javapackager command

I am using ubuntu 16.04, and my java is in /usr/bin/java
and jdk is in /usr/lib/jvm/java-8-openjdk-amd64 . non of these had the javapackager inside.
I am not able to use javapackager command and do not know how to configure it to use in command-line.
Can anyone help me?
Thanks.
It seems javapackager comes with a package called openjfx,
so running apt install openjfx should make the tool available for you, among your other java tools.
$ apt-file search javapackager
openjfx: /usr/lib/jvm/java-8-openjdk-amd64/bin/javapackager
openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/ja_JP.UTF-8/man1/javapackager.1.gz
openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javapackager.1.gz
You should define your java path.
You can set your JAVA_HOME in /etc/profile as Petronilla Escarabajo suggests. But the preferred location for JAVA_HOME or any system variable is /etc/environment.
Open /etc/environment in any text editor like nano or gedit and add the following
JAVA_HOME="/usr/lib/jvm/open-jdk" (java path could be different)
Use source to load the variables, by running this command:
source /etc/environment
Then check the variable, by running this command:
echo $JAVA_HOME

Unable to initialize gcloud environment

I have google cloud sdk installed on my ubuntu 14.4system but whenever I type gcloud init in my console, I get the following error:-
rbenv: gcloud: command not found
Further if I run gcloud init with sudo the error changes to:-
/usr/bin/env: ruby1.9.1: No such file or directory
I am unable to understand what has google cloud sdk to do with rbenv. I tried reinstalling google cloud sdk but with the same result. Is there a way out? any help is greatly appreciated.
On linux when you install the SDK it prompts to put following into your ~/.bashrc so PATH and such are setup to make cmds like gcloud visible
# The next line updates PATH for the Google Cloud SDK.
source '/home/scott/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/home/scott/google-cloud-sdk/completion.bash.inc'
If you are not on linux/OSX then the SDK install will have similar
It sounds as though gcloud is not on your $PATH.
If you installed the Cloud SDK to /home/username/google-cloud-sdk/, you should be able to invoke gcloud by running /home/username/google-cloud-sdk/bin/gcloud info. If you would like to be able to run simply gcloud, you can run export PATH="/home/username/google-cloud-sdk/bin:$PATH" (to make this setting persist, put that command in your ~/.profile file.

How to use ant to compile and deploy my webapp in openshift server?

I don't have ant in my server. When I do rhc ssh myapp and tried to use ant, it shows "bash: ant: command not found". But I find jars related to ant in my folder "jbossews/lib/catalina-ant.jar".
I tried to install ant by sudo apt-get install ant, but it shows "bash: /usr/bin/sudo: Permission denied"
so I dont know what to do.
Ant functionality is not available on OpenShift at this time. I'm working on clearing up some conflicting articles on our side. Also, root access (sudo) isn't available to users in their gears.
Just use the commands below:
wget https://www.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.zip
unzip apache-ant-1.9.4-bin.zip

cannot install mysql-connector-java, no package available

I need to install JDBC for MySQL running in CentOS.
I tried using this command
yum install mysql-connector-java
but it says
No Package mysql-connector-java available
Nothing to do
Do you know any other command that aims to install JDBC?
Here's what I did to solve the issue:
Download the JDBC here
Extract the files anywhere you want. To extract follow the command below
tar -zxvf [TAR FILENAME]
You will find mysql-connector-java-5.1.22-bin.jar inside that folder. Copy that and paste to (in my case) /%android-sdk%/tools/lib
Add the new location of mysql-connector-java-5.1.22-bin.jar to classpath
mysql java connector is platform independent. you can download it from following link
http://dev.mysql.com/downloads/connector/j/
you can put jar file in /lib/ or /webapps//web-inf/libs
I am assuming that you are using tomcat.
Thank you

How to add path variable to job shell

I am setting up Jenkins to replace our current TeamCity CI build.
I have created a free-style software project so that I can execute a shell script.
The Shell script runs the mvn command.
But the build fails complaining that the 'mvn' command cannot be found.
I have figured that this is because Jenkins is running the build in a different shell, which does not have Maven on it's path.
My question is; how do I add the path so 'mvn' is found in my Shell script? I've looked around but can't spot where the right place might be.
Thanks for your time.
I solved this by exporting and setting the Path in the Jenkins Job configuration where you can enter shell commands. So I set the environments variable before I execute my Shell script, works a treat.
Some possible solutions:
You can call maven with an absolute path
You configure a global environment variable in the jenkins system settings with the absolute path to your maven instance, and use this in your script call (if you use the inline shell script, I don't know if those are substituted to a called script, you have to test)
You use a maven project and configure your maven instance in the jenkins system settings
ps.: Usually /bin/sh is chosen from Jenkins, if you want to switch to eg. bash, you can configure this in the jenkins system settings, in case you want to configure global environment variables.
You can use envInject plugin. It's very powerful.
I use it to install rbenv. And it can inject environment variables into your current job.
Another option to Dags suggestion is that if you're only using a single version of maven, on each slave server you could do either;
* add PATH=${PATH}:
* symlink mvn into /usr/bin with; sudo ln -s /usr/bin
I'm not at a Jenkins box at the moment, but I can find some more detailed examples if you'd like.
Jenkins is using sh by default and not bash.
This is my first time defining a jenkins maven job, and I also followed soem regular maven instructions (for running from command line...), and tried to update ~/.bashrc with M2_HOME, M2, PATH, but it didn't work because jenkins used sh and not bash. Then I found out that there is a simpler and better way built into jenkins.
After installing maven, I was supposed to configure my maven installation in jenkins.
To configure your maven installation in Jenkins:
login to jenkins web console
click Manage Jenkins --> Configure System
Under Maven, click the "Maven Installations..." button
a. Give it some name
b. and under MVN_HOME set the path to where you installed maven, for example "/usr/local/apache-maven/apache-maven-3.0.5"
Click Save button
Define a job with maven target
edit your job
Click "Add build step"
on Maven Version, enter the name you gave your maven installation (step #4 above)
set some goal like clean install