User cb6c8cdd0f
10-09-2005 02:39:58
I have been using the jcman tool, which works very well, to import and export sdf files.
Now, the need for a jsp/java solution has arisen.
I am using the chemaxon.jchem.db.Importer class to do a simple import of an sdf file and it is failing.
I've attached the source file (test1.java), the sdf file (test.sdf), and the error file (test.txt).
test.txt shows the error I'm getting: chemaxon.jchem.db.TransferException: Column 'cd_fp16' specified twice
Please help. Thanks.
ChemAxon 9c0afc9aaf
10-09-2005 09:56:38
Hi,
Please let me know the version of JChem you are using.
Best regards,
Szilard
User cb6c8cdd0f
13-09-2005 14:34:05
Jchem Version 3.0.12
For reference, I am paying for support.
Also, if you cannot figure out the problem, can I have a sample .java file, .sdf file, and Jchem version, that are known to work? This would be, just like mine, a simple Import example. Maybe through the differences I could pinpoint the issue.
And, if you could tell me what the error actually means, that would be great.
Thank you.
ChemAxon 9c0afc9aaf
13-09-2005 14:52:49
Hi,
Looking at the stack trace and the code of 3.0.12, it seems it wasn't thrown by JChem 3.0.12. (!)
In fact it seems that probably conflicting JChem versions cause the problem.
Please make sure that
- your application uses the same version of jchem.jar that was used to create the table
- you do not have multiple jchem.jar-s in your application's CLASSPATH
To determine the version of the jar file, please see the following topic:
http://www.chemaxon.com/forum/ftopic127.html
Let me know if this helps.
Best regards,
Szilard
User cb6c8cdd0f
25-09-2005 03:49:00
I doubled checked many things. It is version 3.0.12.
This time I even created the SDF file using the Exporter class from java code. It came out to be exactly the same as when using jcman tool.
The only thing done outside of java code was the table creation, which was done using jcman. Everything else (importing + exporting) is done in java using jchem.jar version 3.0.12.
I cannot figure out a way to avoid the "specified twice" error.
Maybe you could send me some pre-written Importer examples that are known to work.
User cb6c8cdd0f
02-10-2005 20:59:11
well it looks like I have the correct version of jchem.jar
after adding that line to my code, I get this output:
/home/test/jchem/lib:.:/usr/share/jdbc-mysql/lib/jdbc-mysql.jar
and /home/test/jchem/lib has jchem.jar of size 8777355
I've experienced getting stack traces pointing to empty lines before in strange multithreaded scenarios with null references... but I don't know what the case is here
can you please at least tell me what that error means: column "specified twice"?
ChemAxon 9c0afc9aaf
03-10-2005 08:45:14
Hi,
The problem is, that you do not use the jchem.jar under
Code: |
/home/test/jchem/lib |
To really use the jchem.jar the classpath should contain:
Code: |
/home/test/jchem/lib/jchem.jar |
It also seems from your classpath that you have probably unpacked some jchem.jar of unknown version in the lib or in the current directory, which is a bad practice. You should remove these class files to make sure that only jchem.jar is visible in the classpath. Quote: |
can you please at least tell me what that error means: column "specified twice"? |
Probably a column is specified twice in an INSERT statement that is sent by JChem to the database. You really should not worry about this, your program should run fine after fixing your classpath problem.
Best regards,
Szilard
User cb6c8cdd0f
03-10-2005 19:07:27
I removed every jchem.jar file from the machine and certainly the only jchem.jar file in the classpath was indeed in the /home/test/jchem/lib directory; and it was the correct version. Yet the same error persisted.
Magically, switching to /home/test/jchem/lib/jchem.jar actually worked. Even though from /home/test/jchem/lib:.:/usr/share/jdbc-mysql/lib/jdbc-mysql.jar... there is only one jchem.jar file; and in the right place.
Everything works seemingly correctly; however, this still doesn't explain why /home/test/jchem/lib/jchem.jar in the classpath finds the correct jchem.jar and /home/test/jchem/lib/ in the classpath doesn't.
ChemAxon 9c0afc9aaf
03-10-2005 19:24:03
Hi,
I'm glad your problem has been solved.
There is no mystery about this.
This is how Java works.
If you specify a directory in the classpath, the .class files are found in that directory and subdirectories, the subdirectories representing the packages.
The JRE will not consider the .jar files in this case at all !
If you specify the .jar file (as you should in this case), the root of the jar file is considered as the package root, and .class files are found inside the .jar file.
In short: if you want to use any .jar file, you should always specify the file, not the containing directory.
Best regards,
Szilard