Re: [Py4j-users] Error when accessing jvm for basic sample (take 2)
Status: Beta
Brought to you by:
barthe
From: bn <av...@ya...> - 2011-10-24 14:13:27
|
Hi Barthelemy, Yes, that did the trick! With the firewall enabled even. The actual context is that I'm writing a java plugin to create a python scripting api for the main app. I open up the gateway in java and launch the python script in a subprocess, and the script can then make api calls through the gateway. So both sides are always on the same host. The main app is a dlna server itself (http://code.google.com/p/ps3mediaserver/) and when serving multiple dlna clients concurrently will need to run separate py4j instances on different sockets. Is there any gateway discovery magic in the forthcoming py4j that can sort this out automatically, or do I need to pass address:port to python in each instance (which actually wouldn't be hard since it's a subprocess and I can set environment variables). Thanks, using py4j has been very smooth sailing apart from this tiny bump in windows. -Bahman --- On Mon, 10/24/11, Barthelemy Dagenais <ba...@cs...> wrote: > From: Barthelemy Dagenais <ba...@cs...> > Subject: Re: [Py4j-users] Error when accessing jvm for basic sample (take 2) > To: "Support and Comments about Py4J" <py4...@li...> > Date: Monday, October 24, 2011, 6:03 AM > Hi Bahman, > > Just to make sure, are you trying to start both the client > and the > server on the same host? > > I think this is a bug that I fixed in the forthcoming > version of Py4J (0.8). > > I'm not super familiar with windows networking but I think > the Java > server is listening on 192.168.1.39 while the Python client > is trying to > connect to 127.0.0.1 (localhost). > > In the new version of Py4J, the server always listen to > localhost by > default (instead of all interfaces/ips, which was bad > security), but > this can be configured. > > In the meantime, you could try specifying an ip in the > Python client: > > from py4j.java_gateway import GatewayClient, JavaGateway > g_client = GatewayClient(address='192.168.1.39') > gateway = JavaGateway(gateway_client=g_client) > > Does that work? > > Barthélémy > |