Invoking Jython without Weblogic's WLST - weblogic

I'm using an AIX machine which has Weblogic 9.21 installed and it also has jython as part of its installation (WLST).
Is there a way to run jython code without having to initialize the WLST first?
I have the following jars too if they bring in any ideas:
['.', '/opt/weblogic921/weblogic92/common/lib/jython.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/server/lib/weblogic.jar', '/opt/weblogic921/weblogic92/common/wlst/modules/jython-modules.jar/Lib', '/opt/weblogic921/weblogic92/common/wlst', '/opt/weblogic921/weblogic92/common/wlst/lib', '/opt/weblogic921/weblogic92/common/wlst/modules']
Right now I'm invoking the jython code using:
java -cp /opt/weblogic921/weblogic92/server/lib/weblogic.jar weblogic.WLST file.py

Paste below code in a shell script say jythonExec.sh and use it
Example Usage : /bin/bash jythonExec.sh file.py
#!/bin/bash
jythonJarLoc=/opt/weblogic921/weblogic92/common/lib/jython.jar
javaLoc=/usr/bin/java
pythonCacheDir=/tmp/pythonCacheDir
if [ ! -f ${jythonJarLoc} ]; then
jythonJarLoc=/opt/weblogic921/weblogic92/server/lib/weblogic.jar
fi
${javaLoc} -cp ${jythonJarLoc} -Dpython.cachedir=${pythonCacheDir} org.python.util.jython $#

Related

Haxe: openfl test works but not lime build

I'm in the process of moving all my projects to individual modules in IntelliJ rather than having one module in the entire git repo, and my IntelliJ builds stopped working. I notice it uses lime builds even though my module is set to openfl (and always has as far as I know)
openfl test flash -debug
this works
lime build GassyRickAstley.xml flash -debug -verbose
this does not. Full gist of both -v
Lime Command-Line Tools (2.9.1)
Initializing project...
Using project file: GassyRickAstley.xml
Warning: Could not read HXCPP config: /Users/booboo/.hxcpp_config.xml
Using target platform: FLASH
Running command: UPDATE
- Embedding asset: removed for brevity
- Copying template file: removed for brevity
Running command: BUILD
- Running command: haxe -main ApplicationMain -cp /usr/local/lib/haxe/lib/flixel/git -D flixel=4.3.0 -cp /usr/local/lib/haxe/lib/openfl/3,6,1 -D openfl=3.6.1 -cp /usr/local/lib/haxe/lib/lime/2,9,1 -D lime=2.9.1 -cp /usr/local/lib/haxe/lib/actuate/1,8,7 -D actuate=1.8.7 -cp /usr/local/lib/haxe/lib/ash/1,5,4/src -D ash=1.5.4 -cp source -cp lib -cp /usr/local/lib/haxe/lib/openfl/3,6,1/extern -cp ../Krakel/source -cp ../../lib/HxAssert/src -D native-trace -D HXCPP_QUIET -D openfl-next -D tools=2.9.1 -D flash-use-stage -D no-compilation -D openfl-flash -D verbose=1 -D web --macro flixel.system.macros.FlxDefines.run() -swf-lib export/flash/obj/assets.swf -swf-version 11.8 -swf export/flash/bin/GassyRickAstley.swf -cp export/flash/haxe -debug
georges-mbp:Gassy Rick Astley booboo$
It doesn't seem like anything went wrong, but I'm pretty shit with analyzing terminal output.
For now I can just build manually, but not having breakpoints is gonna get pretty lame, pretty fast. Any help is appreciated.
Bonus question. When I run/test the project in open fl and close the game's window the active terminal process never ends. I have to close the terminal, reopen and cd my directory again. is there a way around this?
It looks like it may have worked. openfl test flash is similar to running openfl build flash && openfl run flash, which in turn should behave practically the same as lime build flash && lime run flash.
I think your lime build flash command is working properly, but is exiting because the application has finished building. If you use lime test flash instead, it might build-and-run for you, as the other command does?

Issue running TestNG from Jenkins

