7 messages in net.java.dev.jna.usersRe: [jna-users] JVM-Crash with JNA
FromSent OnAttachments
Gregor B. RosenauerOct 14, 2007 2:08 pm 
Timothy WallOct 14, 2007 2:37 pm 
Gregor B. RosenauerOct 15, 2007 2:32 pm 
Timothy WallOct 15, 2007 4:22 pm 
Gregor B. RosenauerOct 20, 2007 10:38 am 
Gregor B. RosenauerNov 27, 2007 8:21 am 
Timothy WallNov 27, 2007 9:45 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] JVM-Crash with JNAActions...
From:Gregor B. Rosenauer (greg@gmail.com)
Date:Nov 27, 2007 8:21:30 am
List:net.java.dev.jna.users

Just for the record (and the archive;):

My JBI/ServiceMix-related problem with unexpected crashes was solved by taming the external C-library I was using: the error messages below definitely originated from that libary, which was simply exit()ing in case of an error (!), so no ServiceMix- or JNA-related problems, only the library crashed.

I solved the problem in several steps: * configure the library not to exit on errors (doh!) * initialize the library not in JBI's BootStrap or LifeCycle, but in a separate singleton-class that cleanly limits access to the library over a single interface (the lib seems not to be multithreading-friendly) and lazily initializes the lib on first use (which is in the BindingComponent's processIn()-method)

Maybe this is of use to someone, I am now a true fan of JNA:) Gregor

Seems also to have to do with ServiceMix's classloader, as I get some errors when initializing the API in multiple BindingComponent-instances in the same ServiceAssembly at once:

-E- CDI: <Line:1> (cin) already declared in this scope -E- CDI: <Line:1> (cout) already declared in this scope -E- CDI: <Line:1> (cerr) already declared in this scope -E- CDI: <Line:1> (S_ISUID) already declared in this scope

Do you know what portion(s) of code are defining these symbols?

NativeLibrary and Function are set up to use a static map to avoid multiple loads of the same library. Does ServiceMix use a classloader per context, or a single classloader that loads and unloads classes?