BrowserMob::Proxy::Server.new don't work anymore :(

280 views
Skip to first unread message

Daka

unread,
Oct 25, 2016, 6:53:24 AM10/25/16
to BrowserMob Proxy
This what I had as code a year ago:
def fire_browser dv
    server
= BrowserMob::Proxy::Server.new("/Volumes/BACKUP/adsscanner/browsermob-proxy-2.1.2/bin/browsermob-proxy") #=> #<BrowserMob::Proxy::Server:0x000001022c6ea8 ...>


 server
.start
 puts
"test"
      proxy
= server.create_proxy


      profile
= Selenium::WebDriver::Firefox::Profile.new
      profile
['general.useragent.override'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0'#device['useragent']
      puts dv
['useragent']
      profile
.proxy = Selenium::WebDriver::Proxy.new :http => 'localhost:9091', :ssl => 'localhost:9091'
      time
= Time.now.getutc
      puts APP_ROOT
      proxy
.new_har time
     
@@b = Watir::Browser.new :firefox, :profile => profile
     
#return @@b
end

I get error after server.start:

/Library/Ruby/Gems/2.0.0/gems/browsermob-proxy-0.1.8/lib/browsermob/proxy/server.rb:75:in `wait_for_startup': unable to launch the server (rerun with :log => true to see process output) (BrowserMob::Proxy::Server::ServerDiedError)


        from /Library/Ruby/Gems/2.0.0/gems/browsermob-proxy-0.1.8/lib/browsermob/proxy/server.rb:34:in `start'


        from init.rb:73:in `fire_browser'


        from init.rb:46:in `block (5 levels) in initialize'


        from init.rb:45:in `each'


        from init.rb:45:in `block (4 levels) in initialize'


        from init.rb:43:in `each'


        from init.rb:43:in `block (3 levels) in initialize'


        from init.rb:39:in `each'


        from init.rb:39:in `block (2 levels) in initialize'


        from init.rb:37:in `each'


        from init.rb:37:in `block in initialize'


        from init.rb:35:in `each'


        from init.rb:35:in `initialize'


        from init.rb:125:in `new'


        from init.rb:125:in `<main>'




it is written in ruby, maybe 

Jayson Smith

unread,
Nov 29, 2016, 7:53:38 PM11/29/16
to BrowserMob Proxy
I'm running into the same thing. When running it with log I get the following:

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/lightbody/bmp/proxy/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
/Users/jsmith/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/browsermob-proxy-0.2.0/lib/browsermob/proxy/server.rb:75:in `wait_for_startup': unable to launch the server (rerun with :log => true to see process output) (BrowserMob::Proxy::Server::ServerDiedError)
from /Users/jsmith/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/browsermob-proxy-0.2.0/lib/browsermob/proxy/server.rb:34:in `start'
from bmob.rb:8:in `configure_proxy'
from bmob.rb:51:in `<main>'

When running java -version I get:

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

Any ideas as to what this could be would be appreciated. 

Thanks,

Js

⇜Krishnan Mahadevan⇝

unread,
Nov 29, 2016, 10:12:22 PM11/29/16
to browserm...@googlegroups.com
Jason,
This for sure is a Java related error. You would need to ensure that you are being resolved to JDK8

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--

---
You received this message because you are subscribed to the Google Groups "BrowserMob Proxy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-proxy+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jayson Smith

unread,
Nov 30, 2016, 5:55:59 PM11/30/16
to BrowserMob Proxy
Hey Krishnan,

Thanks for that tip. Definitely proved helpful!

For others who may be battling with this, please read on! If you run the script with log: true and get the same issue that I did, then make sure your JAVA_HOME is setup to point to the right location and that it's also set in your $PATH.

For me to get things working, this is what I have:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

I also updated my $PATH with: 

export PATH=$JAVA_HOME/jre/bin:$PATH

$PATH now looks like: 

PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/bin:/Users/jsmith/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin

Hope this helps!

I'm now running into other issues that I've been unable to solve just yet, but am continuei

Thanks,

Js
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-pro...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to browsermob-pro...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages