How do I actually run Apache Felix OSGi's shell? - osgi

I downloaded the current Felix jar linked over from http://felix.apache.org/downloads.cgi (for version 4.4.1)
Extracted the .zip
Ran the bin/felix.jar with "java -jar felix.jar"
Observed that the felix-cache/ directory was created
I understand that I should be sitting in the Felix shell there, at that point. But I get no output. I type "help" as per the instructions here:
http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-usage-documentation.html
But I get nothing in terms of a shell. Just a blank terminal that lets me type but doesn't respond at all.
Also, as described in the 'remote shell' instructions, I try to 'telnet localhost 6666' and also get nothing.
Am I wrong in terms of what I'm trying to do? Is the gogo shell a separate application? If not, and I'm correctly expecting to see the shell, where should I look to further debug this issue?

I started felix like this:
cd felix-framework-4.4.1/
java -jar bin/felix.jar
For me the shell started correctly. So I think what happens for you is that you started from the bin dir and felix looked for the shell bundles in bin/bundle where it obviously could not find any.
See the felix launcher docs for more details.
So to answer your second question. Yes the shell is not directly included in felix.jar. It is implemented by the three *gogo bundles in the bundle dir.

Related

Error: Could not find or load main class org.apache.jackrabbit.vault.cli.VaultFsApp

We use VLT and GIT for our AEM site development.
I prefer the branch notifications and color coding etc. of GIT Bash,
to the standard output.
I use both from within ConEmu, and I have added Clink,
and that is somewhat better, but not as nice as GIT Bash.
Using the regular console I'm able to access VLT,
but when using the GIT Bash console, I get the following error.
"Error: Could not find or load main class org.apache.jackrabbit.vault.cli.VaultFsApp"
So it seems that there is a path that is not being found,
but running env|grep PATH shows the correct info.
Any help would be appreciated.
The shell's "PATH" isn't the problem.
You need to fix the Java "CLASSPATH".
You haven't specified your OS (Windows? Linux? Other?)
And I'm not sure exactly which program in the mix is using "org.apache.jackgrabbit.vault.cli". It certainly isn't Git BASH - it sounds like VLT is the guy who needs you to add Apache Jackrabbit to its Java CLASSPATH.
I fixed this in Windows 10 by running the command in cmd, rather than in git bash

How to get project name using activator (or sbt)?

I have a Play application (2.3.4) that is getting build with activator like this:
$ activator stage
This will build the project and generate startup script: target/universal/stage/bin/<project name in lowercase>.
Now, I need to get run that startup script from another bash script on my production server.
My question is - how do I get the project name (in lowercase) from activator or sbt (since activator wraps sbt) from bash, so I could run the startup script?
Or, maybe there is a better way to figure out the name of the startup script generated by activator stage.
A project name is concatenation of two keys name and version separated with a dash. Whit a little bit of parsing you can get a value of any key using the SBT show <key> command. I'm not really familiar with writing bash scripts but I hope this hint can give you enough information to solve your problem.

Installing and starting the H2 database on Ubuntu

I would like to use the H2 database on Ubuntu 12.10, and went to the website and got the platform independent install file.
The installation instructions are quite literally, "To install the software, run the installer or unzip it to a directory of your choice."
I'm not a Linux novice, so I've used many of the usual install procedures before, but I have no idea what I am supposed to do here. There are no configure or makefiles that I can find, and the documentation doesn't mention anything, and there I can't find anything using google.
I don't know if I am missing something obvious. Can anybody help please?
A shell script to start the H2 server and browser GUI is included. I don't have Ubuntu right now, but the steps should be:
Download the H2 zip file (for example h2-2013-07-28.zip).
Open a terminal window
And then run:
cd <download directory>
unzip h2*.zip
cd h2/bin
chmod +x h2.sh
./h2.sh
This should start the H2 server tool and open a browser window that lets you connect to a database.
The content of the h2.sh script is relatively simple, it is:
#!/bin/sh
dir=$(dirname "$0")
java -cp "$dir/h2-1.3.173.jar:$H2DRIVERS:$CLASSPATH" org.h2.tools.Console "$#"
What you can also do is double click the h2*.jar file (if double click is configured to start java), or run this on a command line:
java -jar h2-1.3.173.jar
this bash script start the server:
#!/bin/bash
java -cp h2*.jar org.h2.tools.Server
you need the h2-version.jar in the current directory as well
Download h2 from here http://www.h2database.com/h2-2015-01-16.zip, then once the download has completed, unzip in home directory and run the following:
cd (directory path ).
cd h2/bin.
chmod +x h2.sh.
./h2.sh.
If you're using Maven to download h2 database, then try to find out where does it saves (~/.m2/repository/com/h2database/h2/.../h2-version.jar). Since h2 dependency has all downloaded for you, then you just doubleclick on jar file (the web browser should open h2 GUI or look for h2 icon on system tray). And yes, GUI is the same as Standalone package has.
Update: as long as icon displays on tray - h2 will be launched. To disable it - right mouse click -> Exit

