Exception: Can't connect to Browsermob-Proxy

1,915 views
Skip to first unread message

PRONOjit

unread,
Oct 2, 2015, 6:22:15 AM10/2/15
to BrowserMob Proxy
Hi,

I have the following:
```
from browsermobproxy import Server
server = Server("/Users/username/Desktop/browsermob-proxy/bin/browsermob-proxy")
server.start()
proxy = server.create_proxy() 
```

I'm getting the error on server.start().
```Exception: Can't connect to Browsermob-Proxy```

Further on terminal, if I do ```/Users/username/Desktop/browsermob-proxy/bin/browsermob-proxy -port 9090``` I get the following error:
```
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)
```
It seems to be some issue with the version number, but not sure what exactly it is. Thanks. 

Dakota Smith

unread,
Oct 2, 2015, 9:11:30 AM10/2/15
to browserm...@googlegroups.com
I believe that error occurs when you need to update the version of Java your system is running.


On Fri, Oct 2, 2015 at 5:20 AM, PRONOjit <pronoj...@gmail.com> wrote:
Hi,

I'm getting the same error on server.start()

```Exception: Can't connect to Browsermob-Proxy```

I also have the following:
```
from browsermobproxy import Server
server = Server("/Users/username/Desktop/browsermob-proxy/bin/browsermob-proxy")
server.start()
proxy = server.create_proxy() 
```


Further on terminal, if I do ```/Users/username/Desktop/browsermob-proxy/bin/browsermob-proxy -port 9090``` I get the following error:
```
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)
```
It seems to be some issue with the version number, but not sure what exactly it is. Thanks. 

--

---
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-pro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PRONOjit

unread,
Oct 2, 2015, 2:27:15 PM10/2/15
to BrowserMob Proxy
Hi Dakota, 

Thanks for the response. As per the thread the JRE and JDK need to be the same version. So I upgraded to JDK8 and when I check on terminal the versions of JRE and JDK I get both same version as below:

$ java -version

java version "1.8.0_60"

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)

Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


$ javac -version

javac 1.8.0_60


But I still get the sam error for browsermobproxy. What seems to be the issue now?

Dakota Smith

unread,
Oct 2, 2015, 2:38:53 PM10/2/15
to browserm...@googlegroups.com
Have you set your $JAVA_HOME?


In my .bash_profile, I added the line which is called out in the accepted answer

export JAVA_HOME=$(/usr/libexec/java_home)
After I did that, and restarted my terminal, I was able to launch BMP. 

Hope this works for you!

PRONOjit

unread,
Oct 3, 2015, 6:37:04 AM10/3/15
to BrowserMob Proxy
Yes, that did the trick for me too! Thanks a lot Dakota, appreciate it. 

PRONOjit

unread,
Oct 3, 2015, 9:46:33 AM10/3/15
to BrowserMob Proxy
Hi Dakota, 

Continuing on my quest, the HAR file I get using selenium and browsermobproxy (using the intro code here: https://browsermob-proxy-py.readthedocs.org/en/latest/) is not the same as the one I am getting when I save as a HAR file manually from developer tools in chrome. 

As in the attached picture, when I right click and do 'save ALL as HAR' on the network pane I get all the data for the files mentioned in a single HAR file (i am particularly interested in the xml file details), but thats not the case with selenium and browsermobproxy. Am I missing something here?

Thanks. 
HAR.jpg
Reply all
Reply to author
Forward
0 new messages