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

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.

Related

pocketbase: command not found

I am trying to set up a pocketbase on a Debian server.
on the server I created a dir called pb and scp over the pocketbase file which I downloaded from https://pocketbase.io/docs/
I downloaded all three linux packages pocketbase_0.10.2_linux_amd64.zip , pocketbase_0.10.2_linux_arm64.zip and pocketbase_0.10.2_linux_armv7.zip
I download the file, unzip it and then move the pocketbase file over to the server.
Note, Ive downloaded these onto a windows machine and then SCP pocketbase file over to my server.
When I run pocketbase serve I get the error command not found.
I can't find a good solution to this issue.
Execute it as instructed by pocketbase's documentation if you are within the same directory as the bin file:
./pocketbase serve
If you want to run it as pocketbase serve alone you will need to move the bin file under /usr/bin or ideally /usr/local/bin which should be under your system's $PATH variable.
https://pocketbase.io/docs/
Run ./pocketbase --help or ./pocketbase [command] --help for more assistance.

How to install Apache on OmniOS

I am attempting to install Apache on OmniOS. I followed the instructions here: option 2 https://wiki.openindiana.org/oi/3.+Installing+software+and+package+management
Ran the command:
echo $PATH results in /opt/local/sbin:/opt/local/bin:/usr/gnu/bin:/usr/sbin:/sbin
curl https://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-2016Q4-x86_64.tar.gz | gtar -zxpf - -C /
pkgin -y update
pkgin -y install apache-2.4.6 resulted in the messages Calculating dependencies...done and then nothing to do
I can not find the apache service or configuration directory as they are described here: https://docs.joyent.com/public-cloud/instances/infrastructure/images/smartos/apache
/opt/local/etc/httpd The configuration directory for Apache
svcs pkgsrc/apache Checking service for Apache
Server Info:
uname -v results in omnios-r151026-d9b45886bd
Running x86
Also running SunONE webserver
Though incomplete, my commands did make a change. My Perl scripts can no longer find DBI.
Why does the Apache install say there is nothing to do? What am I missing?
UPDATE
Ran which apache2 resulted in no apache2
Ran pkgin list to list all installed packages. Only apache
reference is apache-maven-3.5.4
Ran find . -name '*apache*' in the following directories:
\etc nothing
\opt found:
vim, el, and elc files in SUNWspro
org-apache-tools-ant-module files and folder in netbeans/3.5V11/modules/patches
apache folder in SUNWwbsvr/plugins/java/samples/webapps/jstl/src/org which contains java files
vim, tag, el and elc files in sfw --- also an apache folder in sfw which contains readme/bash type files for apache/php and one so file
apache-maven-3.5.4 files/folders in local
org-apache-xml-resolver* files in sunstudio12.1
'\usr' found:
2 vims in share/vim/vim80/syntax
apache-fcgi.conf in lib/python2.7/vendor-packages/cherrypy/scaffold
'\var' nothing
As far as I can tell, the binaries have not been installed
I tried running pkgin -y install apache-2 and it worked. It installed apache-2.4.3. Perhaps apache-2.4.6 does not exist in the repository.
This mean apache is already installed on the Linux system. To run below command which will tell the location of the system binary.
which apache2
for the configuration folder look for below directory:
/etc/apache2

How to use -Dinstallation.host= in intelliJ tomcat configuration without command line

I am using mvn for build and deploy my code in tomcat. I am using command for build clean install -DskipTests -DskipJangarooApp -pl :studio-webapp -am -T 4C where studio-webapp is my module name.
And after build i use tomcat:run command like this :
tomcat7:run -Dinstallation.host=192.168.252.100
where 192.168.252.100 is my host machine IP. This process is running well.
But the problem is when I change any java class in my IntelliJ I again run buil command then run. And its taking so much time. So that I want to apply tomcat configuration in IntelliJ but i am not able to find any option of "-Dinstallation.host" in this screen

How to install PHP extensions on Cloudbees?

I need to install mbstring (and a few other extensions) for PHP on Cloudbees. Is this possible?
Note that I'm using an updated PHP version as described here:
https://developer.cloudbees.com/bin/view/DEV/PHP+Builds
I don't think scripts have sudo access, so I can't simply use the package manager. I don't think these extensions exist as PEAR packages either. So I'm stumped.
Here is the response from Cloudbees support. Seems to work fine, just make sure you don't have any spaces in your Jenkins build path!
Our provided PHP versions don't have mbstring module activated. You will need to build your own PHP version to get it. To be sure your custom PHP build works on Cloudbees slave, you can build it with a Jenkins job on your instance (with various --with-XXX or --without-XXX options).
We are ourselves doing something like this with a script like
# Download
regex='.*(RC|alpha|beta).*'
if [[ $version =~ $regex ]]; then
wget http://downloads.php.net/dsp/php-${version}.tar.bz2
else
wget http://us3.php.net/distributions/php-${version}.tar.bz2
fi
# Unpack
tar xjf php-${version}.tar.bz2
# Build
cd php-${version}
./configure --prefix=/home/jenkins/tools/php/${php_name} \
--with-curl --with-openssl
make && make install
As a side node, you should also take care of specifying a good installation prefix with --prefix. I would choose something like /home/jenkins/tools/php/5.4/.
To store compiled php engine you could generate a tar.gz//bz2 file of target installation directory. Then, store it in your WebDAV directory, which is accessible in /private/{account}/ during a build when "Mount CloudBees DEV#cloud Private WebDav Repository" is checked.
You should add a first step to jobs requiring PHP to extract this archive. As Jenkins workspace is usually cached on DEV#Cloud, you can extract the archive only if it's not already there. That will speed up your build.

Autoconf macros for Apache and conf.d install process?

I have a package that is using the autotools to build and install.
Part of the package is a website that can be run on the local machine.
So in the package there is a .conf file that is meant to be either
copied or linked to the /etc/apache2/conf.d directory. What's the
standard way that packages would do this? If possible, I'd like for
the user not to have an extra step to make the website work. I'd like
to have them install the package and then be able to browse to
http://localhost/newpackage to get up and running.
Also, is there a way that autoconf knows about the apache install or a
standard way through then environment some how? If someone could
point me in the right direction that would be great.
Steve
The first thing you should do is to locate the apache extension tool apxs or apxs2 (depends on apache version and/or platform you are building for). After you know where your tool is located you can run queries to get certain apache config params. For example to get system config dir you can run:
apxs2 -q SYSCONFDIR
Here is a snippet of how you can locate apache extension tool: (be careful it may contain syntax errors)
dnl Note: AC_DEFUN goes here plus other stuff
AC_MSG_CHECKING(for apache APXS)
AC_ARG_WITH(apxs,
[AS_HELP_STRING([[--with-apxs[=FILE]]],
[path to the apxs, defaults to "apxs".])],
[
if test "$withval" = "yes"; then
APXS=apxs
else
APXS="$withval"
fi
])
if test -z "$APXS"; then
for i in /usr/sbin /usr/local/apache/bin /usr/bin ; do
if test -f "$i/apxs2"; then
APXS="$i/apxs2"
break
fi
if test -f "$i/apxs"; then
APXS="$i/apxs"
break
fi
done
fi
AC_SUBST(APXS)
The way to use APXS in your automake Makefile.am would look something like this:
## Find apache sys config dir
APACHE2_SYSCONFDIR = `#APXS# -q SYSCONFDIR`
## Misc automake stuff goes here
install: install-am
cp my.conf $(DESTDIR)${APACHE2_SYSCONFDIR}/conf.d/my.conf
I assume you are familiar with automake and autoconf tools.