Reputation: 6289
Github link:-
https://github.com/jarib/browsermob-proxy-rb
Am creating a proxy using browsermob proxy by following:-
require 'selenium/webdriver'
require 'browsermob/proxy'
server = BrowserMob::Proxy::Server.new("/path/to/downloads/browsermob-proxy/bin/browsermob-proxy") #=> #<BrowserMob::Proxy::Server:0x000001022c6ea8 ...>
server.start
While executing "server.start", it throws error like below:-
Error: Could not find or load main class net.lightbody.bmp.proxy.Main
BrowserMob::Proxy::Server::ServerDiedError: unable to launch the server (rerun with :log => true to see process output)
from /home/ubuntu/.rvm/gems/ruby-2.2.0@v-qa/gems/browsermob-proxy-0.2.0/lib/browsermob/proxy/server.rb:75:in `wait_for_startup'
from /home/ubuntu/.rvm/gems/ruby-2.2.0@v-qa/gems/browsermob-proxy-0.2.0/lib/browsermob/proxy/server.rb:34:in `start'
from (irb):13
from /home/ubuntu/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
How do i resolve this?
Upvotes: 3
Views: 1911
Reputation: 32855
Ran into the same problem.
I had only two files tryout-browsermob.rb
and browsermob-proxy
together under same folder and referenced as below:
server = BrowserMob::Proxy::Server.new("./browsermob-proxy")
But it turned out that having only a single browsermob-proxy
binary file wasn't enough.
The lib
folder is also needed after extracting the release zip file downloaded from https://github.com/lightbody/browsermob-proxy/releases.
It's better just extract the release zip into a folder and keep all files with the original folder structure.
/browsermob-proxy-2.1.4
/bin
/lib
/ssl-support
browsermob-core-2.1.4-javadoc.jar
browsermob-core-2.1.4-sources.jar
browsermob-rest-2.1.4-javadoc.jar
browsermob-rest-2.1.4-sources.jar
Then in the .rb
file, reference the binary like
server = BrowserMob::Proxy::Server.new("./browsermob-proxy-2.1.4/bin/browsermob-proxy")
If under Windows, use fully qualified path.
server = BrowserMob::Proxy::Server.new("D:\\browsermob\\browsermob-proxy-2.1.4\\bin\\browsermob-proxy.bat")
Upvotes: 0
Reputation: 2687
Make sure you put 'lib' folder with 'broowsermob-dist' jar file near the 'bin' folder.
Upvotes: 0