From: josu <jo...@we...> - 2007-10-02 16:52:41
|
Hi I am trying to execute a java program in jython (the same program). In java the execution (java -Doptions ServerApp2) is correct but in jython after importing the corresponding ServerApp2 class and run the main function, the next error appears: import ServerApp2 my_server=ServerApp2() my_server.main(["Hellow"]) Hellow Traceback (innermost last): File "<console>", line 1, in ? at ServerApp2.main(ServerApp2.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError Note that the -Doptions are included in jython by java.lang.system.setProperty Any suggestion? josu |
From: Michael C. <chi...@mi...> - 2007-10-03 15:40:19
|
That error means a class had a static initializer which threw an exception. I suggest you catch the error and print out the exception which caused it. E.g. error.getCause() (see http://java.sun.com/javase/6/docs/api/java/lang/ExceptionInInitializerError.html). That will tell you what's really going on. Andy josu wrote: > Hi > > I am trying to execute a java program in jython (the same program). In > java the execution (java -Doptions ServerApp2) is correct but in jython > after importing the corresponding ServerApp2 class and run the main > function, the next error appears: > > import ServerApp2 > my_server=ServerApp2() > my_server.main(["Hellow"]) > Hellow > Traceback (innermost last): > File "<console>", line 1, in ? > at ServerApp2.main(ServerApp2.java:85) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > > java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError > > > Note that the -Doptions are included in jython by > java.lang.system.setProperty > > Any suggestion? > > josu > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > |
From: David H. <dav...@gm...> - 2007-10-03 16:01:17
|
Hi Josu, Andy is correct; this is an error in the Java code and should be tracked down and fixed there. I have seen this error before when using Jython and can give one possible explanation for why it is affecting the Jython program but not the pure Java program. In my case the error was caused by a Java library whose classes had to be initialized in a certain order. Java classes are not supposed to be sensitive to the relative order in which they are initialized unless one explicitly references the other. However, a mistake in this regard may go undetected in pure Java programs because of how JVMs or Java compilers handle class initialization. In my case, the offending library was SWT, which was very heavily used with a variety of compilers and JREs without triggering the error. So, first track down the error like Andy suggested. If it is an order-of-initialization problem, either fix it or (if you don't control the Java library) figure out the correct order of initialization and explicitly import the classes in that order. -David |
From: josu <jo...@we...> - 2007-10-04 08:25:34
|
Hi again I have been making different trials and I think that the problem is derived from an initialization file (xml) embedded in a jar file. From jython this resource doesn't appear. are there problems with this kind of resources in Jython? thanks josu David Huebel(e)k dio: > Hi Josu, > > Andy is correct; this is an error in the Java code and should be > tracked down and fixed there. I have seen this error before when > using Jython and can give one possible explanation for why it is > affecting the Jython program but not the pure Java program. In my > case the error was caused by a Java library whose classes had to be > initialized in a certain order. Java classes are not supposed to be > sensitive to the relative order in which they are initialized unless > one explicitly references the other. However, a mistake in this > regard may go undetected in pure Java programs because of how JVMs or > Java compilers handle class initialization. In my case, the offending > library was SWT, which was very heavily used with a variety of > compilers and JREs without triggering the error. > > So, first track down the error like Andy suggested. If it is an > order-of-initialization problem, either fix it or (if you don't > control the Java library) figure out the correct order of > initialization and explicitly import the classes in that order. > > -David > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: josu <jo...@we...> - 2007-10-04 10:09:42
|
Finally, the problem was related to this question and I have follow the discussion about it in Re: [Jython-users] setting classpath for file resources <http://sourceforge.net/mailarchive/message.php?msg_id=788757333EF66346B2A3900375D10482061087%40messiah.jaraco.com> Regards josu josu(e)k dio: > Hi again > > I have been making different trials and I think that the problem is > derived from an initialization file (xml) embedded in a jar file. From > jython this resource doesn't appear. > > are there problems with this kind of resources in Jython? > > thanks > > josu > > David Huebel(e)k dio: > >> Hi Josu, >> >> Andy is correct; this is an error in the Java code and should be >> tracked down and fixed there. I have seen this error before when >> using Jython and can give one possible explanation for why it is >> affecting the Jython program but not the pure Java program. In my >> case the error was caused by a Java library whose classes had to be >> initialized in a certain order. Java classes are not supposed to be >> sensitive to the relative order in which they are initialized unless >> one explicitly references the other. However, a mistake in this >> regard may go undetected in pure Java programs because of how JVMs or >> Java compilers handle class initialization. In my case, the offending >> library was SWT, which was very heavily used with a variety of >> compilers and JREs without triggering the error. >> >> So, first track down the error like Andy suggested. If it is an >> order-of-initialization problem, either fix it or (if you don't >> control the Java library) figure out the correct order of >> initialization and explicitly import the classes in that order. >> >> -David >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users >> >> > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |