JVM crashes when calling C++ DLL

C

chella mani

hi all,
I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.

ie java <---->Wrapper C++ <-----> Ordinary C++ function

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for
possible
reason and solutions.


Current Java thread:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.getMethod0(Class.java:1893)
at java.lang.Class.getMethod(Class.java:976)
at javax.swing.UIDefaults.getUI(UIDefaults.java:726)
at javax.swing.UIManager.getUI(UIManager.java:784)
at javax.swing.JToolTip.updateUI(JToolTip.java:82)
at javax.swing.JToolTip.<init>(JToolTip.java:64)
at javax.swing.JComponent.createToolTip(JComponent.java:2603)
at javax.swing.ToolTipManager.showTipWindow(ToolTipManager.java:257)
at javax.swing.ToolTipManager$insideTimerAction.actionPerformed(ToolTipManager.java:689)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Dynamic libraries:
0x7CC00000 - 0x7CC1D000 C:\WINDOWS\SYSTEM\IMAGEHLP.DLL

Heap at VM Abort:
Heap
def new generation total 4608K, used 234K [0x10010000, 0x10510000,
0x10ed0000)
eden space 4096K, 1% used [0x10010000, 0x10021eb0, 0x10410000)
from space 512K, 31% used [0x10490000, 0x104b8a80, 0x10510000)
to space 512K, 0% used [0x10410000, 0x10410000, 0x10490000)
tenured generation total 60544K, used 11740K [0x10ed0000,
0x149f0000, 0x1c010000)
the space 60544K, 19% used [0x10ed0000, 0x11a47348, 0x11a47400,
0x149f0000)
compacting perm gen total 12032K, used 11914K [0x1c010000,
0x1cbd0000, 0x20010000)
the space 12032K, 99% used [0x1c010000, 0x1cbb2ad0, 0x1cbb2c00,
0x1cbd0000)

Local Time = Thu Aug 26 18:58:43 2004
Elapsed Time = 41
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_02-b03 mixed mode)
#



Can Any one give me a solution to this problem or way to find out the
cause of the problem,

Thanks and Regards,
Chella.mani
 
G

Gordon Beaton

I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.
[...]

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
[...]

Can Any one give me a solution to this problem or way to find out the
cause of the problem,

There is a pointer error in one of your native methods. For more
information, have a look at questions 16.5 and 16.8 in the comp.lang.c
FAQ:

http://www.eskimo.com/~scs/C-faq/faq.html

/gordon
 
L

Liz

Gordon Beaton said:
I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.
[...]

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
[...]

Can Any one give me a solution to this problem or way to find out the
cause of the problem,

There is a pointer error in one of your native methods. For more
information, have a look at questions 16.5 and 16.8 in the comp.lang.c
FAQ:

This is a feature of C++ whereas it can run anywhere, including amuck.
 
C

chella mani

Liz said:
Gordon Beaton said:
I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.
[...]

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
[...]

Can Any one give me a solution to this problem or way to find out the
cause of the problem,

There is a pointer error in one of your native methods. For more
information, have a look at questions 16.5 and 16.8 in the comp.lang.c
FAQ:

This is a feature of C++ whereas it can run anywhere, including amuck.


The problem is my wrapper program should to allow the user to use his
existing C\C++ code without any modification. Is it possible to
Prevent the JVM crash in case of any access violation.
 
G

Gordon Beaton

The problem is my wrapper program should to allow the user to use his
existing C\C++ code without any modification. Is it possible to
Prevent the JVM crash in case of any access violation.

First, you can't catch these errors if the operating system policy is
to kill your process because of them.

Second, if you have native code that corrupts the process memory, you
can't really trust *any* results from the program. Even when the
process doesn't crash, you can't be sure the error hasn't occurred
(but in some more subtle way). The crash is just a symptom, and hiding
it from the user is really the *wrong* approach here.

Would you trust your bank if they used software that attempted to hide
serious errors? Would you fly in such an aircraft?

What is the value of telling the user he doesn't have to modify his
incorrect code?

/gordon
 
C

Chris Uppal

chella said:
The problem is my wrapper program should to allow the user to use his
existing C\C++ code without any modification.

If you /really/ need that kind of isolation (that the user code can crash
without killing your application) then this is the wrong way to go about it.
You need the user's flaky code to be in a completely different process from
your application, or you /won't/ be isolated from their bugs.

