dcsimg
Getting problem in accessing C APIs!Gives me following error!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   shrinivas_kulkarni
Posted On:   Friday, April 20, 2001 03:12 AM

We are trying to give thin client intranet approach instead of client application installed for per client.Since client wants to access database with same login and password ,i need to use low level apis provided by clarify CRM product for login process.We are trying to use JNI for the purpose. But when second user tries to login thr it, gives me this error.Attaching code for servlet and a buisness class with this. # # An EXCEPTION_ACCESS_VIOLATION exception has been detected in native code outside the VM. # Program counter=0x78011f41 # System used: windows 2000/NT,apache 1.3.1 and resin 1.2.5 VC++6.0 for creating DLL required. Buisness class: package thincqobj;    More>>

We are trying to give thin client intranet approach instead of client application installed for per client.Since client wants to access database with same login and password ,i need to use low level apis provided by clarify CRM product for login process.We are trying to use JNI for the purpose.
But when second user tries to login thr it, gives me this error.Attaching code for servlet and a buisness class with this.

			
#
# An EXCEPTION_ACCESS_VIOLATION exception has been detected in native code outside the VM.
# Program counter=0x78011f41
#

System used: windows 2000/NT,apache 1.3.1 and resin 1.2.5
VC++6.0 for creating DLL required.
Buisness class:
			
package thincqobj;

import java.io.*;
import java.lang.*;
import java.sql.*;
import java.util.*;
//import dbaccess.*;


public class TCUser {
private String strUserId;
private String strUserType;
private Connection con=null;
private StringBuffer strMessage = new StringBuffer("inside TCUser :-");

static{

}

public TCUser() {}

public native int checkUser(String userName,String password);
public native int checkUser(String serverName,String dbName,String userName,String password);
public native String checkUserStr(String userName,String password);
public native String checkUserStr(String serverName,String dbName,String userName,String password);
public native String testFun();

public String getUserId()
{
return strUserId;
}

public void init(Connection con)
{
if(con!=null)
this.con=con;
}

public void setUserId(String struserid)
{
strUserId = struserid;
}

public String getUserType()
{
return strUserType;
}

public void setUserType(String strusertype)
{
strUserType = strusertype;
}

public Vector retrieveUserList()
{
Vector vUserList = new Vector();
return vUserList;
}

public boolean userExists(String userName,String password)
{
strMessage.append(userName.trim());
strMessage.append(password.trim());
File delFile=null;
try{
synchronized(delFile){
delFile=new File("CDEV.052");
if(delFile.exists())
{
delFile.delete();
System.out.println("deleting file");
}
}
}catch(Exception e)
{
e.printStackTrace();
}
System.loadLibrary("ClarifyAPI");
String check=checkUserStr(userName,password);
/*delFile=new File("CDEV.052");
if(delFile.exists())
{
delFile.delete();
System.out.println("deleting file");
}*/

System.out.println(check);
StringTokenizer str=new StringTokenizer(check,"+");
String firstToken=str.nextToken();
if(firstToken.equals("0"))
return true;
else
return false;
}

public static void main(String args[])
{
try {
System.out.println("Started !!");
System.loadLibrary("clarifyapi");
TCUser tcq=new TCUser();
System.out.println(tcq.testFun());
System.out.println(tcq.testFun());
System.out.println(tcq.userExists("sa","sa"));
}
catch(Exception e) {

}
}

public String checkMessages()
{
return strMessage.toString();
}

}

Servlet:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet extends HttpServlet
{
public void init(ServletConfig config)
throws ServletException
{
super.init(config);

}

public void doPost(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
System.loadLibrary("ClarifyApi");
res.setContentType("text/html");
PrintWriter out=res.getWriter();
System.out.println("line 1 in java code !");
out.println("Started !!!");
System.out.println("line 2 in java code !");
Class cls=getClass();
System.out.println("line 3 in java code !");
ClassLoader loader=cls.getClassLoader();
System.out.println("line 4 in java code !");
if(loader!=null)
out.println("Got Loader!!!");
System.out.println("line 5 in java code !");
//thincqobj.TCUser temp=(thincqobj.TCUser)loader.loadClass("thincqobj.TCUser").newInstance();
thincqobj.TCUser temp=new thincqobj.TCUser();
out.println("
"+temp.checkMessages());
out.println("
"+temp.testFun());
if(result(temp))
out.println("Status is:-Login Succuess");
else
out.println("Status is:-Login Failed");

}

public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
doPost(req,res);
}

public synchronized boolean result(thincqobj.TCUser temp)
{
return temp.userExists("sa","sa");
}
}
   <<Less

Re: Getting problem in accessing C APIs!Gives me following error!

Posted By:   Jacob_Marner  
Posted On:   Sunday, April 29, 2001 03:15 PM

I get this error a lot. And every single time it is due to a pointer error in the C code. So it is *very* likely that the error is in your C code.

The error means that your C code is trying to access a memory address it is not allowed to. A common error is dereference a NULL pointer or a pointer that is not initialized.

Since I can't see that here, I can't tell what the error is.

Jacob Marner
About | Sitemap | Contact