Skip to Main Content

Java HotSpot Virtual Machine

Problem with calling constructor from JNI code

843829Sep 8 2010 — edited Sep 8 2010
I have no error when I am trying to call any method of the "Ursa_Routing_Output" object from the JNI code. But I am getting the same error when calling the constructor.

Problem with the Empty constructor
Exception in thread "Thread-23" java.lang.NoSuchMethodError: <init>
at com.comail.jni.UVSdk.getRPO(Native Method)

jclass jRpo=env->FindClass("com/comail/pojo/Ursa_Routing_Output");
  	if(jRpo==NULL)
  	{
  	 printf("Class can't be found \n");
  	 return NULL;
  	}


	jmethodID test=env->GetMethodID(jRpo,"getAreaCommitment","()Ljava/lang/String;");
	if(test==NULL)
  	{
  	printf("\nProblem with the Test Method \n");
	return NULL;
 	}
	
    jmethodID uroEmptyConst  = env->GetMethodID(jRpo,"<init>","()v");
	if(uroEmptyConst==NULL)
  	{
  	printf("\nProblem with the Empty constructor \n");
	return NULL;
 	}
The corresponding methods in the Java class are :
public class Ursa_Routing_Output implements Serializable {

	/**
	 *   Class fields 
	 */

       public Ursa_Routing_Output() {
		super();
		// TODO Auto-generated constructor stub
	}

   ...........
............

     public String getAreaCommitment() {
		return AreaCommitment;
	}
The corresponding class signatures generated through javap are :

public com.comail.pojo.Ursa_Routing_Output();
Signature: ()V

public java.lang.String getAreaCommitment();
Signature: ()Ljava/lang/String;


The code is able to find the class and its other methods. But it is not able to locate the constructor.

Can any one help me to locate the problem?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2010
Added on Sep 8 2010
2 comments
2,345 views