One approach would be to write a small separate program which loads and runs
the DLL, and uses TCP/IP (or anything else that's handy) to communicate back
with the parent application. There are other approaches, it depends on what
you are doing.

-- chris
 
C

chella mani

Gordon Beaton said:
First, you can't catch these errors if the operating system policy is
to kill your process because of them.

Second, if you have native code that corrupts the process memory, you
can't really trust *any* results from the program. Even when the
process doesn't crash, you can't be sure the error hasn't occurred
(but in some more subtle way). The crash is just a symptom, and hiding
it from the user is really the *wrong* approach here.

Would you trust your bank if they used software that attempted to hide
serious errors? Would you fly in such an aircraft?

What is the value of telling the user he doesn't have to modify his
incorrect code?

Yes I agree with you gordon,the user's natvie code runs with out any
problem when using it as stand alone application,but when ever I call
the native code through JNI it kills the entire application.In case of
any access violation I want to show the user that some access
violation has occured and i want to prevent the entire application
getting killed.
 
L

Lans Redmond

add the -dsa option to the catalina_opts flag

dsa diables system assertions


chella mani said:
hi all,
I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.

ie java <---->Wrapper C++ <-----> Ordinary C++ function

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for
possible
reason and solutions.


Current Java thread:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.getMethod0(Class.java:1893)
at java.lang.Class.getMethod(Class.java:976)
at javax.swing.UIDefaults.getUI(UIDefaults.java:726)
at javax.swing.UIManager.getUI(UIManager.java:784)
at javax.swing.JToolTip.updateUI(JToolTip.java:82)
at javax.swing.JToolTip.<init>(JToolTip.java:64)
at javax.swing.JComponent.createToolTip(JComponent.java:2603)
at javax.swing.ToolTipManager.showTipWindow(ToolTipManager.java:257)
at
javax.swing.ToolTipManager$insideTimerAction.actionPerformed(ToolTipManager.java:689)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Dynamic libraries:
0x7CC00000 - 0x7CC1D000 C:\WINDOWS\SYSTEM\IMAGEHLP.DLL

Heap at VM Abort:
Heap
def new generation total 4608K, used 234K [0x10010000, 0x10510000,
0x10ed0000)
eden space 4096K, 1% used [0x10010000, 0x10021eb0, 0x10410000)
from space 512K, 31% used [0x10490000, 0x104b8a80, 0x10510000)
to space 512K, 0% used [0x10410000, 0x10410000, 0x10490000)
tenured generation total 60544K, used 11740K [0x10ed0000,
0x149f0000, 0x1c010000)
the space 60544K, 19% used [0x10ed0000, 0x11a47348, 0x11a47400,
0x149f0000)
compacting perm gen total 12032K, used 11914K [0x1c010000,
0x1cbd0000, 0x20010000)
the space 12032K, 99% used [0x1c010000, 0x1cbb2ad0, 0x1cbb2c00,
0x1cbd0000)

Local Time = Thu Aug 26 18:58:43 2004
Elapsed Time = 41
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_02-b03 mixed mode)
#



Can Any one give me a solution to this problem or way to find out the
cause of the problem,

Thanks and Regards,
Chella.mani
 
L

lredmond

if not using tomcat then just use the dsa option when you call java
Lans Redmond said:
add the -dsa option to the catalina_opts flag

dsa diables system assertions


chella mani said:
hi all,
I am calling functions in existing C\C++ program (DLL) through a
wrapper C++ program (another DLL) from java.

ie java <---->Wrapper C++ <-----> Ordinary C++ function

My problem is JVM crashes(some times) and gives the following error,

An unexpected exception has been detected in native code outside the
VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred
at PC=0x80C2F75
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for
possible
reason and solutions.


Current Java thread:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.getMethod0(Class.java:1893)
at java.lang.Class.getMethod(Class.java:976)
at javax.swing.UIDefaults.getUI(UIDefaults.java:726)
at javax.swing.UIManager.getUI(UIManager.java:784)
at javax.swing.JToolTip.updateUI(JToolTip.java:82)
at javax.swing.JToolTip.<init>(JToolTip.java:64)
at javax.swing.JComponent.createToolTip(JComponent.java:2603)
at javax.swing.ToolTipManager.showTipWindow(ToolTipManager.java:257)
at
javax.swing.ToolTipManager$insideTimerAction.actionPerformed(ToolTipManager.java:689)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Dynamic libraries:
0x7CC00000 - 0x7CC1D000 C:\WINDOWS\SYSTEM\IMAGEHLP.DLL

Heap at VM Abort:
Heap
def new generation total 4608K, used 234K [0x10010000, 0x10510000,
0x10ed0000)
eden space 4096K, 1% used [0x10010000, 0x10021eb0, 0x10410000)
from space 512K, 31% used [0x10490000, 0x104b8a80, 0x10510000)
to space 512K, 0% used [0x10410000, 0x10410000, 0x10490000)
tenured generation total 60544K, used 11740K [0x10ed0000,
0x149f0000, 0x1c010000)
the space 60544K, 19% used [0x10ed0000, 0x11a47348, 0x11a47400,
0x149f0000)
compacting perm gen total 12032K, used 11914K [0x1c010000,
0x1cbd0000, 0x20010000)
the space 12032K, 99% used [0x1c010000, 0x1cbb2ad0, 0x1cbb2c00,
0x1cbd0000)

Local Time = Thu Aug 26 18:58:43 2004
Elapsed Time = 41
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_02-b03 mixed mode)
#



Can Any one give me a solution to this problem or way to find out the
cause of the problem,

Thanks and Regards,
Chella.mani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top