Reading RDF into Jena Model

213 views
Skip to first unread message

Nix

unread,
May 15, 2008, 12:43:47 PM5/15/08
to Google Web Toolkit
Hi,
I was trying to write a RPC service to read RDF into jena model. All
the navigations of the model works perfectly for me, but whenever i
try to read a RDF file into a Jena Model, my RPC fails. I would be
pleased if someone could give me some hint.

final long serialVersionUID = 0;
final String inputFileName = "http://
www.ece.msstate.edu/~nd54/vc-db-1.rdf";
public ArrayList ParserCIM(String CIMText) {
Model model =
ModelFactory.createDefaultModel();
model.begin();
InputStream in = FileManager.get().open(inputFileName);
if (in == null) {
System.out.println("File: " + inputFileName
+ " not found");
throw new IllegalArgumentException("File: " + inputFileName
+ " not found");
}

//fails in this line
model.read(in,"");
}

Olivier Monaco

unread,
May 15, 2008, 1:58:12 PM5/15/08
to Google Web Toolkit
Hi,

Can you provide more information about failure ? (exception ?)

Olivier.

Nix

unread,
May 15, 2008, 4:09:51 PM5/15/08
to Google Web Toolkit
The error i am receiving is java.lang.NoClassDefFoundError: com/hp/
hpl/jena/iri/IRIFactory when i try to read or write. (model.read and
model.write functions)

Thanks



On May 15, 12:58 pm, Olivier Monaco <olivier.mon...@free.fr> wrote:
> Hi,
>
> Can you provide more information about failure ? (exception ?)
>
> Olivier.
>
> On 15 mai, 18:43, Nix <nischalda...@gmail.com> wrote:
>
> > Hi,
> > I was trying to write a RPC service to readRDFintojenamodel. All
> > the navigations of the model works perfectly for me, but whenever i
> > try to read aRDFfile into aJenaModel, my RPC fails. I would be

Nix

unread,
May 15, 2008, 5:38:18 PM5/15/08
to Google Web Toolkit
The Complete error message is

[WARN] StandardContext[]Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.util.ArrayList
com.msu.client.CIMParserService.CIMParserService.ParserCIM(java.lang.String)'
threw an unexpected exception: java.lang.NoClassDefFoundError: com/hp/
hpl/jena/iri/IRIFactory
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
268)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
366)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
222)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:
174)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
com.google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java:
249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
214)
Caused by: java.lang.NoClassDefFoundError: com/hp/hpl/jena/iri/
IRIFactory
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.<init>(XMLHandler.java:
431)
at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.<init>(RDFXMLParser.java:
40)
at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.create(RDFXMLParser.java:
83)
at com.hp.hpl.jena.rdf.arp.JenaReader.<init>(JenaReader.java:77)
at
com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:
113)
at
com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:
98)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:201)
at
com.msu.server.CIMParserService.CIMParserServiceImpl.ParserCIM(CIMParserServiceImpl.java:
34)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
348)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
222)
> > >                             }- Hide quoted text -
>
> - Show quoted text -

gregor

unread,
May 16, 2008, 6:14:42 AM5/16/08
to Google Web Toolkit
Hi Nix,

I'm not familiar with jenna, but it looks like your problem is here:

Caused by: java.lang.NoClassDefFoundError: com/hp/hpl/jena/iri/
IRIFactory
at
com.hp.hpl.jena.rdf.arp.impl.XMLHandler.<init>(XMLHandler.java:
431)
at
com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.<init>(RDFXMLParser.java:
40)

You obviously have the com.hp.hpl.jena.rdf part of Jenna already on
board, but the missing class is in com.hp.hpl.jena.iri. Might this
package be in a second Jenna jar you need to add to your classpath?

regards
gregor

Nix

unread,
May 16, 2008, 2:24:35 PM5/16/08
to Google Web Toolkit
Thank you Gregor, your hint worked !!! There were two packages missing
which were in different jars.

Regards,
Nix
Reply all
Reply to author
Forward
0 new messages