B4J Question Nexreports 9.1

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello All,
I cannot run the next reports lib.
I always get tho following error when running the project

The Code

B4X:
Sub Reporting(Reportname As String)
    'File separator character is set, according to the OS detected.
    Dim inputlist As List
    Dim inlocation,repin, repout, reptype, driverclass, url As String
    '
    inlocation=iniBD & "\reports" 'For this demo the report is stored in the Objects/reports directory. You can specify any other directory.
    'name of report created by NextReports.
    repin=Reportname ' Report specified: Report_name.report - No need for the .report extension
        'Output file specification
    repout=Reportname 'name of output report
    reptype="PDF"  ' Available options: CSV, TXT, XLS, XML, PDF, HTML or RTF. File type must be in CAPITALS.
    'Output file will be MYOUTPUT.RTF. Output file (and any necessary images) will be stored in your application directory

    '   logs the location of the report file
    Log("Location = " & inlocation)
    'replace this by your database driver class name
    driverclass="com.sqlite.jdbc.Driver"            '    driver class for Mysql
 
    'replace this by applicable url for your database
    'I use IP instead of server name. For some reason, in my tests with SQL SERVER, when I used server name, it would not not work on MACs
    'jdbc:mysql://localhost:3306/HerongDB?user=Herong&password=TopSecret
    'url="jdbc:sqlite://127.0.0.1:3306/database_name?user=db_user&password=user_pw"
     url="jdbc:sqlite://127.0.0.1:3306/database_name=database?user=&password="
    'Initialize input list and add necessary arguments in the order shown below
    inputlist.initialize
    inputlist.Add(inlocation)
    inputlist.add(repin)
    inputlist.add(repout)
    inputlist.add(reptype)
    inputlist.add(driverclass)
    inputlist.add(url)
 
    '    Now add your parameters - if any
    '    First, the parameter name - as it was defined in NextReports ie.
    '    add compare field in Report Designer ${surname}
    '    Then add your parameter value - see examples below...
    '
    '    inputlist.add("surname")
    '    inputlist.add("xxxxx")
    '
    '    for dates use dates from DatePicker inputs on the B4j UI
    '
'    Dim t As Long
'    '
'    t = dpDateFrom.DateTicks
'    inputlist.add("start_date")
'    inputlist.add(TicksToDate(t))
'    '
'    t = dpDateTo.DateTicks
'    inputlist.add("end_date")
'    inputlist.add(TicksToDate(t))
'    '
    '    you can add as many parameters as necessary
    '
    Try
        report.reportPrepAndRun(inputlist)
    Catch
        Log("Error: Loading Reports : " & LastException.Message)
    End Try
        fx.ShowExternalDocument(File.GetUri(File.DIRAPP, repout & "." & reptype))
    '
End Sub

The Error in the Log window

B4X:
Waiting for debugger to connect...
Program started.
INSERVICE
Location = C:\Users\pedro\Desktop\SIZ\Comum\reports
java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at ro.nextreports.engine.util.ReportUtil.loadReport(ReportUtil.java:182)
    at ro.nextreports.integration.ReportSupport.loadReport(ReportSupport.java:30)
    at ro.nextreports.integration.ReportExec.reportPrepAndRun(ReportExec.java:86)
    at p2g.SIZ.main._reporting(main.java:4433)
    at p2g.SIZ.main._btnprintreportmovs_click(main.java:4358)
    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:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.GeneratedMethodAccessor9.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:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    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.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 more
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:120)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    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.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at ro.nextreports.engine.util.ReportUtil.loadReport(ReportUtil.java:182)
    at ro.nextreports.integration.ReportSupport.loadReport(ReportSupport.java:30)
    at ro.nextreports.integration.ReportExec.reportPrepAndRun(ReportExec.java:86)
    at p2g.SIZ.main._reporting(main.java:4433)
    at p2g.SIZ.main._btnprintreportmovs_click(main.java:4358)
    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:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.GeneratedMethodAccessor9.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:91)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 more
 
Last edited:

Pedro Caldeira

Active Member
Licensed User
Longtime User
If I run it in release mode I get:

B4X:
main._reporting (java line: 4415)
java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
    at ro.nextreports.engine.util.ReportUtil.loadReport(ReportUtil.java:182)
    at ro.nextreports.integration.ReportSupport.loadReport(ReportSupport.java:30)
    at ro.nextreports.integration.ReportExec.reportPrepAndRun(ReportExec.java:86)
    at p2g.SIZ.main._reporting(main.java:4415)
    at p2g.SIZ.main._btnprintreportmovs_click(main.java:1689)
    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.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    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.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 18 more
 
Upvote 0
Top