I would like to know if I can inter-operate servlets written in java with ZK with python through jpype. I've just learned about jpype and I am doing some kind of "hello world" programs but my final goal would be use ZK and python, do you think it would be possible?
BR/
Waster
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nothing prevents it. Python has to be the "host" though, so you'll essentially have to "embed" the servlet container in python by using jpype. After that, if you want the servlets to call python code you'll have to figure out a way to give references to the python object to the servlets.
All in all not an easy task. But if you can get it done (say, using tomcat?) I am sure many other would love to reuse your work. I would gladly put it in as some kind of official jpype "addon".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I have done some proof of concept to know how complex it would be. First I did several python-java integration with openJMS without any problem, but i run into some difficulties when i tried to embed tomcat into python. Finally I have tomcat runnig into python and I am able to delegate the implementation of the java servlet to python, almost...
I am using a factory to pass the implementation from python to java, in java, the factory return interfaces and the implementation of this factory in python return jproxies. Every thing went fine until i started to have some python runtime exceptions in the invocation of some interfaces from java that are implemente in python. I mean, some java interfaces invocation go well but other caused an exceptions,
and this whit an exception
..
...
Jul 3, 2009 3:57:42 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1128
SEVERE: >>java.lang.RuntimeException: Python exception thrown
>> at jpype.JPypeInvocationHandler.hostInvoke(Native Method)
>> at jpype.JPypeInvocationHandler.invoke(JPypeInvocationHandler.java:10)
>> at $Proxy1.hashCode(Unknown Source)
>> at java.util.HashMap.put(HashMap.java:372)
>> at java.util.HashSet.add(HashSet.java:200)
>> at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:195)
>> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:141)
>> at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:488)
>>...
I I suppose I have made a little mistake in python, but with this information in the stack trace I can't see anything.
could you give any guide? do you have any suggestion?
thx
waster.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-11-04
Why dont you use jetty instead of tomcat. We have done setting up jetty with jpype to run solr, an it works fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi guys,
I would like to know if I can inter-operate servlets written in java with ZK with python through jpype. I've just learned about jpype and I am doing some kind of "hello world" programs but my final goal would be use ZK and python, do you think it would be possible?
BR/
Waster
Nothing prevents it. Python has to be the "host" though, so you'll essentially have to "embed" the servlet container in python by using jpype. After that, if you want the servlets to call python code you'll have to figure out a way to give references to the python object to the servlets.
All in all not an easy task. But if you can get it done (say, using tomcat?) I am sure many other would love to reuse your work. I would gladly put it in as some kind of official jpype "addon".
Hi, I have done some proof of concept to know how complex it would be. First I did several python-java integration with openJMS without any problem, but i run into some difficulties when i tried to embed tomcat into python. Finally I have tomcat runnig into python and I am able to delegate the implementation of the java servlet to python, almost...
I am using a factory to pass the implementation from python to java, in java, the factory return interfaces and the implementation of this factory in python return jproxies. Every thing went fine until i started to have some python runtime exceptions in the invocation of some interfaces from java that are implemente in python. I mean, some java interfaces invocation go well but other caused an exceptions,
this is trace for one ok.
INFO: calling python factory
.............................received callback from java
Jul 3, 2009 3:57:39 PM jpype.JPypeInvocationHandler hostInvoke
INFO: Creating formCmp...
created form......................
Creating DropComponentEventListener
adding event listener..................
returning formCmp componente
and this whit an exception
..
...
Jul 3, 2009 3:57:42 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1128
SEVERE: >>java.lang.RuntimeException: Python exception thrown
>> at jpype.JPypeInvocationHandler.hostInvoke(Native Method)
>> at jpype.JPypeInvocationHandler.invoke(JPypeInvocationHandler.java:10)
>> at $Proxy1.hashCode(Unknown Source)
>> at java.util.HashMap.put(HashMap.java:372)
>> at java.util.HashSet.add(HashSet.java:200)
>> at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:195)
>> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:141)
>> at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:488)
>>...
I I suppose I have made a little mistake in python, but with this information in the stack trace I can't see anything.
could you give any guide? do you have any suggestion?
thx
waster.
Why dont you use jetty instead of tomcat. We have done setting up jetty with jpype to run solr, an it works fine.