When trying to trigger a Selenium test thru Jenkins, I face the following issue:
Error: Could not find or load main class org.testng.TestNG
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I do have the testNG jar file in my classpath which is shown below:
My Execute Shell command looks like the following:
set classpath="${WORKSPACE}/bin;${WORKSPACE}/lib/*"
chmod a+x ${WORKSPACE}/lib/*.jar
java -cp "${WORKSPACE}/out/production/Test;${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml
This project is triggered from Bitbucket and is locally built on IntelliJ.
Any help here, would be appreciated.
It looks you are trying to run on a Linux OS.
On Linux, the classpath separator is : and not ;.
http://daviditnotes.blogspot.fr/2007/12/java-classpath-separator.html
Try:
set classpath="${WORKSPACE}/bin:${WORKSPACE}/lib/*"
chmod a+x ${WORKSPACE}/lib/*.jar
java -cp "${WORKSPACE}/out/production/Test:${WORKSPACE}/lib/*" org.testng.TestNG ${WORKSPACE}/TestNG.xml

Jython 2.7b4 will not webstart: ImportError: No module named site

I injected my application into jython-standalone-2.7-b4.jar. Here is what I see in the webstart console of the client machine when I webstart my app:
Java Web Start 11.31.2.13
Using JRE version 1.8.0_31-b13 Java HotSpot(TM) 64-Bit Server VM
User home directory = C:\Users\me
...
#### Java Web Start Error:
#### null
When I click on 'Details', I find the following exception stack trace:
ImportError: No module named site
at org.python.core.ImportError(Py.java:328)
at org.python.core.imp.import_first(imp.java:842)
at org.python.core.imp.load(imp.java:695)
at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:118)
at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:94)
at org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:39)
at org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:28)
at org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:67)
at org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:53)
at org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:33)
...
Jython2.7b1 worked for me. I tried Jython2.7b3, but that fails as well.
Due to class loader differences in the Web Start environment, Jython can't find the files in the Lib directory inside the standalone jar file. To fix this, you need to rearrange the contents of the standalone jar a bit. The following script will convert a standalone jar into something workable in a Web Start environment:
#!/bin/sh
# Converts a Jython standalone jar into something usable with Java Web Start
if [ -z $1 ]; then
echo "Please give the path to the standalone jar as the first argument."
exit 1
fi
CURRDIR=$(pwd)
JAR_PATH="$CURRDIR/$1"
CONVERTED_JAR_PATH="$CURRDIR/jython-webstart.jar"
TEMPDIR=$(mktemp -d)
cd "$TEMPDIR"
jar xf "$JAR_PATH"
rm -rf Lib/test # including Jython's own unit tests is pointless
java -jar "$JAR_PATH" -m compileall Lib
find Lib -name "*.py" -delete
mv Lib/* .
rmdir Lib
jar cf "$CONVERTED_JAR_PATH" *
rm -rf "$TEMPDIR"
Next you'll probably run into Jython bug 2283. To work around it, set the python.home system property to point to any existing directory.

cannot execute jython script using wsadmin.sh

I am trying to automate application deployment in a Websphere 8 server using wsadmin and jython scripts.
I would like to list all applications that are running in my server (just to test my setup)
wsadmin.sh -lang jython -c 'AdminApp.list()'
When I run the above command in terminal, I get no response back/no errros. I tried moving the AdminApp command to a separate file (listApplications.py), same result
wsadmin.sh -lang jython listApplications.py
Are there any pre requisites to using the wsadmin.sh? How to look for logs when wsadmin.sh is being executed?
Provide full path of wsadmin.sh For example:
/opt/IBM/.../wsadmin.sh -lang jython -c "print AdminApp.list()"
According to this article I suggest to try:
wsadmin.sh -lang jython -c 'print AdminApp.list()'
instead of
wsadmin.sh -lang jython -c 'AdminApp.list()'

Running script in FreeBSD

First steps in FreeBSD: trying to run my installation script. Fast help needed:
# ls
configure
# file configure
configure: Bourne-Again shell script text executable
# ./configure
./configure: Command not found
# configure
configure: Command not found
What is wrong, how can I execute this script?
Do you have bash installed? If not use FreeBSD Ports to install it. Use where bash to find out.
Use the force Luke :)
# pkg_add -r bash
May it be, that your's configure script doesn't have appropriate executions rights. Try to cast:
chmod 777 configure
If it works, fix it to
chmod 764 configure
configure scripts are ultra portable shell scripts. There is no need for bash here. The problem is somewhere else.
What's the first line in the configure script? Maybe a CR/LF snuck in, which is a common cause for a totally misleading error message saying that the script was not found, when it was the interpreter that was not found.
Please try /bin/sh ./configure
Install the bash package using
pkg add bash
or
make -C /usr/ports/shells/bash install clean
By default FreeBSD comes with tcsh and a POSIX compatible FreeBSD sh
On older FreeBSD systems you will need to do
rehash
before you can run it.
First line of this script (#!/usr/bin/bash, i suppose) should be changed to #!/usr/local/bin/bash.
And of course, you should have shells/bash port installed.