EXCEPTION_ACCESS_VIOLATION

i have an application which receive data from serial port and send it to the database , but an exception occurs and i don't know what does it main so the following is what i received at the saved file which is result from the exception:

#

# An unexpected error has been detected by HotSpot Virtual Machine:

#

# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c951010, pid=1852, tid=1988

#

# Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode, sharing)

# Problematic frame:

# C [ntdll.dll+0x1010]

#

T H R E A D

Current thread (0x02ef6200): JavaThread"Win32SerialPort Notification thread" [_thread_in_native, id=1988]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000018

Registers:

EAX=0x00000004, EBX=0x26baff48, ECX=0x7ffae000, EDX=0x00000004

ESP=0x0823f988, EBP=0x0823f9a0, ESI=0x00000000, EDI=0x03291348

EIP=0x7c951010, EFLAGS=0x00010246

Top of Stack: (sp=0x0823f988)

0x0823f988:73fc5a16 00000004 0329136c 73f9139f

0x0823f998:0329136c 03291348 0823f9b0 73f92c5d

0x0823f9a8:0329136c 02ef62c0 0823f9c4 73f95fa0

0x0823f9b8:03291348 73fc0000 00000000 0823f9e0

0x0823f9c8:73f9740e 03291348 0823fa00 00000003

0x0823f9d8:02f05f90 02ef62c0 0823f9f8 6d3e11da

0x0823f9e8:03291348 0823fa00 02ef6200 26baff48

0x0823f9f8:0823fa30 00ad826f 00000000 0823fa4c

Instructions: (pc=0x7c951010)

0x7c951000:90 90 90 90 90 64 8b 0d 18 00 00 00 8b 54 24 04

0x7c951010:83 7a 14 00 75 4f f0 ff 42 04 75 19 8b 41 24 89

Stack: [0x08200000,0x08240000), sp=0x0823f988, free space=254k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

C [ntdll.dll+0x1010]

C [ODBC32.dll+0x2c5d]

C [ODBC32.dll+0x5fa0]

C [ODBC32.dll+0x740e]

C [JdbcOdbc.dll+0x11da]

j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0

j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47

j sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Ljava/lang/String;II)Ljava/sql/PreparedStatement;+55

j sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement;+8

j ComControl.serialEvent(Ljavax/comm/SerialPortEvent;)V+263

j com.sun.comm.Win32SerialPort.sendDataAvailEvent()V+27

j com.sun.comm.NotificationThread.run()V+297

v ~StubRoutines::call_stub

V [jvm.dll+0x86401]

V [jvm.dll+0xdb172]

V [jvm.dll+0x862d2]

V [jvm.dll+0x8602f]

V [jvm.dll+0xa0bcb]

V [jvm.dll+0x10bdad]

V [jvm.dll+0x10bd7b]

C [MSVCRT.dll+0x2a3b0]

C [kernel32.dll+0xb683]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0

j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47

j sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Ljava/lang/String;II)Ljava/sql/PreparedStatement;+55

j sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement;+8

j ComControl.serialEvent(Ljavax/comm/SerialPortEvent;)V+263

j com.sun.comm.Win32SerialPort.sendDataAvailEvent()V+27

j com.sun.comm.NotificationThread.run()V+297

v ~StubRoutines::call_stub

P R O C E S S

Java Threads: ( => current thread )

0x00036af0 JavaThread"DestroyJavaVM" [_thread_blocked, id=3880]

=>0x02ef6200 JavaThread"Win32SerialPort Notification thread" [_thread_in_native, id=1988]

0x00a6fa98 JavaThread"Low Memory Detector" daemon [_thread_blocked, id=2408]

0x00a6e708 JavaThread"CompilerThread0" daemon [_thread_blocked, id=2676]

0x00a6da18 JavaThread"Signal Dispatcher" daemon [_thread_blocked, id=3608]

0x00a42320 JavaThread"Finalizer" daemon [_thread_blocked, id=3904]

0x00a40e38 JavaThread"Reference Handler" daemon [_thread_blocked, id=3492]

Other Threads:

0x00a3e540 VMThread [id=3752]

0x00a6d7a8 WatcherThread [id=3408]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap

defnew generationtotal 576K, used 142K [0x22b80000, 0x22c20000, 0x23060000)

eden space 512K, 15% used [0x22b80000, 0x22b93be0, 0x22c00000)

from space 64K, 99% used [0x22c00000, 0x22c0fff8, 0x22c10000)

tospace 64K,0% used [0x22c10000, 0x22c10000, 0x22c20000)

tenured generationtotal 1408K, used 267K [0x23060000, 0x231c0000, 0x26b80000)

the space 1408K, 19% used [0x23060000, 0x230a2eb0, 0x230a3000, 0x231c0000)

compacting perm gen total 8192K, used 622K [0x26b80000, 0x27380000, 0x2ab80000)

