pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandro Martini (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIVOT-917) Pivot cannot find inner classes in the CLASSPATH when invoked from Jython
Date Wed, 02 Oct 2013 11:21:25 GMT

    [ https://issues.apache.org/jira/browse/PIVOT-917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13783842#comment-13783842
] 

Sandro Martini commented on PIVOT-917:
--------------------------------------

Hi, I just committed an updated sample that works, but sorry for Groovy Scripting (in the
usual pivot-stuff-common-groovy project). The trick was to define all methods required by
Pivot in a class (for simplicity defined inside the script) implementing Application (and
with the right signature, not too dynamically oriented, I know). 
Then add a step to call the Groovy Compiler (and add the output class folder in the classpath).

So probably for Pivot 2.1 we have only something to improve (already in development, mainly
related to classloaders), and not things to fix (I hope) :-) .

Could you try to do the same in your samples (Jython) and tell something to us (maybe add
here in attach an updated version) ? Thank you very much.


> Pivot cannot find inner classes in the CLASSPATH when invoked from Jython
> -------------------------------------------------------------------------
>
>                 Key: PIVOT-917
>                 URL: https://issues.apache.org/jira/browse/PIVOT-917
>             Project: Pivot
>          Issue Type: Bug
>          Components: pivot-on-apache-extras
>    Affects Versions: 2.0.3
>            Reporter: Jose V Nunez
>            Assignee: Sandro Martini
>              Labels: jython
>             Fix For: 2.1
>
>         Attachments: HelloBXML.py, run_HelloBXML.sh
>
>
> The following is similar to the simple Hello world BXML from the PIVOT website (http://pivot.apache.org/tutorials/hello-bxml.html,
file hello.bxml content is identical):
> {code}
> #!/usr/bin/env jython
> from org.apache.pivot.beans import BXMLSerializer
> from org.apache.pivot.collections import Map
> from org.apache.pivot.wtk import Application
> from org.apache.pivot.wtk import Display
> from org.apache.pivot.wtk import Window
> from org.apache.pivot.wtk import DesktopApplicationContext
> from java.lang import Runnable, Exception as Ex
> from javax.swing import SwingUtilities
> import sys,subprocess,os,re, traceback
> class HelloBXML(Application):
>         def __init__(self):
>                 self.window = None
>                 self.bxmlSerializer = BXMLSerializer()
>         def startup(self, display, properties):
>                 self.window = self.bxmlSerializer.readObject(HelloBXML, "hello.bxml")
>                 self.window.open(display)
>         def shutdown(self, optional):
>                 if self.window != null:
>                         window.close()
>                 return False;
>         def suspend(self):
>                 pass
>         def resume(self):
>                 pass
> class Task(Runnable):
>         def __init__(self, argv):
>                 self.argv = argv
>         def run(self):
>                 DesktopApplicationContext.main(HelloBXML, self.argv)
> if __name__ == "__main__":
>         try:
>                 SwingUtilities.invokeAndWait(Task(sys.argv[1:]))
>         except:
>                 traceback.print_exc(file=sys.stderr)
>                 sys.exit(192)
> {code}
> Exception stack trace:
> {code}
> # Script file: ~/HelloBXML.py
> java.lang.ClassNotFoundException: org.python.proxies.__main__$HelloBXML$1
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:186)
>         at org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:606)
>         at org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:881)
>         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.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
>         at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
>         at org.python.core.PyObject.__call__(PyObject.java:404)
>         at org.python.core.PyObject.__call__(PyObject.java:408)
>         at org.python.pycode._pyx0.run$9(/home/jnunezzu/HelloBXML.py:39)
>         at org.python.pycode._pyx0.call_function(/home/jnunezzu/HelloBXML.py)
>         at org.python.core.PyTableCode.call(PyTableCode.java:165)
>         at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
>         at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
>         at org.python.core.PyFunction.__call__(PyFunction.java:387)
>         at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220)
>         at org.python.core.PyMethod.__call__(PyMethod.java:211)
>         at org.python.core.PyMethod.__call__(PyMethod.java:201)
>         at org.python.core.PyMethod.__call__(PyMethod.java:196)
>         at org.python.core.PyObject._jcallexc(PyObject.java:3502)
>         at org.python.core.PyObject._jcall(PyObject.java:3534)
>         at org.python.proxies.__main__$Task$2.run(Unknown Source)
>         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
>         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
>         at java.awt.EventQueue.access$000(EventQueue.java:101)
>         at java.awt.EventQueue$3.run(EventQueue.java:666)
>         at java.awt.EventQueue$3.run(EventQueue.java:664)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
>         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
>         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
>         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
>         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
>         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
>         at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
> {code}
> I tested this with the following configuration:
> {code}
> Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
> [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0
> Type "help", "copyright", "credits" or "license" for more information.
> java -version
> java version "1.7.0"
> Java(TM) SE Runtime Environment (build 1.7.0-b147)
> Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
> uname -a
> Linux XXXX 2.6.18-348.3.1.el5 #1 SMP Tue Mar 5 13:19:32 EST 2013 x86_64 x86_64 x86_64
GNU/Linux
> echo $CLASSPATH
> /home/jose/src/apache-pivot-2.0.3/lib/hello.bxml:/home/jose/src/apache-pivot-2.0.3/lib/pivot-wtk-terra-2.0.3.jar:/home/jose/src/apache-pivot-2.0.3/lib/pivot-wtk-2.0.3.jar:/home/jose/src/apache-pivot-2.0.3/lib/pivot-web-server-2.0.3.jar:/home/jose/src/apache-pivot-2.0.3/lib/pivot-web-2.0.3.jar:/home/jose/src/apache-pivot-2.0.3/lib/pivot-core-2.0.3.jar:/home/jose/src/apache-pivot-2.0.3/lib/pivot-charts-2.0.3.jar::.
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message