B4J Question jaxbContext error

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Hi!
I recently began working with a library that helps me to create XML, i have wrapped most of the library with javaObject and works more or less okey.

but there is a problem! i have the following error:

Error occurred on line: 163 (comprobante33)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at b4j.example.comprobante33._build(comprobante33.java:271)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:84)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1072)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at com.generarxml.cfdi33.CrearXmlCFDi33.a(SourceFile:134)
at com.generarxml.cfdi33.CrearXmlCFDi33.generarXMLCFDi33(SourceFile:76)

But this happens only in debug... in release it works without problems. also, it works when instead of using java object i create the whole process in inline java, i decompiled the library and found the line 134 (referenced in bytecode)

B4X:
jaxbContext = JAXBContext.newInstance(Comprobante.class);

also, one of my tests was to include the created release jar as an additional jar, the debugger did not like this and throw an error "cannot connect debugger" ... well the error did not happen and i created my xml.

further investigations resulted that if i take away the ResumableSub of the line where i am building the xml, it will also build the xml without problems.

ty!
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Thank you Erel. There arent events raised, afaik.

I solved the issue making the sub where i called the build action non async. (by not having any wait for or sleep in it. then debugging worked.
 
Upvote 0
Top