Why can't Groovy find this program even though it's on my PATH?

tl;dr: Groovy cannot find a program (phantomjs, which is on my $PATH) when I attempt to execute the shell command from a class -- it's otherwise finds it just fine from the Groovy Console or from a Grails CLI script. What gives?
We have a Grails script to execute JavaScript unit tests in PhantomJS ("the headless WebKit"). When these tests are executed in a stand-alone script (call it grails test-js) things work just fine. The relevant line from the Grails/Gant script was:
// where 'jsTests' is a List with the paths to each test
def failures = 0
jsTests.each {
Process p = "phantomjs lib/phantom-jasmine/lib/run_jasmine_test.coffee file://${it}".execute()
failures += p.exitValue()
}
But since we want this to run as part of the usual grails test-app cycle, we created an implementation of org.codehaus.groovy.grails.test.GrailsTestType. When we get to the part in that implementation where we need to execute the tests, that same code (as above) doesn't work, and Groovy/Grails complains that:
java.io.IOException: Cannot run program "phantomjs": error=2, No such file or directory
My first thought was that phantomjs was not on my $PATH -- but I know that it is, and again: it worked when run from the Grails/Gant script. So I tried it in the Groovy Console, and it works OK from there.
Now, if I switch from phantomjs to /absolute/path/to/phantomjs, then it works fine. But hard-coding an absolute filesystem path into the class cannot be the solution.
So: why isn't Groovy finding phantomjs under those circumstances?
Update: I suspect that this might have something to do with my IDE (IntelliJ Idea), as this error doesn't appear to be happening when running this from the command line.
As it turns out, this had everything to do with trying to run the tests from within my IDE (IntelliJ IDEA) and, more specifically, trying to do this on an OS X machine.
The solution was to add phantomjs to my PATH using launchd.conf. I...
created /etc/launchd.conf
added the following line to it: (note: I installed PhantomJS with Homebrew)
setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
restarted my machine so that the new launchd config would take effect.
went back into my IDE and re-ran the tests.
And all the tests ran successfully.
You can try printing your path with groovy
['sh', '-c', 'echo $PATH' ].execute().text
or
println System.getenv('PATH')
You can to create an environment variable with absolute path to phantomjs and verify it in runtime and to alert if it is not properly configured.

How to resolve the error "Unable to access jarfile ApacheJMeter.jar errorlevel=1" while initiating Jmeter?

