Execute weblogic "Lock and Edit" in unix command line - unix

I'm running weblogic in unix, I would like to automated processes by executing tasks in the command line, for example i would like to update a deployed project without the need of accessing the weblogic console, rather i would want to run a command that will do the job, so my initial challenge is, how do i run "Lock and Edit" in the command line? or i should ask, what is the console doing behind the scene when I'm running "Lock and Edit" ?

To deploy/undeploy application from the command line, you can use the weblogic.Deployer class. See that documentation for details.
WebLogic Server has its own scripting language based on Jython (python in a JVM) you can use to computerize any configuration action. WLST is described in this documentation.

When you do lock and edit it creates a nonexclusive lock to the domain and same can be achieved with command line as below:
Generate a client jar from weblogic using below:
Change directories to the server/lib directory.
cd WL_HOME/server/lib
Use the following command to create wlfullclient.jar in the server/lib directory:
java -jar ../../modules/com.bea.core.jarbuilder_X.X.X.X.jar
where X.X.X.X is the version number of the jarbuilder module in the WL_HOME/server/lib directory.
For example:
java -jar ../../../modules/com.bea.core.jarbuilder_1.0.1.0.jar
You can now copy and bundle the wlfullclient.jar with client applications.
Add the wlfullclient.jar to the client application’s classpath.
once this is done use the below command to automate the deployment:
export CLASSPATH='location where your client jar resides'
java -cp $CLASSPATH weblogic.Deployer -adminurl ADMIN_URL:PORT -username weblogic -password weblogic1! -deploy app.war -name appname -targets AdminServer -debug - usenonexclusivelock

Related

Unable to install IIS AspNetCoreModuleV2 in a dockerimage (and Azure Pipelines)

I have a problem for few days now with the "dotnet hosting bundle" and AspNetCoreV2 IIS module in a dockerimage.
So, I creating a dockerimage with many IIS modules and requirements to execute our software. The dockerimage works good expect this AspNetCoreV2 module. When the container created, I check the modules installed with Get-WebGlobalModule and doesn't appear.
But, when I start the quiet (or passive) installation manualy, into the container, this module works and appear in the IIS Module list.
I tried many solutions to do that (multistage with aspnetcore Microsoft images, last version of dotnet_hosting_bundle.exe and many other, but same issue).
I tried to automatise the docker exec process to install this module manualy and commit it with Azure Pipelines and Windows agent in a VM, but doesn't work :(.
To try that, I use different way :
docker stop mycontainer
docker rm mycontainer
docker run --name mycontainer -d -it $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId)
docker exec mycontainer powershell.exe -command Start-Process -FilePath 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' -ArgumentList "/passive","/install","/norestart" -PassThru -Wait
docker stop mycontainer
docker commit mycontainer $(containerRegistry)/$(container_requirement_name):v1.0.$(Build.BuildId).1
In the Start-Process, I can see :
The process is created but apparently not started
I also tried with : cmd 'C:\Program Files\MySoftware\PowerShell\Installer.Prerequisites\dotnet-hosting-3.1.2-win.exe' /quiet /install
This task in Azure Pipeline working without error, but when I download this new image (pushed after these instructions), the module doesn't appear in Get-WebGlobalModule
Also, the module is not presend into ProgramFiles
I don't really understand how can I install this module. All other modules working, expect this ...
Thanks you very much in advance for your advises.
Best
Set the preference variables with below command fixed above issue.
powershell -Command $ErrorActionPreference = 'Stop' $ProgressPreference = 'Continue'
The values of the preference variables affect how PowerShell operates and executes cmdLets. It might be because the default settings of the preference variables of the container that caused the PowerShell failing to complete the installation. You can override these preference variables in your script.
Please see this document for more information about Preference Variables.

How to run compojure rest server?

I've created a rest server with compojure and ring.
I can run it with 'lein ring server'. I can build it with 'lein uberjar'. But how to run this jar like java -jar my.jar ...?
You need to invoke lein ring uberjar to generate a self-start server you can run with
java -jar target/uberjar/yourproject-0.1.0-SNAPSHOT-standalone.jar
I suggest you to use the standalone one to avoid dealing with dependencies
Edited to include the specific command

How to deploy a Java project using war file on CloudControl

I have my Java project in a Hg repository. How can I use this code or convert to Git repo to be able to deploy on Cloud Control?
Is there an Option for me to use a .war file to Deploy instead of the entire file structure upload and compile? If so, would it matter if the war file was built using Tomcat server or Glass-fish server?
Your help in answering these question will be a valuable information for me. Appreciate your help in advance.
Best Regards.
If you want to keep all mercurial branches, tags and history use fast-export. Otherwise just create git repository from scratch:
git init; git add . ; git commit -am "Initial commit"
Deploying prebuilt war file is not the recommended way. You should push to the repository (via git or cctrlapp) and let cloudControl platform take care of the build process. Anyway you can still use Maven to download the war file. You can find some examples here.
Apart from this you have to provide an embedded jetty or tomcat runner and specify start command in Procfile:
Jetty:
web: java -jar target/dependency/jetty-runner.jar --port $PORT target/YOU_WAR.war
Tomcat:
web: java -jar target/dependency/webapp-runner.jar --port $PORT target/YOUR_WAR.war
Keep in mind that war file should be built independently of any application servers.

Call the build script present on another machine

We have a build script present on our build machine.
How will I run this build script from my machine using ant?
Both machines are in same network.
Is there any free tool to call build script on remote machine which supports command line support?
Please Note: Build script cannot be called manually.
Please ask for any more details are required.
The sshexec task can do the work. Obviously Ant should be installed on the build machine. But you have to install a ssh server on the build machine too.
Here a piece of build.xml for your local machine:
<sshexec host="buildmachine"
username="builduser"
password="somepassword"
command="ant -f /path/to/the/build.xml" />

cannot seem to run my jar file in command promtp

I have created a project within NetBeans with includes a form and a class that serves as a database connection layer. When i try to run this project through the IDE everything launches just fine. The problem occurs when i try to launch the jar file created by the ide on the commmand prompt terminal. nothing happens? it just moves to the next line. i have a manifest file with a class path and main class specified and it looks like so
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_22-b04 (Sun Microsystems Inc.)
Class-Path: lib/mysql-connector-java-5.1.13-bin.jar lib/mylib.jar
X-COMMENT: Main-Class will be added automatically by build
Main-Class: eopprototype.EOPPrototype
when i look at what the compiler says is says To run this application from the command line without Ant, try:
java -jar "/h/USERS/local/pagola/NetBeansProjects/EOPPrototype/dist/EOPPrototype.jar"
when i try to type that command it just goes to the second line without anything happening. Not evena ny errors. I am supposed to distribute this jar file to a shared folder and have it run but i cant do it and i dont know whats wrong. I have NOT added any JAVA_HOME path as my jdk 1,6 is isntalled in usr/bin so it should find it there but i have NOT added any classpath (ide shows two runtime and bootable classpaths) somebody please assist me as i am new to the whole java virtual machine environment
I guess you meant the standard outputs, or other things you printed to the command prompt from your java program. To get that printed on the command propmt, you need to run java in debug mode.
Use
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar myJar.jar
to run java in debug mode and get all standard outputs, exceptions etc. on the command prompt.

Resources