[Mulgara-general] LocalJRDFSession

Omar Khan okhan at 2paths.com
Wed Nov 26 00:56:50 UTC 2008

I'm a newbie to mulgara. I'm trying to follow the integration with JRDF
tutorial provided on the mulgara website. When I cut and past it in and run
it I get a class cast exception:

Exception in thread "main" java.lang.ClassCastException:
    at org.twopaths.jrdf.Sandbox.main(Sandbox.java:36)

According to the documentation, if you set the boolean parameter for
SessionFactoryFinder.newSessionFactory(serverURI, false) to false, it should
return a LocalJRDFSession however, it returns a remote session.

I've also tried to use the JRDF client rather than server and I get a no
such method exception

Exception in thread "main" java.lang.NoSuchMethodError:
org.jrdf.graph.AbstractTripleFactory: method <init>()V not found

I checked the source for the class and the method isn't there.

I'm using Mulgara 2.0.6 on am Mac running OSX. I'm developing in Eclipse.

Any guidance you could provide would be appreciated.

The code that I'm running is as follows:

package org.twopaths.jrdf;

import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.UnknownHostException;

import org.jrdf.graph.Graph;
import org.jrdf.graph.GraphException;
import org.mulgara.client.jrdf.AbstractGraphFactory;
import org.mulgara.jrdf.JRDFGraph;
import org.mulgara.jrdf.LocalJRDFSession;
import org.mulgara.query.QueryException;
import org.mulgara.server.JRDFSession;
import org.mulgara.server.NonRemoteSessionException;
import org.mulgara.server.SessionFactory;
import org.mulgara.server.driver.SessionFactoryFinder;
import org.mulgara.server.driver.SessionFactoryFinderException;

public class Sandbox {
    public static void main(String[] args) {
        try {
            // Create the host name
            String hostname =

            // Create the URI of the server
            URI serverURI = new URI("rmi", hostname, "/" + "server1", null);

            // Create a new session factory, ensure that it's local
            SessionFactory sessionFactory =
SessionFactoryFinder.newSessionFactory(serverURI, false);

            // Get a local JRDF Session (local)
            Object o = sessionFactory.newJRDFSession();
//            JRDFSession session = (JRDFSession)
            LocalJRDFSession session = (LocalJRDFSession)

            //create a new Model
            URI modelURI = new URI("rmi", hostname, "/" + "server1",
            URI modelType = new URI("http://mulgara.org/mulgara#Model");
            session.createModel(modelURI, modelType);

            //create a JRDF Graph for the model
            Graph graph = new JRDFGraph(session, modelURI);
//            Graph graph = AbstractGraphFactory.createGraph(serverURI,
        } catch (UnknownHostException uhe) {
        } catch (URISyntaxException urise) {
        } catch (SessionFactoryFinderException sffe) {
        } catch (NonRemoteSessionException nrse) {
        } catch (QueryException qe) {
        } catch (GraphException ge) {


 Omar Khan
Technical Architect

*e:* okhan at 2paths.com
*p:* 604-689-4123 ext 13
*w:* http://www.2paths.com
  2Path Solutions <http://www.2paths.com>
Suite 502-1540 West 2nd Avenue
Vancouver, BC
V6J 1H2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-general/attachments/20081125/1151e0ff/attachment.htm>

More information about the Mulgara-general mailing list