Posted By:
Anonymous
Posted On:
Wednesday, August 21, 2002 03:22 AM
I have on the server side methods which work correctly on an Access DataBase(using sun.jdbc.odbc.JdbcOdbcDriver).I get problems when I try to call the same methods with RMI and I have this error: An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D366658 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 sun.jdbc.odbc.JdbcOdbc.setStmtAttrPtr(Native Method) at sun.jdbc.odbc.JdbcOdbc.SQLSetStm
More>>
I have on the server side methods which work correctly on an Access DataBase(using sun.jdbc.odbc.JdbcOdbcDriver).I get problems when I try to call the same methods with RMI and I have this error:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D366658
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 sun.jdbc.odbc.JdbcOdbc.setStmtAttrPtr(Native Method)
at sun.jdbc.odbc.JdbcOdbc.SQLSetStmtAttrPtr(JdbcOdbc.java:4676)
at sun.jdbc.odbc.JdbcOdbcResultSet.setRowStatusPtr(JdbcOdbcResultSet.java:4473)
at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:171)
at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:423)
- locked
<02C912D8> (a sun.jdbc.odbc.JdbcOdbcStatement)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
at SongsDB.ValidateUserLogIn(SongsDB.java:99)
at ServerImpl.LogIn(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Dynamic libraries:
0x7D240000 - 0x7D26D000 C:WINDOWSSYSTEMDBGHELP.DLL
Local Time = Tue Aug 20 18:29:34 2002
Elapsed Time = 5
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)
#
This is a method in the SongsDB.java on the server side which modifies the database.It works perfectly alone:
public void ValidateUserLogIn (String UserName,String UserPassword){
int var,var1;
try {
System.out.println ("Performing validate user login action");
// Opens the connection with UsersDataBase
UsersDBConnection();
// Submit a query, creating a ResultSet object
ResultSet rs = stmt.executeQuery("SELECT UserName,UserPassword FROM UsersDataBase");
// Search the row matching the right UserName
do {
rs.next();
var=rs.getString("UserName").compareTo(UserName);
System.out.println("comparo "+ rs.getString("UserName") + " dal RS con variabile inserita "+ UserName+":::: "+var);
if(var == 0){
// If the right row, check the password
var1=rs.getString("UserPassWord").compareTo(UserPassword);
System.out.println("comparo "+ rs.getString("UserPassword") + " dal RS con variabile inserita "+ UserPassword+"::::"+var1);
if ( var1 == 0)
System.out.println("ok utente loggato");
else throw new WrongPassword();
}
} while (var != 0 && rs.isLast()==false);
// If last row and right row not found
if (rs.last() && var != 0)
throw new UserNotFoundEx();
}
catch(UserNotFoundEx UserNotFoundEx) {
// User not found exception was generated
System.out.println("UserName non presente nel DataBase. Effettuare registrazione nuovo utente.");
}
catch(WrongPassword WrongPassword) {
// Wrong password exception was generated
System.out.println("La password inserita non รจ corretta.");
}
catch(SQLException SQLex) {
// A SQLException was generated
System.out.println ("*** SongsDataBase SQLException caught ***");
SQLex.printStackTrace ();
}
}
This is the method in ServerImpl.java on the server side which the client has to call with RMI
public void LogIn(String UserName, String Password) throws RemoteException {
SongsDB.ValidateUserLogIn(UserName,Password);
}
It generates the exception I posted above.
On the contrary if I modify the ValidateUserLogIn taking out the parameters (ValidateUserLogIn()) it works on the DB but I get again an error the ms-dos window in wich i run ServerImpl gets stuck
This Is the call on the Client.java:
try {
server = (Server) Naming.lookup("//" + host + ":" + String.valueOf(port) + "/Server");
}
catch(NotBoundException nbe) {
System.err.println("No account server object found on " +
host + ":"+String.valueOf(port));
nbe.printStackTrace();
System.exit(1);
}
catch(RemoteException re) {
System.err.println("Unable to register the server. Halting.");
re.printStackTrace();
System.exit(1);
}
catch(java.net.MalformedURLException mue) {
System.err.println("Incorrect URL format. Halting.");
mue.printStackTrace();
System.exit(1);
}
System.out.println("Server bound to remote registry");
try{
String name="alberto";
String pass="albertop";
server.LogIn(name,pass);
//I also tried to pass directly the strings but nothing change
}
catch(RemoteException ex){
System.out.println("trovattttttttta eccezzione d remottta");
}
Connections on the RMIRegistry work perfectly(I think...)becouse easy methods are invocated.I get problems with Access DB of course...
I have now noticed that the two different errors are discriminated by the ResultSet.In fact when I use it I get the error posted above otherwise the error in the window(wich says only that an error occurred but I have my DataBase modified correctly).
<<Less