virajpu / androjena

Automatically exported from code.google.com/p/androjena
0 stars 0 forks source link

Exception while loading model using FileManager.get().loadModel("file:xyz.n3") #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a N3/RDF file with a model.
2. Load this model using AndroJena specifically these lines of code:
Model model = FileManager.get().loadModel("file:xyz.n3");   
3. Model should be loaded and "model" object should be ready to use.

What is the expected output? What do you see instead?
Model should be loaded and "model" object should be ready to use without any 
exceptions. It throws "java.lang.NoClassDefFoundError" exception for 
com.hp.hpl.jena.util.FileManager.

What version of the product are you using? On what operating system?
Windows Vista, latest AndroJena

Please provide any additional information below.
Detailed Exception list:
D/AndroidRuntime(  356): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime(  356): CheckJNI is ON
D/AndroidRuntime(  356): --- registering native functions ---
I/ActivityManager(   68): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.examples.Andr
oidReasoning/.AndroidReasoning }
D/AndroidRuntime(  356): Shutting down VM
D/dalvikvm(  356): Debugger has detached; object registry had 1 entries
I/AndroidRuntime(  356): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager(   68): Start proc com.examples.AndroidReasoning for activity
com.examples.AndroidReasoning/.AndroidReasoning: pid=363 uid=10039 gids={1015}
W/dalvikvm(  363): VFY: unable to find class referenced in signature (Lcom/hp/hp
l/jena/rdf/model/InfModel;)
W/dalvikvm(  363): VFY: unable to find class referenced in signature (Lcom/hp/hp
l/jena/rdf/model/RDFNode;)
I/dalvikvm(  363): Could not find method com.hp.hpl.jena.rdf.model.RDFNode.toStr
ing, referenced from method com.examples.AndroidReasoning.AndroidReasoning.Check
UserAccessUsingRules
W/dalvikvm(  363): VFY: unable to resolve interface method 22: Lcom/hp/hpl/jena/
rdf/model/RDFNode;.toString ()Ljava/lang/String;
D/dalvikvm(  363): VFY: replacing opcode 0x72 at 0x0000
D/dalvikvm(  363): VFY: dead code 0x0003-012a in Lcom/examples/AndroidReasoning/
AndroidReasoning;.CheckUserAccessUsingRules (Lcom/hp/hpl/jena/rdf/model/InfModel
;Lcom/hp/hpl/jena/rdf/model/RDFNode;)V
I/dalvikvm(  363): Could not find method com.hp.hpl.jena.util.FileManager.get, r
eferenced from method com.examples.AndroidReasoning.AndroidReasoning.onCreate
W/dalvikvm(  363): VFY: unable to resolve static method 28: Lcom/hp/hpl/jena/uti
l/FileManager;.get ()Lcom/hp/hpl/jena/util/FileManager;
D/dalvikvm(  363): VFY: replacing opcode 0x71 at 0x0008
D/dalvikvm(  363): VFY: dead code 0x000b-001f in Lcom/examples/AndroidReasoning/
AndroidReasoning;.onCreate (Landroid/os/Bundle;)V
D/AndroidRuntime(  363): Shutting down VM
W/dalvikvm(  363): threadid=1: thread exiting with uncaught exception (group=0x4
001d800)
E/AndroidRuntime(  363): FATAL EXCEPTION: main
E/AndroidRuntime(  363): java.lang.NoClassDefFoundError: com.hp.hpl.jena.util.Fi
leManager
E/AndroidRuntime(  363):        at com.examples.AndroidReasoning.AndroidReasonin
g.onCreate(AndroidReasoning.java:42)
E/AndroidRuntime(  363):        at android.app.Instrumentation.callActivityOnCre
ate(Instrumentation.java:1047)
E/AndroidRuntime(  363):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2627)
E/AndroidRuntime(  363):        at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2679)
E/AndroidRuntime(  363):        at android.app.ActivityThread.access$2300(Activi
tyThread.java:125)
E/AndroidRuntime(  363):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:2033)
E/AndroidRuntime(  363):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(  363):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  363):        at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime(  363):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  363):        at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(  363):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  363):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime(  363):        at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by pamjag...@gmail.com on 16 Nov 2010 at 10:19

GoogleCodeExporter commented 8 years ago
Hi pamjagtap,
you get this error because your Android app doesn't reference the 
androjena_0.2.jar library (and possibly other required libraries): that's why 
the bytecode verifier cannot resolve the com.hp.hpl.jena.util.FileManager 
class, thus the NoClassDefFoundException.
Please make sure that all the libraries listed below are referenced and 
packaged with your application:

- androjena_0.2.jar
- icu4j-3.4.4.jar
- iri-0.7.jar
- slf4j-android-1.6.1-RC1.jar

If you're using Eclipse, just make sure that those libraries are correctly 
referenced in the Libraries tab inside the Java Build Path project properties 
(follow the instructions in the README file contained in the androjena release 
package)

Please let me know if this solves the issue; if it doesn't, please add a 
comment to this issue with the following application files attached (when 
available):
- the portion of your source code where the exception is thrown
- AndroidManifest.xml
- .classpath (it's an Eclipse file in the root of your project)
- default.properties

Thanks,
lorenzo

Original comment by loreca...@gmail.com on 17 Nov 2010 at 11:23

GoogleCodeExporter commented 8 years ago
I have filed these issues and henceforth I will use this ID to comment.

Please go over Issue 6 because of which I had to remove "icu4j-3.4.4.jar" from 
build path. I understand fixing that issue might resolve this and issue 5 
automatically. Still I have attached application files which can be useful for 
you.

-- Source Code:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        subjectString.append("****START********");
        Model model =     FileManager.get().loadModel("http://localhost/rules/SchoolModel.n3"); 
}

Original comment by pramod.w...@gmail.com on 17 Nov 2010 at 6:03

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 6 solution probably works for this issue too. If not, it'll be reopened.

Original comment by loreca...@gmail.com on 23 Nov 2010 at 4:36