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:Timothy Wall (twal@dev.java.net)
Date:Oct 15, 2007 4:22:39 pm
List:net.java.dev.jna.users

On Oct 15, 2007, at 5:32 PM, Gregor B. Rosenauer wrote:

On Sunday 14 October 2007 23:37:49 Timothy Wall wrote:

You're using an old version of the jna library, you might consider rebuilding from SVN sources

Thanks, I did that but still got a crash on startup. Turned out to be a problem with using a static reference to the library, which ServiceMix did not seem to like (and it seems not "right" anyway). Rewrote to use a normal reference and moved it into the Endpoint's start()-method as opposed to the LifeCycle's start() and now I have not got any crashes so far. Also closing the library outside of the normal shutdown-procedure (accidentially in a Handler's processMessage-method...) seems to have contributed to this issue.

In systems that do a lot of application load/unloads, you probably want to avoid static references in general. The "INSTANCE" pattern is mostly just a convenience for normal applications. The JNA unit tests avoid it because they need to examine load/unload behavior, which gets rather tricky with static references.

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?