Friday, May 28, 2010

RE: [android-developers] [android-developer] Error running jena on Android using Androjena API

Generally it’s impolite to send attachments to a mailing list—if somebody’s going to offer to help, you can send them the attachment off-list. Otherwise you’re just filling up other peoples’ inboxs (and deleted items) folders with larger amounts of spam. :-)

 

A VerifyError usually is only thrown when the .class file compiles incorrectly—did you use the Android SDK to compile this, and did it compile cleanly? Try an “ant clean install” to blow away the old code and rebuild from scratch. Another possibility could be that the Android VM doesn’t like the version number of your .class file because you compiled it with a later version of the Java compiler than it’s enabled to recognize, though I build with 1.6 regularly and don’t have this problem, so it’d have to be a strange compiler indeed.

 

In stock Java, the usual suspect for an exception thrown out of Class.newInstance() is a missing default constructor, but your tryAndrojena class looks fine (since it doesn’t define any constructors, a default one should be synthesized for you by the compiler.)

 

Are you sure that ModelFactory has all the dependencies that it needs? Perhaps a class is failing to load inside ModelFactory, which then might be getting caught somewhere and rethrown as a VerifyError.

 

This is all idle speculation—have you tried stepping through it in the debugger?

 

Ted Neward

Java, .NET, XML Services

Consulting, Teaching, Speaking, Writing

http://www.tedneward.com

 

 

From: android-developers@googlegroups.com [mailto:android-developers@googlegroups.com] On Behalf Of Nishant Kumar
Sent: Friday, May 28, 2010 6:47 AM
To: android-developers@googlegroups.com
Cc: animesh.pathak@inria.fr; alessandra.toninelli@inria.fr
Subject: [android-developers] [android-developer] Error running jena on Android using Androjena API

 


I am trying to run a Jena (Semantic web toolkit ) program on Android. I have used Androjena Api
 ( http://code.google.com/p/androjena/ )  to do so.
After writing a simple program , I got the following Error.  Please let me know the meaning of this error ? I have extracted these error message from Log file.

Note: nishant.androjena is the package name and tryAndrojena.java is the file.

-------------------------------------   ERROR -----------------------

Uncaught handler: thread main exiting due to uncaught exception
 java.lang.VerifyError: nishant.androjena.tryAndrojena
     at java.lang.Class.newInstanceImpl(Native Method)
     at java.lang.Class.newInstance(Class.java:1472)
     at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2186)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:123)
     at android.app.ActivityThread.main(ActivityThread.java:3948)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:521)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
     at dalvik.system.NativeStart.main(Native Method)

     
     The line from the code that is causing error is
     Model model = ModelFactory.createDefaultModel();  // THis line is causing Error. Remove it to runn
     the  program Correctly.
     
     
My sample Code for Jena on Android is
     
package nishant.androjena;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.hp.hpl.jena.rdf.model.*;

import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.vocabulary.VCARD;

public class tryAndrojena extends Activity
{
    /** Called when the activity is first created. */
   
    String subjectString ="Ready for Jena";
   
    @Override  
    public void onCreate(Bundle savedInstanceState)
    {
          try{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        TextView textView = new TextView(this);
       
        String personURI    = "http://somewhere/JohnSmith";       
        String fullName     = "Nishant Kumar";
 
        Model model = ModelFactory.createDefaultModel();  // THIS IS CAUSING ERROR. REMOVE IT TO 
                                                                                    //  RUN SUCCESSFULLY
          textView.setText("New Model");
           setContentView(textView);
         }  
         catch(Exception ex)
         {
           TextView textView = new TextView(this);
           textView.setText(ex.getMessage());
           setContentView(textView);
         }
        
   } 
}



I have also attached the complete Project Folder.


Thanks,
Nishant Kumar

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate