virajpu / androjena

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

Exceptions while loading a model using Model.Read() #5

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 testModel  = ModelFactory.createDefaultModel();        
  testModel.read("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 "jjava.lang.ExceptionInInitializerError" exception for 
om.hp.hpl.jena.rdf.arp.impl.XMLHandler.

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

Please provide any additional information below.
Detailed Exception log:
D/AndroidRuntime(  282): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime(  282): CheckJNI is ON
D/AndroidRuntime(  282): --- registering native functions ---
I/ActivityManager(   67): Starting activity: Intent { act=android.intent.action
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.examples.And
oidReasoning/.AndroidReasoning }
D/AndroidRuntime(  282): Shutting down VM
D/dalvikvm(  282): Debugger has detached; object registry had 1 entries
I/AndroidRuntime(  282): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager(   67): Start proc com.examples.AndroidReasoning for activity
com.examples.AndroidReasoning/.AndroidReasoning: pid=289 uid=10039 gids={1015}
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.util.Metadata' exce
ds maximum length of 23 characters, using 'c*.h*.h*.j*.u*.Metadata' instead.
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.util.SystemUtils' e
ceeds maximum length of 23 characters, using 'c*.h*.h*.j*.u*.SystemU*' instead.
V/c*.h*.h*.j*.u*.SystemU*(  289): Using thread classloader
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.rdf.model.impl.Prop
rtyImpl' exceeds maximum length of 23 characters, using 'c*.h*.h*.j*.r*.m*.i*.P
' instead.
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.rdf.model.impl.RDFL
stImpl' exceeds maximum length of 23 characters, using 'c*.h*.h*.j*.r*.m*.i*.R*
 instead.
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.ontology.impl.OntRe
ourceImpl' exceeds maximum length of 23 characters, using 'c*.h*.h*.j*.o*.i*.On
R*' instead.
I/dalvikvm(  289): Could not find method com.ibm.icu.text.IDNA.convertIDNToASCI
, referenced from method com.hp.hpl.jena.iri.impl.Parser.<init>
W/dalvikvm(  289): VFY: unable to resolve static method 12030: Lcom/ibm/icu/tex
/IDNA;.convertIDNToASCII (Ljava/lang/String;I)Ljava/lang/StringBuffer;
D/dalvikvm(  289): VFY: replacing opcode 0x71 at 0x00d6
W/dalvikvm(  289): VFY: unable to resolve exception class 1423 (Lcom/ibm/icu/te
t/StringPrepParseException;)
W/dalvikvm(  289): VFY: unable to find exception handler at addr 0xfd
W/dalvikvm(  289): VFY:  rejected Lcom/hp/hpl/jena/iri/impl/Parser;.<init> (Lja
a/lang/String;Lcom/hp/hpl/jena/iri/impl/IRIImpl;)V
W/dalvikvm(  289): VFY:  rejecting opcode 0x0d at 0x00fd
W/dalvikvm(  289): VFY:  rejected Lcom/hp/hpl/jena/iri/impl/Parser;.<init> (Lja
a/lang/String;Lcom/hp/hpl/jena/iri/impl/IRIImpl;)V
W/dalvikvm(  289): Verifier rejected class Lcom/hp/hpl/jena/iri/impl/Parser;
W/dalvikvm(  289): Exception Ljava/lang/VerifyError; thrown during Lcom/hp/hpl/
ena/iri/ViolationCodes$Initialize;.<clinit>
W/dalvikvm(  289): Exception Ljava/lang/ExceptionInInitializerError; thrown dur
ng Lcom/hp/hpl/jena/iri/IRIFactory;.<clinit>
W/dalvikvm(  289): Exception Ljava/lang/ExceptionInInitializerError; thrown dur
ng Lcom/hp/hpl/jena/rdf/arp/ARPOptions;.<clinit>
D/AndroidRuntime(  289): Shutting down VM
W/dalvikvm(  289): threadid=1: thread exiting with uncaught exception (group=0x
001d800)
E/AndroidRuntime(  289): FATAL EXCEPTION: main
E/AndroidRuntime(  289): java.lang.ExceptionInInitializerError
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.<ini
>(XMLHandler.java:367)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.<i
it>(RDFXMLParser.java:52)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.cr
ate(RDFXMLParser.java:85)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.arp.JenaReader.<init>(Je
aReader.java:62)
E/AndroidRuntime(  289):        at java.lang.Class.newInstanceImpl(Native Metho
)
E/AndroidRuntime(  289):        at java.lang.Class.newInstance(Class.java:1429)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImp
.getReader(RDFReaderFImpl.java:114)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImp
.getReader(RDFReaderFImpl.java:98)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.model.impl.ModelCom.read
ModelCom.java:181)
E/AndroidRuntime(  289):        at com.examples.AndroidReasoning.AndroidReasoni
g.onCreate(AndroidReasoning.java:44)
E/AndroidRuntime(  289):        at android.app.Instrumentation.callActivityOnCr
ate(Instrumentation.java:1047)
E/AndroidRuntime(  289):        at android.app.ActivityThread.performLaunchActi
ity(ActivityThread.java:2627)
E/AndroidRuntime(  289):        at android.app.ActivityThread.handleLaunchActiv
ty(ActivityThread.java:2679)
E/AndroidRuntime(  289):        at android.app.ActivityThread.access$2300(Activ
tyThread.java:125)
E/AndroidRuntime(  289):        at android.app.ActivityThread$H.handleMessage(A
tivityThread.java:2033)
E/AndroidRuntime(  289):        at android.os.Handler.dispatchMessage(Handler.j
va:99)
E/AndroidRuntime(  289):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  289):        at android.app.ActivityThread.main(ActivityThre
d.java:4627)
E/AndroidRuntime(  289):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  289):        at java.lang.reflect.Method.invoke(Method.java:
21)
E/AndroidRuntime(  289):        at com.android.internal.os.ZygoteInit$MethodAnd
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  289):        at com.android.internal.os.ZygoteInit.main(Zygo
eInit.java:626)
E/AndroidRuntime(  289):        at dalvik.system.NativeStart.main(Native Method

E/AndroidRuntime(  289): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime(  289):        at com.hp.hpl.jena.rdf.arp.ARPOptions.<clinit>(
RPOptions.java:60)
E/AndroidRuntime(  289):        ... 23 more
E/AndroidRuntime(  289): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime(  289):        at com.hp.hpl.jena.iri.IRIFactory.<clinit>(IRIF
ctory.java:98)
E/AndroidRuntime(  289):        ... 24 more
E/AndroidRuntime(  289): Caused by: java.lang.VerifyError: com.hp.hpl.jena.iri.
mpl.Parser
E/AndroidRuntime(  289):        at com.hp.hpl.jena.iri.impl.SchemeSpecification
<init>(SchemeSpecification.java:55)
E/AndroidRuntime(  289):        at com.hp.hpl.jena.iri.ViolationCodes$Initializ
.<clinit>(ViolationCodes.java:1360)
E/AndroidRuntime(  289):        ... 25 more
D/dalvikvm(  289): GC_FOR_MALLOC freed 3447 objects / 305664 bytes in 224ms
W/ActivityManager(   67):   Force finishing activity com.examples.AndroidReason
ng/.AndroidReasoning

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

GoogleCodeExporter commented 8 years ago
Hi pamjagtap,
you get this error because your Android app doesn't reference the 
icu4j-3.4.4.jar library: that's why the bytecode verifier cannot resolve the 
com.ibm.icu.text.IDNA.convertIDNToASCII static method.
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:17

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 4 
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 testModel  = ModelFactory.createDefaultModel();
        testModel.read("http://localhost/rules/SchoolModel.nt");
}

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

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

GoogleCodeExporter commented 8 years ago
Hello, i am study in this topic, and i also have problem same you. i can not 
execute  the in line  QueryExecution qe = 
QueryExecutionFactory.create(queryString, model); and i have  logcat same you. 
I/AndroidLoggerFactory(  289): Logger name 'com.hp.hpl.jena.ontology.impl.OntRe
ourceImpl' exceeds maximum length of 23 characters, using 'c*.h*.h*.j*.o*.i*.On
R*' instead. 

Hope u help me.

Original comment by tanaporn...@gmail.com on 5 Sep 2013 at 11:52

GoogleCodeExporter commented 8 years ago
Hi tanaporn, please open a new issue and provide all the requested info (logcat 
dump, os versions etc) so that I can try to debug this. The error is definitely 
related to slf4j-android, but it had been solved ages ago so this is strange. 
See you on the new issue, bye.

Original comment by lorenzo....@cubica.eu on 5 Sep 2013 at 12:43