Selenium2 Servlets - selenium-grid

i'd like to add the own servlets by starting of selenium-server-standalone-2.19.0.jar -servlets, but cannot figure out how to do it.
is it possible to find the developer's guide about selenium2 servlets?
one example would be also very nice.
tnx a lot!
a working solution of mine:
1) checkout of http://selenium.googlecode.com/svn/tags/selenium-2.19.0
2) created HubServlet which extends from RegistryBasedServlet
package org.openqa.grid.web.servlet.alpha;
...
public class HubServlet extends RegistryBasedServlet {
...
}
3) building
./go clean release (only once)
./go //java/server/src/org/openqa/grid/selenium:selenium:uber (everytime i change something on org.openqa.grid.web.servlet.alpha.HubServlet)

The solution which worked for me:
svn checkout of the selenium2 sources from googlecode
$ svn co http://selenium.googlecode.com/svn/tags/selenium-2.19.0 selenium
changed to the selenium dir
$ cd selenium
adding servlets folder "alpha"
$ mkdir -p java/server/src/org/openqa/grid/web/servlet/alpha
adding servlets classe(s)
package org.openqa.grid.web.servlet.alpha;
public class HubServlet extends RegistryBasedServlet {
...
}
making HubServlet.jar
$ ./go clean //java/server/src/org/openqa/grid/web/servlet/alpha:HubServlet
getting from googlecode selenium-server-standalone-2.19.0.jar
$ wget http://selenium.googlecode.com/files/selenium-server-standalone-2.19.0.jar -O selenium-server-standalone-2.19.0.jar
merging jar(s)
$ mkdir tmp
$ (cd tmp; jar -xf "build/java/server/src/org/openqa/grid/web/servlet/alpha/HubServlet.jar")
$ (cd tmp; jar -xf selenium-server-standalone-2.19.0.jar)
$ jar -cfM selenium-server-standalone.jar -C $dir_sel_build/tmp .
starting selenium-server-standalone.jar with the "-servlets" parameter
$ java -jar selenium-server-standalone.jar -role hub -servlets org.openqa.grid.web.servlet.alpha.HubServlet
you will see something like:
15.03.2012 16:25:07 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
15.03.2012 16:25:08 org.openqa.grid.web.Hub <init>
INFO: binding org.openqa.grid.web.servlet.alpha.HubServlet to /grid/admin/HubServlet/*
361 [main] INFO org.seleniumhq.jetty7.server.Server - jetty-7.x.y-SNAPSHOT
392 [main] INFO org.seleniumhq.jetty7.server.handler.ContextHandler - started
o.s.j.s.ServletContextHandler{/,null}
400 [main] INFO org.seleniumhq.jetty7.server.AbstractConnector - Started
SocketConnector#0.0.0.0:4444

Related

%files section of Singularity recipe non-intuitively copies files to wrong bind location

I am working on CentOS 8 and am using Singularity 3.6.2. I have a Singularity recipe file :
BootStrap: yum
OSVersion: 8
MirrorURL: http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os/
Include: yum
%files
/gpfs0/home1/group/user/path/to/some.rpm /tmp
%post
ls /tmp
echo "Hello from inside the container"
When I run :
$ sudo singularity build test.simg tmp
INFO: Starting build...
INFO: Skipping GPG Key Import
INFO: Adding owner write permission to build path: /tmp/rootfs-4db1e756-22a8-11eb-bb20-34800d2d90f0
INFO: Copying /gpfs0/home1/group/user/path/to/some.rpm to /tmp/rootfs-4db1e756-22a8-11eb-bb20-34800d2d90f0/tmp
INFO: Running post scriptlet
+ ls /tmp
qtsingleapp-RStudi-c679-6387e228-lockfile
rootfs-4db1e756-22a8-11eb-bb20-34800d2d90f0
rootfs-b10ad12c-229a-11eb-85a3-34800d2d90f0
+ echo 'Hello from inside the container'
Hello from inside the container
INFO: Creating SIF file...
According to the Singularity documentation
In the default configuration, the system default bind points are $HOME , /sys:/sys , /proc:/proc, /tmp:/tmp,
Question :
Why is the %files section putting my rpm in /tmp/rootfs-4db1e756-22a8-11eb-bb20-34800d2d90f0/tmp and not in /tmp? That seems to contradict the documentation. This is also different from the behavior observed with Singularity v2.5.1
Also, how would I access said file. The long 'hash-like' part of the path seems to change depending on the build?
I don't have an answer reconciling the documentation with where the %files section is actually putting the files, however I do have an answer for how to access the files copied. You need to use ${SINGULARITY_CONTAINER} in the %post section.
E.g.
$ cat Singularity
BootStrap: yum
OSVersion: 8
MirrorURL: http://mirror.centos.org/centos-8/8/BaseOS/x86_64/os/
Include: yum
%files
# Will need to use environmental variables to copy the code to
/gpfs0/home/group/user/path/to/some.rpm /tmp
%post
ls ${SINGULARITY_CONTAINER}/tmp
echo "Hello from inside the container"
When building yields :
$ sudo singularity build tmp.simg tmp
INFO: Starting build...
INFO: Skipping GPG Key Import
INFO: Adding owner write permission to build path: /tmp/rootfs-e2a3fbb4-242b-11eb-a267-34800d2d90f0
INFO: Copying /gpfs0/home/group/user/path/to/some.rpm to /tmp/rootfs-e2a3fbb4-242b-11eb-a267-34800d2d90f0/tmp
INFO: Running post scriptlet
+ ls /tmp/rootfs-e2a3fbb4-242b-11eb-a267-34800d2d90f0/tmp
some.rpm
+ echo 'Hello from inside the container'
Hello from inside the container
INFO: Creating SIF file...

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.

How to work with Mahout?

I have tried to work with mahout using the link:
http://girlincomputerscience.blogspot.in/2010/11/apache-mahout.html
When i execute the command
anand#ubuntu:~/Downloads/mahout-distribution-0.9$ bin/mahout recommenditembased --input mydata.dat --usersFile user.dat --numRecommendations 2 --output output/ --similarityClassname SIMILARITY_PEARSON_CORRELATION
it shows:
hadoop binary is not in PATH,HADOOP_HOME/bin,HADOOP_PREFIX/bin, running locally
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
What may be the possible reasons for the errors?
You need to setup Apache Hadoop first ( also described here ):
$ http://mirror.metrocast.net/apache/hadoop/common/hadoop-1.2.1/hadoop-1.2.1-bin.tar.gz
$ tar zxf hadoop-1.2.1-bin.tar.gz
$ cd hadoop-1.2.1
$ export PATH=`pwd`/bin:$PATH
Then try to setup Apache Mahout
Apache Mahout setup
$ wget -c http://archive.apache.org/dist/mahout/0.9/mahout-distribution-0.9.tar.gz
$ tar zxf mahout-distribution-0.9.tar.gz
$ cd mahout-distribution-0.9
Setup env variables:
export HADOOP_HOME=/path/to/hadoop-1.2.1
export PATH=$HADOOP_HOME/bin:$PATH
export MAHOUT_HOME=/path/to/mahout-distribution-0.9
export PATH=$MAHOUT_HOME/bin:$PATH
Now your Mahout installation should work fine ( read here for more ).

Activemq will not start on my Ubuntu VM

I'm trying to run activemq on my ubuntu virtual machine but have constantly been running into issues getting it to start up. I've tried downloading the binary and source with no luck. Currently I have downloaded the source, run "mvn clean install -Dmaven.test.skip=true" and mvn reported successful installation. I then hunted around in my .m2 folder found apache-activemq-5.5.1-bin.tar.gz and extracted it to my home/USERNAME dir and attempted to run "bash bin/activemq start" only to receive the following error.
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties
and log4j.properties
to get details
bin/activemq: line 370: /usr/bin/java -Xms256M -Xmx256M -Dorg.apache.activemq.UseDedicatedTaskRunner=true
-Djava.util.logging.config.file=logging.properties
-Dcom.sun.management.jmxremote
-Dactivemq.classpath="/home/jacob/activeMq1/apache-activemq-5.5.1/conf;"
-Dactivemq.home="/home/jacob/activeMq1/apache-activemq-5.5.1"
-Dactivemq.base="/home/jacob/activeMq1/apache-activemq-5.5.1"
-jar "/home/jacob/activeMq1/apache-activemq-5.5.1/bin/run.jar" start >/dev/null 2>&1 &
RET="$?"; APID="$!";
echo $APID > /home/jacob/activeMq1/apache-activemq-5.5.1/data/activemq.pid;
echo "INFO: pidfile created : '/home/jacob/activeMq1/apache-activemq-5.5.1/data/activemq.pid' (pid '$APID')";
exit $RET: No such file or directory
Has any one run into this type of error before?
Looks like I'm answering one of my questions again, but maybe this will help someone in the future.
steps.
I ended up getting activemq to work by creating a configuration file via running the command "./bin/activemq setup newConfig" (exclude the quotes)
I then replaced the current config file "activemq" which was located at etc/default/. (I made a backup of the original activemq file before overwriting it with newConfig).
Run "./bin/activemq start" which will create a PID file.
After the file is created re-run "./bin/activemq start" to finally start up the broker.
You can then test the install by navigating to "http://localhost:8161/admin/" or by doing a "netstat -an | grep 61616" if you kept the default ports etc.
I install activemq 5.13 on Debian, download and unzip in /opt, then I go to /opt/apache-activemq-5.13.1/run "./bin/activemq start", then appear this error:
xx#debian:/opt/apache-activemq-5.13.1$ ./bin/activemq start
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
./bin/activemq: 330: ./bin/activemq: "/usr/bin/java" -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq-5.13.1//conf/login.config -Djava.awt.headless=true -Djava.io.tmpdir="/opt/apache-activemq-5.13.1//tmp" -Dactivemq.classpath="/opt/apache-activemq-5.13.1//conf:/opt/apache-activemq-5.13.1//../lib/:" -Dactivemq.home="/opt/apache-activemq-5.13.1/" -Dactivemq.base="/opt/apache-activemq-5.13.1/" -Dactivemq.conf="/opt/apache-activemq-5.13.1//conf" -Dactivemq.data="/opt/apache-activemq-5.13.1//data" -jar "/opt/apache-activemq-5.13.1//bin/activemq.jar" start >/dev/null 2>&1 &
RET="$?"; APID="$!";
echo $APID > /opt/apache-activemq-5.13.1//data/activemq.pid;
echo "INFO: pidfile created : '/opt/apache-activemq-5.13.1//data/activemq.pid' (pid '$APID')";exit $RET: not found
What I did is to check the Debian version using "uname -a":
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
I found my debian is 64 bit system. so I run
./bin/linux-x86-64/activemq start
It shows:
Starting ActiveMQ Broker...
Then I can access the site:http://localhost:8161/admin/ with username "admin" and password "admin"
with Ubuntu 14.04, I had to create a link in /etc/activemq/instances-enabled
sudo ln -s ../instances-available/main/
similar to apache2 setup
then started the server with /etc/init.d/activemq start
sudo is necessary.
bin$ sudo ./activemq start
bin$ sudo ./activemq status
INFO: Loading '/opt/runtime/apache-activemq-5.11.1/bin/env' INFO: Using java '/usr/bin/java' ActiveMQ is running (pid '29887')

how to run snmpRequest.java in snmp4j?

I am actually using Snmp4j libraries..
But I am not getting how to run org/snmp4j/tools/console/SnmpRequest.java
I wanted to know how to run snmpRequest.java in snmp4j?
SnmpRequest.java has a main() method.
Run it as you would any Java application.
Unless you are looking for the usage, in which case I have not looked.
You need to add the log4j jar file as well... Download the Log4J from http://archive.apache.org/dist/logging/log4j/1.2.14/ (take the zip file if you're on windows), then extract the log4j-1.2.14.jar file into the same dir as the snmp4j-2.0.3.jar file.
To run it, CD to the directory with both of the jars in it and type this:
java -cp snmp4j-2.0.3.jar;log4j-1.2.14.jar org.snmp4j.tools.console.SnmpRequest
followed by whatever parameters you want...
Assuming that you have the two jars in libs directory that's present in current directory, try the following syntax:
java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -h
java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -c public -v 2c -d OFF 10.1.1.1 1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.2.0
java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETNEXT -c public -v 2c 10.1.1.1 1.3.6.1.2.1.1.1-5
java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETBULK -c public -v 2c -Ow 10.1.1.1 1.0.8802.1.1.2.1.4
java -classpath ./libs/snmp4j-2.5.0.jar:./libs/log4j-1.2.17.jar org.snmp4j.tools.console.SnmpRequest -d OFF -p GETBULK -c public -v 2c -Ot 10.1.1.1 1.0.8802.1.1.2.1.4
It works for me.