Skip to content

JAVAFX openimaj exception #505

Closed
Closed

Description

@fjgodino

I created a JavaFX application using the library:

core-video-capture-1.3-SNAPSHOT.jar

If I run the application using java:

java -jar myjarfile.jar

Its works perfectly.

But, If I run the application using WinLauncher.exe (JavaFX packaging) I have an
exception.

The program has unexpectedly finished

I actived the Bridj using:

set BRIDJ_VERY_VERBOSE=1

and I see this exception:

[JavaFX Application Thread] DEBUG SYSERR - java.lang.ExceptionInInitializerError
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.CallbackNativeImplementer.getDynamicCallback(CallbackNativeImplementer.java:98)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.CRuntime.getDynamicFunctionFactory(CRuntime.java:530)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.cpp.CPPRuntime.getConstructor(CPPRuntime.java:568)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.cpp.CPPRuntime.newCPPInstance(CPPRuntime.java:636)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:833)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.cpp.CPPRuntime$CPPTypeInfo.initialize(CPPRuntime.java:1)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.CRuntime$CTypeInfo.initialize(CRuntime.java:219)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.BridJ.initialize(BridJ.java:969)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.NativeObject.(NativeObject.java:23)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.StructObject.(StructObject.java:14)
[JavaFX Application Thread] DEBUG SYSERR - at org.bridj.cpp.CPPObject.(CPPObject.java:27)
[JavaFX Application Thread] DEBUG SYSERR - at org.openimaj.video.capture.OpenIMAJGrabber.(OpenIMAJGrabber.java:58)
[JavaFX Application Thread] DEBUG SYSERR - at org.openimaj.video.capture.VideoCapture.getVideoDevices(VideoCapture.java:220)
[JavaFX Application Thread] DEBUG SYSERR - at com.novovia.camaralib.NovoviaCamaraOIM.NovoviaCamara(NovoviaCamaraOIM.java:116)
....
I see the path of library is set up perfectly.
[JavaFX Application Thread] DEBUG SYSERR - may 20, 2014 4:10:07 PM org.bridj.BridJ log
Información: Property java.library.path = C:\Desarrollos\NovoviaSistema\sandbox\app;C:\Program Files\ImageMagick-6.8.8-Q16;C:\jet8.0-eval-amd64\bin;C:\Program Files (x86)\PC Connectivity Solution;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Mercurial;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\TortoiseHg;C:\Program Files\Microsoft Windows Performance Toolkit;C:\nodejs;C:\Git\cmd;C:\Program Files (x86)\Tesseract-OCR;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin;C:\Program Files\Calibre2;C:\Program Files\Microsoft Network Monitor 3;c:\users\bnb\appdata\local\enthought\canopy32\user\scripts;C:\Program Files (x86)\CMake 2.8;C:\Program Files\Java\jdk1.7.0_45\bin;C:\AppServ\Apache2.2\bin;C:\AppServ\php5;C:\AppServ\MySQL\bin;C:\apache-maven-3.0.5\bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\openCV;C:\Desarrollos\gradle-1.8\bin;C:\Program Files (x86)\Inno Setup 5;C:\cygwin64\bin;C:\Desarrollos\apache-ant-1.9.2\bin;;C:\Windows;C:\Windows\System32;C:\Program Files\Oracle\VirtualBox;C:\Desarrollos\JAVAFX_Android\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\Users\BNB\AppData\Roaming\npm;C:\Python27;C:\Program Files (x86)\Tesseract-OCR;C:\Users\BNB\AppData\Local\Enthought\Canopy32\User;C:\Users\BNB\AppData\Local\Enthought\Canopy32\User\Scripts;C:\Windows;C:\Windows\System32;C:\Windows\Microsoft.NET\Framework\v4.0.30319;

Do I need to load another library?

Thanks

Javier

Activity

  1. fjgodino commented on May 28, 2014

    @fjgodino
    Author

    We suppose that the error is with this line:

    private static final String bridjPackage = BridJ.class.getPackage().getName();
    

    and I'm ussing my own class loader. (An extension of URLClassLoader)

    ClassLoader sysldr = ClassLoader.getSystemClassLoader();
    ClassLoader urlClassLoader = new NURLClassLoader(urls, sysldr);
    Class launchClass = Class.forName(fxLaunchClassName, true,urlClassLoader);
    Method m = launchClass.getMethod("launchApplication", argTypes);
    

    and the bridjPackage must be null.

    Someone has idea how resolve it?

  2. ochafik commented on May 29, 2014

    @ochafik
    Member

    Hi @fjgodino,

    Thanks for your report and careful analysis!
    I've pushed a temptative symptomatic fix in the latest 0.7-SNAPSHOT. Other issues might creep up, please let me know if they do (happy to reopen this issue :-)).

    Cheers

  3. fjgodino commented on May 29, 2014

    @fjgodino
    Author

    Yes!!!..
    Thanks a lot!!.
    We are using openimaj and J.Hare gave me a lot of help.
    I will do more test including ubuntu.

  4. netomi commented on Feb 4, 2015

    @netomi

    Just fyi, as I ran into the same problem. The reason for this bug is most likely (at least it was in our case) a custom classloader that does not properly call definePackage on loaded classes. In such cases Class.getPackage() will return null (see for example here https://issues.apache.org/bugzilla/show_bug.cgi?id=4948)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions