SBW.connect();
Module module =SBW.getModuleInstance("Jarnac");
Service service = module.findServiceByName("msim");
Analysis analysis1 = (Analysis1)service.getServiceObject(Analysis1.class);
// SBML was read from a file before
analysis1.loadSBML(1,sbml);
double stepsize=analysis1.oneStep(1,1, 0.1);
//Node0 is definded in the SBML Model
System.out.println(analysis1.getValue(1,"Node0"));
When I start the program, I get the following error message:
java.lang.reflect.UndeclaredThrowableException
at $Proxy1.loadSBML(Unknown Source)
at SBWControl.SBWinitialize(SBWControl.java:133)
at SBWControl.<init>(SBWControl.java:36)
at MediatorMain.main(MediatorMain.java:14)
Caused by: edu.caltech.sbw.SBWApplicationException: Method Call Error: Error in loadSBMLFromString: Access violation at address 006CD745 in module 'Jarnac.exe'. Read of address 0000008D
at edu.caltech.sbw.RPCOutCall.waitForReply(RPCOutCall.java:208)
at edu.caltech.sbw.SBWRPC.call(SBWRPC.java:207)
at edu.caltech.sbw.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:142)
The Code is embedded in a try and catch block like in the example trigjclient.
Hope someone can help me.
Many greetings
Sebastian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Almost correct, the only problem is, that you assumed, you could assign the module handle, when in fact this module handle has to be created by Jarnac. So try this one instead:
try
{
// get the sbml
String sSBML = new String();
StringBuilder oBuilder = new StringBuilder();
BufferedReader oReader = new BufferedReader ( new InputStreamReader ( new FileInputStream("d:/frank/SBML Models/Jana_WolfGlycolysis.xml")));
while (oReader.ready())
{
sSBML = oReader.readLine();
if (sSBML == null || sSBML == "") break;
oBuilder.append(sSBML);
}
sSBML = oBuilder.toString();
SBW.connect();
Module module =SBW.getModuleInstance("Jarnac");
Service service = module.findServiceByName("msim");
Jarnac_msim analysis1 = (Jarnac_msim)service.getServiceObject(Jarnac_msim.class);
int nModel = analysis1.createModel();
// SBML was read from a file before
analysis1.loadSBML(nModel,sSBML);
Hi,
I want use the Multi-simulation Service.
//Java 1.5.09, WinXP SP2 SBW 2.6.0 Eclipse 3.2.1
My code looks like this:
SBW.connect();
Module module =SBW.getModuleInstance("Jarnac");
Service service = module.findServiceByName("msim");
Analysis analysis1 = (Analysis1)service.getServiceObject(Analysis1.class);
// SBML was read from a file before
analysis1.loadSBML(1,sbml);
analysis1.setTimeStart(1,0);
analysis1.setTimeEnd(1,20.0);
double stepsize=analysis1.oneStep(1,1, 0.1);
//Node0 is definded in the SBML Model
System.out.println(analysis1.getValue(1,"Node0"));
When I start the program, I get the following error message:
java.lang.reflect.UndeclaredThrowableException
at $Proxy1.loadSBML(Unknown Source)
at SBWControl.SBWinitialize(SBWControl.java:133)
at SBWControl.<init>(SBWControl.java:36)
at MediatorMain.main(MediatorMain.java:14)
Caused by: edu.caltech.sbw.SBWApplicationException: Method Call Error: Error in loadSBMLFromString: Access violation at address 006CD745 in module 'Jarnac.exe'. Read of address 0000008D
at edu.caltech.sbw.RPCOutCall.waitForReply(RPCOutCall.java:208)
at edu.caltech.sbw.SBWRPC.call(SBWRPC.java:207)
at edu.caltech.sbw.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:142)
The Code is embedded in a try and catch block like in the example trigjclient.
Hope someone can help me.
Many greetings
Sebastian
Almost correct, the only problem is, that you assumed, you could assign the module handle, when in fact this module handle has to be created by Jarnac. So try this one instead:
try
{
// get the sbml
String sSBML = new String();
StringBuilder oBuilder = new StringBuilder();
BufferedReader oReader = new BufferedReader ( new InputStreamReader ( new FileInputStream("d:/frank/SBML Models/Jana_WolfGlycolysis.xml")));
while (oReader.ready())
{
sSBML = oReader.readLine();
if (sSBML == null || sSBML == "") break;
oBuilder.append(sSBML);
}
sSBML = oBuilder.toString();
SBW.connect();
Module module =SBW.getModuleInstance("Jarnac");
Service service = module.findServiceByName("msim");
Jarnac_msim analysis1 = (Jarnac_msim)service.getServiceObject(Jarnac_msim.class);
int nModel = analysis1.createModel();
// SBML was read from a file before
analysis1.loadSBML(nModel,sSBML);
analysis1.setTimeStart(nModel,0);
analysis1.setTimeEnd(nModel,20.0);
double stepsize=analysis1.oneStep(nModel,1, 0.1);
//Node0 is definded in the SBML Model
System.out.println(analysis1.getValue(nModel,"ADP"));
}
catch (Exception e)
{
//nevermind
}
I hope this helps,
Cheers
Frank
Hi Frank,
cool now it runs. Thank you for the fast assistance.
Cheers
Sebastian