the space 8192K,7% used [0x26b80000, 0x26c1b978, 0x26c1ba00, 0x27380000)

ro space 8192K, 67% used [0x2ab80000, 0x2b0dd9f8, 0x2b0dda00, 0x2b380000)

rw space 12288K, 46% used [0x2b380000, 0x2b923808, 0x2b923a00, 0x2bf80000)

Dynamic libraries:

0x00400000 - 0x0040d000 C:\Program Files\Java\jdk1.5.0_07\bin\java.exe

0x7c950000 - 0x7c9fb000 C:\WINDOWS\system32\ntdll.dll

0x7c800000 - 0x7c94e000 C:\WINDOWS\system32\kernel32.dll

0x77f50000 - 0x77ffb000 C:\WINDOWS\system32\ADVAPI32.dll

0x77d60000 - 0x77df1000 C:\WINDOWS\system32\RPCRT4.dll

0x77ba0000 - 0x77bf8000 C:\WINDOWS\system32\MSVCRT.dll

0x6d730000 - 0x6d8c7000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\client\jvm.dll

0x77cd0000 - 0x77d5f000 C:\WINDOWS\system32\USER32.dll

0x77e00000 - 0x77e47000 C:\WINDOWS\system32\GDI32.dll

0x76ab0000 - 0x76add000 C:\WINDOWS\system32\WINMM.dll

0x62eb0000 - 0x62eb9000 C:\WINDOWS\system32\LPK.DLL

0x74cd0000 - 0x74d3b000 C:\WINDOWS\system32\USP10.dll

0x5d1f0000 - 0x5d1f7000 C:\WINDOWS\system32\serwvdrv.dll

0x5b520000 - 0x5b527000 C:\WINDOWS\system32\umdmxfrm.dll

0x6d2f0000 - 0x6d2f8000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\hpi.dll

0x76b60000 - 0x76b6b000 C:\WINDOWS\system32\PSAPI.DLL

0x6d700000 - 0x6d70c000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\verify.dll

0x6d370000 - 0x6d38d000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\java.dll

0x6d720000 - 0x6d72f000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\zip.dll

0x6d3e0000 - 0x6d3ed000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\JdbcOdbc.dll

0x73f90000 - 0x73fcd000 C:\WINDOWS\system32\ODBC32.dll

0x5d540000 - 0x5d5da000 C:\WINDOWS\system32\COMCTL32.dll

0x7ca00000 - 0x7d211000 C:\WINDOWS\system32\SHELL32.dll

0x77e50000 - 0x77ec6000 C:\WINDOWS\system32\SHLWAPI.dll

0x76300000 - 0x76368000 C:\WINDOWS\system32\comdlg32.dll

0x77360000 - 0x77463000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll

0x20000000 - 0x20017000 C:\WINDOWS\system32\odbcint.dll

0x77470000 - 0x775ad000 C:\WINDOWS\system32\ole32.dll

0x770b0000 - 0x7713c000 C:\WINDOWS\system32\OLEAUT32.dll

0x6ff50000 - 0x6ff6b000 C:\WINDOWS\system32\odbccp32.dll

0x77b90000 - 0x77b98000 C:\WINDOWS\system32\VERSION.dll

0x77ed0000 - 0x77ee1000 C:\WINDOWS\system32\Secur32.dll

0x10000000 - 0x1000a000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\win32com.dll

0x76f60000 - 0x76fdf000 C:\WINDOWS\system32\CLBCATQ.DLL

0x76fe0000 - 0x7709f000 C:\WINDOWS\system32\COMRes.dll

0x0f9a0000 - 0x0f9ab000 C:\WINDOWS\system32\VBAJET32.DLL

0x5b1f0000 - 0x5b228000 C:\WINDOWS\system32\uxtheme.dll

VM Arguments:

java_command: ComControl

Launcher Type: SUN_STANDARD

Environment Variables:

CLASSPATH=.;.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\PROGRA~1\JMF21~1.1E\lib;

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

USERNAME=azoz

OS=Windows_NT

PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel

S Y S T E M

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht

Memory: 4k page, physical 227824k(35752k free), swap 556416k(88144k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_07-b03)for windows-x86, built on May 3 2006 01:04:38 by"java_re" with MS VC++ 6.0

[8562 byte] By [student14a] at [2007-11-27 1:30:15]
# 1

In your case it is probably caused by one of the third party jni/dll libraries you are using, either odbc or serial.

Probably serial.

You can solve it with one of the following.

1. Find a different 3rd party library.

2. Determine exactly what sequence causes the problem. Then find a different way to do that.

jschella at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
actually i used both of them,,but i have to mention that i tried run the program without database it runs well,but when i used database this exception is occured.
student14a at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Then the problem is in the odbc driver (which is not the same as the jdbc-odbc bridge.)Again you can track the problem down and then work around it.
jschella at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4

