i have 2 important pieces of code : - first one is in Python, - the other is a binary dos exe (i can not rewrite this one at all, i have wrapped it in a Java class, and it is working)
i'm using Java as a glue-ing, and incorporate my Python code by using Jython, i also have functional code for all these parts. Everything working fine in Eclipse as a standalone.
actually i would like to avoid any rewriting (not possible for the binary) or embedding Python part it is own Soap Service etc.
and i am defintively stick to Java due to other future included libraries!
now i am in the process of using a Soap Service via Axis2 over Tomcat server, i have an error "Exception occurred while trying to invoke service method"
i think that i may have some missing in how to indicate the path to the "import"-ed python modules as readed by the "ImportError: No module named mypymodule" (this module exists, and it correctly work when used from Java class in Eclipse)
i have added
PythonInterpreter interpreter = new PythonInterpreter(null, new PySystemState());
PySystemState sys = Py.getSystemState();
sys.path.append(new PyString("C:/jython2.5.2/Lib"));
sys.path.append(new PyString("d:/path/to/mypymodule")); // of course this is actually a realpath in my code
but it do not do the trick,
and i am also wodering if there is not a kind of securiy issue with Tomcat/Axis2 or rigth management forbidding access for some others directories?
it should also be notice that this "mypymodule" is not the one that is wrapped in the Java Factory Jython pattern but another external pure python module that is imported by this first one actually wrapped in Java.
please do you have any advices ?
Best regards,
(and i am expected some other future disagreements on the binary calling)
the full stack trace after changing to True the sendStacktraceDetailsWithFaults
<parameter name="sendStacktraceDetailsWithFaults">true</parameter>
is below
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Exception occurred while trying to invoke service method oWPL</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<Exception>org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method oneWordPerLine1
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:208)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
... 23 more
Caused by: Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named mypymodule
at org.python.core.Py.ImportError(Py.java:290)
at org.python.core.imp.import_first(imp.java:750)
at org.python.core.imp.import_name(imp.java:834)
at org.python.core.imp.importName(imp.java:884)
at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
at org.python.core.PyObject.__call__(PyObject.java:357)
at org.python.core.__builtin__.__import__(__builtin__.java:1173)
at org.python.core.imp.importFromAs(imp.java:978)
at org.python.core.imp.importFrom(imp.java:954)
at org.python.pycode._pyx0.f$0(<string>:1)
at org.python.pycode._pyx0.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1261)
at org.python.core.Py.exec(Py.java:1305)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:206)
at pyinterface.MyUtils.oWPL(MyUtils.java:127)
at pyinterface.MyUtils.oWPL(MyUtils.java:152)
... 29 more</Exception>
</soapenv:Detail>
</soapenv:Fault>