JNI EXCEPTION_ACCESS_VIOLATION



I have a java application which calls into a VC++ DLL via JNI. Within
the DLL, I call some code via a 3rd party API which ultimately does
some disk IO. When the "File Writing" code is hit, my application
crashes. I get the following error (I'll spare you the entire dump)

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at
PC=0x7C9111DE
Function=wcsncpy+0x74F
Library=C:\WINDOWS\system32\ntdll.dll

Here are a couple of interesting points...

The code will crash when running under XP Service Pack 2
The code will NOT crash when running under Windows 2000 Service Pack 4

When running on XP, the code will crash if the java progam makes either
of the following calls before making the JNI call:

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
- or -
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

When running on XP, the code will NOT crash if I omit the
setLookAndFeel() call all together, or use an alternate L&F (Metal for
example)

I have spent the past couple of days trying to find clues to this
problem on the newsgroups, and have had absolutely no luck.

If anyone has any experience with this problem, I would appreciate any
leads.

Also - if anyone could recommend any tools and/or techniques that would
be useful in debugging a VM crash such as I described above, that would
be appreciated as well.

Thanks!

Ed Sandfort

.



Relevant Pages

  • Re: JNI EXCEPTION_ACCESS_VIOLATION
    ... I am not experienced in coding a dll and access it via ... Java, but, I would say to you that, if you do not mind, try to use the ... The code will crash when running under XP Service Pack 2 ... The code will NOT crash when running under Windows 2000 Service Pack 4 ...
    (comp.lang.java.programmer)
  • Re: Events with dll in java
    ... It's probably best to get the information out of the 'C' world of JNI and into ... class which your DLL invokes on every keystroke. ... reference and cache it in your DLL -- don't forget to release it later). ... You can implement that simply by starting a Java thread ...
    (comp.lang.java.programmer)
  • Extremely strange crash problem in JNI
    ... JNI call that cause the java application to generate random signals ... strange part is that it would crash even if we don't create any actual ... We thought the problem might be caused by some namespace conflict ...
    (comp.lang.java.programmer)
  • Re: Use a C# dll from Java
    ... How I can use all functions from Java? ... in Java but I read about jni. ... If you have an existing DLL it doesn't matter what language it was written in, as long as its functions can be called using C calling conventions. ... obviously because the file MyApp.exe contains CIL not x86 object code. ...
    (comp.lang.java.help)
  • Re: how can i create a dll
    ... >how can i create a dll in java? ... Then you link to it with JNI. ... The alternative as to collect some java class files together in a Jar ... Canadian Mind Products, Roedy Green. ...
    (comp.lang.java.programmer)