Hello,<br>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:<br><br><span style="color: rgb(0, 102, 0);">org.mulgara.server.rmi.RemoteSessionWrapperJRDFSession</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">Exception in thread "main" java.lang.ClassCastException: org.mulgara.server.rmi.RemoteSessionWrapperJRDFSession</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);"> at org.twopaths.jrdf.Sandbox.main(Sandbox.java:36)</span><br>
<br><br>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. <br>
<br>I've also tried to use the JRDF client rather than server and I get a no such method exception<br><br><span style="color: rgb(0, 102, 0);">Exception in thread "main" java.lang.NoSuchMethodError: org.jrdf.graph.AbstractTripleFactory: method <init>()V not found</span><br>
<br>I checked the source for the class and the method isn't there. <br><br>I'm using Mulgara 2.0.6 on am Mac running OSX. I'm developing in Eclipse.<br><br>Any guidance you could provide would be appreciated.<br>
<br>The code that I'm running is as follows:<br><br><span style="color: rgb(0, 102, 0);">package org.twopaths.jrdf;<br><br>import java.net.InetAddress;<br>import java.net.URI;<br>import java.net.URISyntaxException;<br>
import java.net.UnknownHostException;<br><br>import org.jrdf.graph.Graph;<br>import org.jrdf.graph.GraphException;<br>import org.mulgara.client.jrdf.AbstractGraphFactory;<br>import org.mulgara.jrdf.JRDFGraph;<br>import org.mulgara.jrdf.LocalJRDFSession;<br>
import org.mulgara.query.QueryException;<br>import org.mulgara.server.JRDFSession;<br>import org.mulgara.server.NonRemoteSessionException;<br>import org.mulgara.server.SessionFactory;<br>import org.mulgara.server.driver.SessionFactoryFinder;<br>
import org.mulgara.server.driver.SessionFactoryFinderException;<br><br>public class Sandbox {<br> public static void main(String[] args) {<br> try {<br> // Create the host name<br> String hostname = InetAddress.getLocalHost().getCanonicalHostName();<br>
<br> // Create the URI of the server<br> URI serverURI = new URI("rmi", hostname, "/" + "server1", null);<br> <br> // Create a new session factory, ensure that it's local<br>
SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(serverURI, false);<br> <br> // Get a local JRDF Session (local)<br> Object o = sessionFactory.newJRDFSession();<br>
System.out.println(o.getClass().getName());<br>// JRDFSession session = (JRDFSession) sessionFactory.newJRDFSession();<br> LocalJRDFSession session = (LocalJRDFSession) sessionFactory.newJRDFSession();<br>
<br> //create a new Model<br> URI modelURI = new URI("rmi", hostname, "/" + "server1", "exampleGraph");<br> URI modelType = new URI("<a href="http://mulgara.org/mulgara#Model">http://mulgara.org/mulgara#Model</a>");<br>
session.createModel(modelURI, modelType);<br><br> //create a JRDF Graph for the model<br> Graph graph = new JRDFGraph(session, modelURI);<br>// Graph graph = AbstractGraphFactory.createGraph(serverURI, modelURI);<br>
} catch (UnknownHostException uhe) {<br> uhe.printStackTrace();<br> } catch (URISyntaxException urise) {<br> urise.printStackTrace();<br> } catch (SessionFactoryFinderException sffe) {<br>
sffe.printStackTrace();<br> } catch (NonRemoteSessionException nrse) {<br> nrse.printStackTrace();<br> } catch (QueryException qe) {<br> qe.printStackTrace();<br> } catch (GraphException ge) {<br>
ge.printStackTrace();<br> }<br> }<br>}<br></span><br><br><br><blockquote style="margin: 1.5em 0pt;"><br><br>
<hr style="border: 1px none ; color: rgb(142, 166, 27); background-color: rgb(142, 166, 27); height: 1px;">
<br>
<div style="float: left; width: 70px; margin-left: 20px;">
<a href="http://www.2paths.com" target="_blank"><img src="http://www.2paths.com/img/2paths.gif" border="0" height="73" width="58"></a>
</div>
<div style="float: left; width: 300px; margin-left: 20px;">
<div style="font-family: Arial; font-weight: bold; font-size: 13px;">Omar Khan</div>
<div style="color: rgb(142, 166, 27); font-family: Arial; font-size: 12px;">Technical Architect</div>
<br>
<div style="font-family: Arial; font-size: 12px;"><b>e:</b> <a href="mailto:okhan@2paths.com" style="color: rgb(142, 166, 27); font-family: Arial; font-size: 12px;" target="_blank">okhan@2paths.com</a></div>
<div style="font-family: Arial; font-size: 12px;"><b>p:</b> 604-689-4123 ext 13</div>
<div style="font-family: Arial; font-size: 12px;"><b>w:</b> <a href="http://www.2paths.com" style="color: rgb(142, 166, 27); font-family: Arial; font-size: 12px;" target="_blank">http://www.2paths.com</a></div>
</div>
<div style="float: left;">
<div> <a href="http://www.2paths.com" style="color: rgb(142, 166, 27); font-family: Arial; font-weight: bold; font-size: 12px;" target="_blank">2Path Solutions</a></div>
<div style="font-family: Arial; font-size: 12px;">Suite 502-1540 West 2nd Avenue</div>
<div style="font-family: Arial; font-size: 12px;">Vancouver, BC</div>
<div style="font-family: Arial; font-size: 12px;">V6J 1H2</div>
</div>
<div style="clear: both;"><br></div></blockquote><br>