User 781a908cdf
16-08-2004 16:08:04
hello,
I want to do a reaction in a JSP and so I used the first example in the API concerning Reactor and when I want to set the reactants :
java.lang.NullPointerException
chemaxon.reaction.Reaction.getReactantCount(Reaction.java:294)
chemaxon.reaction.Reactor.getReactantCount(Reactor.java:620)
chemaxon.reaction.Reactor.setReactants(Reactor.java:573)
... etc
the error in my file is located at the line "reactor.setReactants(reactants);"
Here is my code :
where xml come from the xml file attached, nameReact the ID in this file, moltest the reactants in mol format.
Could somebody help me ?
bye.
I want to do a reaction in a JSP and so I used the first example in the API concerning Reactor and when I want to set the reactants :
java.lang.NullPointerException
chemaxon.reaction.Reaction.getReactantCount(Reaction.java:294)
chemaxon.reaction.Reactor.getReactantCount(Reactor.java:620)
chemaxon.reaction.Reactor.setReactants(Reactor.java:573)
... etc
the error in my file is located at the line "reactor.setReactants(reactants);"
Here is my code :
Code: |
Reactor reactor = new Reactor(); Standardizer std = new Standardizer(xml); Reaction reaction = new Reaction(nameReact,std); reactor.setReaction(reaction); MolHandler mh = new MolHandler(moltest); Molecule molec = new Molecule(mh.getMolecule()); String mole = (mh.getMolecule()).toFormat("smiles"); String[] tmp = mole.split("\\."); Molecule[] reactants = new Molecule[tmp.length]; for(int i=0;i<tmp.length;i++){ MolImporter molimp = new MolImporter(); reactants[i] = molimp.importMol(tmp[i]); } reactor.setReactants(reactants); Molecule[] products = null; int nb=1; while ((products = reactor.react()) != null) { %><p>List <%=nb++%> of products : <br><ul><% for(int j=0;j<products.length;j++){ %><%=products[j].toFormat("smiles")%><br><% } } |
where xml come from the xml file attached, nameReact the ID in this file, moltest the reactants in mol format.
Could somebody help me ?
bye.