Re: JNI EXCEPTION_ACCESS_VIOLATION




Hi there.

I am not experienced (I never did) 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
same DLL via C++ or other windows native language, and, use the same
thing on the test app that your Java app uses, and, see if the crash
still occurs. This way, you will be able to isolate if the error is
internal of the dll or of the way you are using it in Java - even if
the error only happens sometimes under certain so quasai conditions -
but, as said before, it does not mean that the code is entirely ok.

Hope I Helped,
- Inácio Ferrarini

esandfort wrote:
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

  • JNI EXCEPTION_ACCESS_VIOLATION
    ... I have a java application which calls into a VC++ DLL via JNI. ... The code will NOT crash when running under Windows 2000 Service Pack 4 ...
    (comp.lang.java.programmer)
  • Re: Java programmer lured back by .Net (Questions)
    ... in .NET a form is simply a class so yes it could easily be placed into a DLL and then use Ngen to make a native image of it. ... Of course it learned a lot from Java, and improved upon many things which Java is slowly catching up on. ... As far as code security you're in the same boat as Java since it compiles down to MSIL instead of bytecode of which both can reverse engineered very easily. ... I would like to be able to place my executable on my remote server and then "load" the executables on demand from accross the internet - so that there are no executables on the local machine for prying eyes to reverse engineer. ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Java programmer lured back by .Net (Questions)
    ... in .NET a form is simply a class so yes it could easily be placed into a DLL and then use Ngen to make a native image of it. ... Of course it learned a lot from Java, and improved upon many things which Java is slowly catching up on. ... As far as code security you're in the same boat as Java since it compiles down to MSIL instead of bytecode of which both can reverse engineered very easily. ... My backend is pure Java running on Unix - but because SWING is so ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: How stable is 1.5?
    ... >> I'm still getting the odd random error in various java programs ... >> happening randomly in various java apps. ... I got one more crash that looks like the same problem as the ... The crash happens when a window peer is disposed. ...
    (comp.lang.java.programmer)
  • Re: JNI interoperating with .net DLL?
    ... CLR DLL which export extern "C" function API to call 3. ... It works by calling as a standalone java class. ... what I need is to call functions in this class from a TOMCAT environment. ... I realised that if I remov the "Actual .NET" function call in the CLR DLL in step 2. ...
    (comp.lang.java.programmer)