Re: [Py4j-users] Help Requested: error when accessing jvm for basic sample
Status: Beta
Brought to you by:
barthe
From: Barthelemy D. <ba...@cs...> - 2011-04-19 00:21:45
|
Hi Sean, this error means that the python interpreter cannot connect to the jvm either because: 1- The jvm is not yet started so nothing is listening on the default py4j port. 2- You have a firewall blocking the port. You need to start the java program in the example and then, you can start your python interpreter (not the other way around). If you don't have a firewall and if you started the Java program before running the interpreter, we will need more information to help you (e.g., how did you start the Java program, what is the output of the "netstat" command in a command prompt after starting the Java program, etc.). Barthélémy On Mon, April 18, 2011 8:07 pm, Sean Silvestri wrote: > HI All, > I'm just getting started with Py4J, basically just trying to call a > jar. I'm having trouble with the basic sample however: > > >>>> from py4j.java_gateway import JavaGateway gateway = JavaGateway() >>>> # connect to the JVM >>>> random = gateway.jvm.java.util.Random() # create a >>>> java.util.Random instance number1 = random.nextInt(10) >>>> # call the Random.nextInt method >>>> number2 = random.nextInt(10) print(number1,number2) > (2, 7) > >>>> addition_app = gateway.entry_point # get the >>>> AdditionApplication instance >>>> addition_app.addition(number1,number2) # call the addition method >>>> > 9 > > > I keep getting the following error: [Errno 10061] No connection could > be made because the target machine actively refused it > > I'm on python 2.71 for windows i have jre6 se installed have set path. > cheers, Sean > > > ------------------------------------------------------------------------- > ----- > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about > boosting the value of server virtualization. > http://p.sf.net/sfu/vmware-sfdev2dev > _______________________________________________ > Py4j-users mailing list > Py4...@li... > https://lists.sourceforge.net/lists/listinfo/py4j-users > > |