From: Patrick B. <bi...@st...> - 2004-03-10 08:32:22
|
Hi Guys, For our bookkeeping deparment i wrote a module to calculate monthly balances, if i run the module from the console (win) then it works perfectly, the spreadsheet is created and all goes fine. But when i run in from within our tn5250j-emulator that embeds jyhton and provides scripting, then i get a NullPointerException on the next line... wb = Workbook.createWorkbook(gbf) where gbf is a java File object obtained like this... gbf = javaos.File(str(gbdir) + javaos.File.separator + gbn + "-" + fc + "-" + mnd + str(jr) + ".xls") where gbdir is a networked drive that is configured as Z:\2004\grootboek on my windowsbox and fc = "STF", mnd = "MonthOfYear", jr = "Year" with an extra added extention for an excelsheet. so MonthOfYear is for example Januari, Year is for example 2004, so the spreadsheet created should be Z:\2004\grootboek\Grootboek-STF-Januari2004.xls This all works great when runned from console with ... Jython GB320.py but when runned through our emulator i get that NullPointerException on the place where wb is created, weird anyway. If i put a dir() in the very first few code line (while the imports are already done) i get this as result... <--- This the emulator displays when script is runned --> Invoking C:\tn5250j\scripts\GB320.py ['Alignment', 'Blank', 'BoldStyle', 'Boolean', 'BooleanCell', 'BooleanFormulaCel l', 'Border', 'BorderLineStyle', 'Cell', 'CellFormat', 'CellReferenceHelper', 'C ellType', 'CellView', 'Colour', 'DBConnect', 'DateCell', 'DateFormat', 'DateForm ats', 'DateFormulaCell', 'DateTime', 'ErrorCell', 'ErrorFormulaCell', 'Font', 'F ormula', 'FormulaCell', 'GridBag', 'Hyperlink', 'JXLException', 'Label', 'LabelC ell', 'Number', 'NumberCell', 'NumberFormat', 'NumberFormats', 'NumberFormulaCel l', 'Pattern', 'Range', 'Sheet', 'SheetSettings', 'StringFormulaCell', 'Vertical Alignment', 'Workbook', 'WorkbookSettings', 'WritableCell', 'WritableCellFormat' , 'WritableFont', 'WritableHyperlink', 'WritableImage', 'WritableSheet', 'Writab leWorkbook', 'WriteException', '__doc__', '__name__', '_session', 'access', 'app Exit', 'awt', 'biff', 'checkServer', 'cnvFirma', 'cnvMonth', 'crtExcelFiles', 'd bc', 'demo', 'format', 'javaos', 'read', 'result', 'runSQL', 'sql', 'swing', 'sy s', 'time', 'write', 'zxJDBC'] So as you can see the Workbook is there, because first i thought that should cause the troubles, but it is there, so i'm really curious why i get that NullPointerException anyway ??? This is all a pitty, cause i really love jython, but some apps, modules or classes i really need to run from within our emulator instead of from the console. So i hope there's a solution for this, and to make this mail complete i'll now include the complete error also.... so sorry for the BIG post. Oh BTW 190 is the wb = Workbook... statement and 162 is just the line that calls the function that holds the 190 line. Invoking C:\tn5250j\scripts\GB320.py ['fc', 'fn', 'gbdir', 'gbf', 'gbn', 'jr', 'mnd'] java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) at org.python.core.PyJavaClass.init__class__(Unknown Source) at org.python.core.PyJavaClass.init(Unknown Source) at org.python.core.PyJavaClass.initLazy(Unknown Source) at org.python.core.PyJavaClass.initialize(Unknown Source) at org.python.core.PyJavaClass.lookupGivingClass(Unknown Source) at org.python.core.PyClass.lookup(Unknown Source) at org.python.core.PyJavaClass.__findattr__(Unknown Source) at org.python.core.PyObject.__getattr__(Unknown Source) at org.python.pycode._pyx0.crtExcelFiles$7(C:\tn5250j\scripts\GB320.py:190) at org.python.pycode._pyx0.call_function(C:\tn5250j\scripts\GB320.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.pycode._pyx0.runSQL$5(C:\tn5250j\scripts\GB320.py:162) at org.python.pycode._pyx0.call_function(C:\tn5250j\scripts\GB320.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyCompoundCallable.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.proxies.java.awt.event.ActionListener$Adapter.actionPerformed(Unk nown Source) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Best Regards, Patrick Sysop/Java-programmer Stafa Holland BV Administrator/Programmer Memoranda-project (SourceForge) Programmer TN5250J-project (SourceForge) Programmer DBPirate-project (Java.net) |