thanx for your replies,,but actually i use the same odbs with the same database at another application and every thing going well,but only at this program i have this problem,

MY CODE:

import javax.comm.*;

import java.io.*;

import java.util.*;

import java.sql.*;

public class ComControl implements Runnable , SerialPortEventListener {

static CommPortIdentifier portId1;

InputStream inputStream;

SerialPort serialPort1;

Thread readThread;

static String TimeStamp;

static Connection con;

java.sql.Date date = new java.sql.Date((new java.util.Date()).getTime());

java.sql.Time time = new java.sql.Time((new java.util.Date()).getTime());

public static void main(String[] args) throws UnsupportedCommOperationException {

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\project.mdb");

}

catch(ClassNotFoundException e){

System.out.println(e.toString());

}

catch(SQLException e){

System.out.println("........."+e.toString());

}

try {

portId1 = CommPortIdentifier.getPortIdentifier("COM1");

ComControl reader = new ComControl();

System.out.println("ffffffffffff");

}

catch

(Exception e) {

TimeStamp = new java.util.Date().toString();

System.out.println(TimeStamp + ": ERROR " + portId1);

System.out.println(TimeStamp + ": msg1 - " + e);

}

};

public ComControl() {

try {

TimeStamp = new java.util.Date().toString();

serialPort1 = (SerialPort) portId1.open("ComControl", 1000);

System.out.println(TimeStamp + ": " + portId1.getName() + " opened for mouse input");

} catch (PortInUseException e) {}

try {

inputStream = serialPort1.getInputStream();

} catch (IOException e) {System.out.println("Yaraab");}

try {

serialPort1.addEventListener(this);

} catch (TooManyListenersException e) {}

serialPort1.notifyOnDataAvailable(true);

try {

serialPort1.setSerialPortParams(300,

SerialPort.DATABITS_8,

SerialPort.STOPBITS_1,

SerialPort.PARITY_NONE);

serialPort1.setFlowControlMode(serialPort1.FLOWCONTROL_NONE) ;

serialPort1.setDTR(false);

serialPort1.setRTS(false);

} catch (UnsupportedCommOperationException e) {}

readThread = new Thread(this);

readThread.start();

}

public void run() {

try {

Thread.sleep(1000);

} catch (InterruptedException e) {}

System.out.println(TimeStamp );

}

public void serialEvent(SerialPortEvent event) {

switch(event.getEventType()) {

case SerialPortEvent.BI:

case SerialPortEvent.OE:

case SerialPortEvent.FE:

case SerialPortEvent.PE:

case SerialPortEvent.CD:

case SerialPortEvent.CTS:

case SerialPortEvent.DSR:

case SerialPortEvent.RI:

case SerialPortEvent.OUTPUT_BUFFER_EMPTY:

break;

case SerialPortEvent.DATA_AVAILABLE:

StringBuffer readBuffer = new StringBuffer();

int c;

try {

c=inputStream.read();

readBuffer.append( (char)c);

String in = readBuffer.toString();

System.out.println("ok"+ in );

if(in.substring(0,1).equals("1")){

try{

String mine="INSERT INTO Stat (Event_date,Event_time,INN) VALUES (?,?,?)";

PreparedStatement ps = con.prepareStatement(mine);

ps.setDate(1,date);

ps.setTime(2, time);

ps.setInt(3,Integer.parseInt(in));

ps.execute();

con.close();

}catch(SQLException e){

System.out.println("........."+e.toString());}

} else if(in.substring(0,1).equals("2")) {

try{

String mine="INSERT INTO Stat (Event_date,Event_time,OUT) VALUES (?,?,?)";

PreparedStatement ps = con.prepareStatement(mine);

ps.setDate(1,date);

ps.setTime(2, time);

ps.setInt(3,Integer.parseInt(in));

ps.execute();

con.close();

}

catch(SQLException e){

System.out.println("........."+e.toString());}}

} catch (IOException e) {System.out.println("seriallll");}

}

}

}

student14a at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5

> thanx for your replies,,but actually i use the same

> odbs with the same database at another application

> and every thing going well,but only at this program i

> have this problem,

And that has nothing to do with it.

I didn't say that the driver didn't work at all. What I said was that some particular bit of functionality that you are running is causing it to fail.

If you did that functionality a different way with the same driver then it wouldn't fail.

(I might note that the "same" driver on a windows system doesn't in fact mean that you are using the same driver. You can only confirm that by checking the dll versions.)

> MY CODE:

>

Useless.

The VM is crashing. That means it has NOTHING at all to do with java code.

jschella at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6
i have counter same problem. i do some data query using odbc inside thread. so i counter the problem by slowing down the process by putting for loop or allow the thread to sleep for a while.horah~
soulremedya at 2007-7-12 0:31:04 > top of Java-index,Java HotSpot Virtual Machine,Specifications...