Download Jmeter and execute the batch file (Jmeter\apache-jmeter-2.6\bin\jmeter.bat).
We get the error message in the console:
Unable to access jarfile ApacheJMeter.jar errorlevel=1
Kindly help me to resolve the problem.
Try downloading apache-jmeter-2.6.zip from http://www.apache.org/dist/jmeter/binaries/
This contains the proper ApacheJMeter.jar that is needed to initiate.
Go to bin folder in the command prompt and try java -jar ApacheJMeter.jar if the download is correct this should open the GUI.
Edit on 23/08/2018:
The correct answer as of current modern JMeter versions is https://stackoverflow.com/a/51973791/460802
I got this error today because the "Source" is missing the ApacheJmeter.jar. I downloaded it again from "Binaries" and everything works as expected.
JMeter should be started using :
jmeter/bin/jmeter.sh for Linux
jmeter/bin/jmeter.bat for windows
this will ensure correct property files are read and necessary jars in lib are loaded.
any other method will expose you to a lot of trouble.
the most upvoted answer is wrong !
See 1.4 Running JMeter in reference documentation :
https://jmeter.apache.org/usermanual/get-started.html
If you'd like to learn more about JMeter and performance testing this book can help you.
I'm running JMeter 2.8 (Windows 7) and received a message similar to that in the original post:
C:\>jmeter
Error: Unable to access jarfile C:\local\software\jMeter\apache-jmeter-2.8\binApacheJMeter.jar
errorlevel=1
Press any key to continue . . .
I'd created a Windows environment variable JMETER_BIN and set it to the JMeter path which I could see contained ApacheJMeter.jar (so it wasn't a question that the jar was missing).
I should have noticed at the time this portion of the error: "binApacheJMeter.jar"
When I went to the jmeter.bat file to troubleshoot, I noticed this line:
%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%
and that caused me to revisit the "binApacheJMeter.jar" portion of the error.
What was happening was that the batch file was requiring a trailing slash on the end of the path in the JMETER_BIN environment variable to correctly specify the location of the .jar.
Once I corrected my environment variable, adding the trailing slash, all was wonderful.
YMMV, but this worked for me.
If you'll go through these steps:
In the Terminal type brew install jmeter and hit Enter
When it'll be done type jmeter and hit Enter again
You won't have to solve any kind of issue.
Don't thank 😀
I faced with the same error, when i downloaded the Jmeter Source, and it got fixed once i downloaded Jmeter Binary. Please watch this video.
navigate to the url http://jmeter.apache.org/download_jmeter.cgi-->download apache-jmeter-2.11.zip, which is under binaries.
this error is occurring since Apache jmeter.jar is missing in bin folder
If you are using linux and faced such problem during creating link, try to change jar file path of original jmeter file.
+ java -server -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx512m -XX:NewSize=128m -XX:MaxNewSize=128m -XX:MaxTenuringThreshold=2 -XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled -jar ./ApacheJMeter.jar -help
Change to:
java $ARGS $JVM_ARGS -jar "/opt/apache-jmeter-2.11/bin/ApacheJMeter.jar" "$#"
Try to use updated JMeter version which is JMeter 3.0 now.
I had moved the apache jmeter folder to c:, open cmd with admin grant and execute jmater.bat.
This solved the problem for me.
This error could also happen because of version mismatch of jmeter and java. As jmeter versions supports different java versions as below.
Download the zip accordingly and you are good to go.
For people still getting the issue.
I face same problem and seems some .jar file missing.
so try tar -xf apache-jmeter-5.2.1.tgz in the console rather than just right click unzip. And also, try binary package if source package still has an issue.
this solve my issue (I am using ubuntu)
For window if you download scr folder say apache-jmeter-5.3_src then you won't find ApacheJMeter.jar file insider bin folder.One might have downloaded zip file under source section. Form this link download zip file under binaries section and click on ApacheJMeter.jar from bin folder https://jmeter.apache.org/download_jmeter.cgi
When we download the binary of apache-jmeter-x.x.tgz, where x could be any version of apache Jmeter. ApacheJMeter.jar must present inside apache-jmeter-x/bin folder , if it is not present somewhere your package not downloaded properly. Cause could be slow internet, or improper shutdown
Download package again and make sure ApacheJMeter.jar present in apache-jmeter-x/bin folder. Once it is present hit sh jemeter.sh
This issue will come if you download the source from the below URL :
https://jmeter.apache.org/download_jmeter.cgi
Solution :
Always download :
Apache JMeter 5.5 (Requires Java 8+)
Binaries
apache-jmeter-5.5.tgz sha512 pgp
apache-jmeter-5.5.zip sha512 pgp --- > This one
worked for me

Resources