Exporter error and adding fields in a stream from JChemTable

User c226609425

15-05-2006 14:30:43

Hi ChemAxon team,





First, when I use the "exporter" to export compounds from my "jChem table", an error occured only with this function, as if this last one does not exist.





/var/servers/programs/jakarta-tomcat4.1.31/work/Standalone/localhost/hGPCRLig/jsp/transfer/transferChemaxonLigands_jsp.java:365: cannot find symbol


symbol : method setOuputFieldNames(java.lang.String)


location: class chemaxon.jchem.db.Exporter


exporter.setOuputFieldNames( "ID MW PSA HBA HBD RINGS ROTBONDS NAME" );





However, I don't have any error with the other functions.








In a second time, I would like especially to add some information in a stream.


For example, people download compounds from the JChemTable in a SD format (PSA, MOLWEIGHT, etc ...), but in this stream, I would like to add a field such as "receptors of this coumpounds" and add all this receptors but these are not presents in this table and arise from another location (files or calculation, etc ...).





Consequently, to answer to this kind of problem, I tried :





outs is my OuputStream (JspWriter).


endOfLine is my type of end of line such as \r, \r\n, \n.





Code:



Exporter exporter = new Exporter();


Exporter.setOutputStream( outs );


//exporter.set ...





while ( exporter.writeNext() ){


//Some information added here like


outs.flush();


outs.write( ("lines to add"+endOfLine).getBytes() );


outs.flush();


}








But when I write this code, the lines can be inserted anywhere in the stream ( i.e : in the connection table ).





Best regards





Biolbo

ChemAxon 9c0afc9aaf

15-05-2006 14:56:29

Hi,





As for all bug reports, it would be handy to know which JChem version you use.





It seems that in your Tomcat there are older JChem jar files than the version you are trying to write your application for.


That's why you cannot find the specified function, it only exists since JChem 3.1.


After you update the jar files under Tomcat, please don't forget to restart it.





Please also see the following topic on how to determine the version of jchem.jar:





http://www.chemaxon.com/forum/ftopic127.html





I will get back to you with the other issue, after the version mix-up has been solved.





Best regards,





Szilard

User c226609425

15-05-2006 16:00:24

My version seems to be good :


JChem --> 3.1.3


Table --> 27





To obtain it, I use the following command java -jar jchem.jar in "<myJspWebsite>/WEB-INF/lib/jchem.jar".





Best regards





Biolbo

ChemAxon 9c0afc9aaf

15-05-2006 16:11:34

I suspect there is an other jchem.jar which is used by Tomcat.





For example it might be under <tomcat_home>/shared/lib





Please check the version programmatically if in doubt.


(By printing chemaxon.jchem.VersionInfo.JCHEM_VERSION


and


chemaxon.jchem.VersionInfo.JCHEM_TABLE_VERSION, as described in the referenced topic)





It may also be helpful to clear the work directory of Tomcat and restart it.








Szilard

User c226609425

15-05-2006 16:33:52

The problem was solved.


Thanks for this first problem.





Best regards.





Biolbo

ChemAxon 9c0afc9aaf

16-05-2006 16:16:06

Hi,





Regarding the second problem:





The reason for this behavior is simple: we do not write to the specified stream directly, but it's embedded into a buffered stream.





So it's not enough to flush the lower level stream, if the higher-level buffered stream is not flushed (but that is not accessible from the API).





We did not expect any problems with this, as we never thought anybody would want to write into this stream directly during the export process.


(and even without this buffering behavior I wouldn't recommend that)





Do I understand right, that now that you can use setOuputFieldNames(java.lang.String), this stream problem is not relevant any more ?





Best regards,





Szilard