JChem in Java 1.5

User 34fa07fa99

16-11-2006 19:05:27

Hello,





We used to have JChem (I am not sure how to check which versions of the library we are using since the jar is called jchem.jar but Marvin is at 4.0.1) under Tomcat 5.0 and java 1.4 work fine but we had to upgrade our server to Tomcat 5.5 and java 5 and since then we've had some problems like the search doesn't find anything and the drawing of the molecules throws the following exception:





java.lang.NoClassDefFoundError


at java.lang.Class.forName0(Native Method)


at java.lang.Class.forName(Class.java:164)


at java.awt.Toolkit$2.run(Toolkit.java:821)


at java.security.AccessController.doPrivileged(Native Method)


at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)


at chemaxon.marvin.util.MolPainter.calcBounds(MolPainter.java:1215)


at chemaxon.marvin.util.MolPainter.setBoundsFor(MolPainter.java:663)


at chemaxon.marvin.modules.ImageExport.initPainter(ImageExport.java:313)


at chemaxon.marvin.modules.ImageExport.convert(ImageExport.java:232)


at chemaxon.marvin.modules.PngExport.convert(PngExport.java:41)


at chemaxon.struc.Molecule.toObject(Molecule.java:1362)


at chemaxon.struc.Molecule.toBinFormat(Molecule.java:1297)

ChemAxon 9c0afc9aaf

16-11-2006 19:42:39

Hi,





I have moved the post from the "Instant JChem" forum to here, because the question is clearly not about Instant Jchem.


(Intant Jchem is an exciting new product, it may also worth to take a look at http://www.chemaxon.com/instantjchem/ )





Back to the original question:





We do not have any known incompatibility with either Java 1.5 or Tomcat 5.5.


So something must be misconfigured.





Did you upgrade the version properly ?


(some data in old databases have to be recalculated)


Please see this topic for general advice on upgrade:





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





I would emphasize the clearing of Tomcat's cache, and placing the new jchem.jar to the appropriate position. Please take care that no other ChemAxon jar files should be visible for Tomcat.





Best regards,





Szilard

User 34fa07fa99

16-11-2006 20:07:47

Hello,





Do I really need to run jcman. Here is what we did exactly:





We copied the database from mysql 4.0 to mysql 4.1


We copied the webapp from Tomcat 5.0 to Tomcat 5.5


We connected the two.





Stephane

ChemAxon 9c0afc9aaf

17-11-2006 09:32:46

Quote:
Do I really need to run jcman.
Yes you do.


Please follow the instructions, otherwise it will not work.





Szilard

User 34fa07fa99

17-11-2006 19:44:18

ok, no problem i will run the command, but I don't think it should solve the NoClassDefFoundProblem

User 34fa07fa99

17-11-2006 21:36:03

I have run jcman and regenerated all the data but the search still returns no results, perhaps one should not export/import data directly by using commands like mysqldump but should use jcman instead.

ChemAxon 7c2d26e5cf

21-11-2006 10:28:20

If I understand well, the problem is that the image generation does not work you. Is it true?


If yes, the external resources of jchem.jar may be missing.


All files from jchem/lib is required for jchem.jar. Image export uses third party modules (like Batik or Freehep API) whose jar files should be in the same directory than jchem.jar.


Thus, copy all files from jchem/lib to the proper directory of Tomcat (beside jchem.jar).

ChemAxon 9c0afc9aaf

21-11-2006 11:14:09

Hi,


Quote:
but the search still returns no results
Sorry for answering a bit late, but I could just figure out a possible explanation.





There are no error messages during the search (e.g. in catalina.out), right ?





Interestingly I've just had the same problem yesterday on our new server after MySQL version change.


Some tables had no results, and one table seemed to contain all structures 3 times.





The culprit was the JDBC driver.


In our particular case I have replaced version 3.1.6 to version 3.0.10 (it was the first one I found) and it fixed the problem.


(Our new MySQL version is 4.1.15.)





So please try some other JDBC drivers.


Make sure only 1 JDBC jar is present in the shared/lib directory of Tomcat, and that you restart Tomcat after changing the jar file.





Best regards,





Szilard





PS: We have also used mysqldump for migration, it is safe and should not cause any problem.

User 34fa07fa99

21-11-2006 18:51:29

We identified the reason why the image generation did not always work. Some explanation can be found here:


http://www.mail-archive.com/[email protected]/msg159940.html





In our case we had a problem in the tomcat stop script and it did not shut down properly which made it run without XServer the next time it was started. So we just made sure it runs in mode XServer every time.





The link above investigates a way to do without XServer but but we did not try it.

User 34fa07fa99

21-11-2006 18:54:54

Under MySQL 4.0 we used mysql-connector-java-3.0.16-ga-bin.jar and now, under MySQL 4.1 we are using mysql-connector-java-3.1.11-bin.jar.





The problem is that we have other applications running and if I remember correctly, the old driver did not handle foreign keys properly. On the other hand, there is a way to use both drivers, each for a particular webapp so I might just try that and I will post again if it works.

User 34fa07fa99

21-11-2006 19:42:13

It definitely fixed the problem to go back to 3.0.16. Also, it seems that the only difference between the two driver versions is performance because the old one does not support server-side prepared statements so its acceptable.


(http://dev.mysql.com/doc/refman/5.0/en/connector-j-versions.html)


Thank you for the assistance!

User 34fa07fa99

22-11-2006 16:20:53

Hello,





While the search for benzene works, the Naphthalene doesn't yield any results. Any thoughts? Should I run jcman?





Thanks.

ChemAxon 9c0afc9aaf

22-11-2006 17:10:40

Hi,
Quote:
While the search for benzene works, the Naphthalene doesn't yield any results. Any thoughts? Should I run jcman?
If you have already regenerated the table(s) with jcman (the new version), then it will not change anything.





Maybe there is no naphtalene in the database ?





Best regards,





Szilard

User 34fa07fa99

22-11-2006 19:49:41

Hi,





I have decided to run jcman after all (since I hadn't done it till now).





But I get the exception below and my question is:





How does it know the table InventoryStructures needs to be updated since I didn't specify it in the command? On the other hand, the table does exist but in all lowercase and under linux this is a problem.





Property table jchemproperties was updated sucessfully


Error for table InventoryStructures


java.sql.SQLException: Base table or view not found message from server: "Table 'geminx_22112006.InventoryStructures' doesn't exist"


at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)


at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)


at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)


at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1224)


at com.mysql.jdbc.Connection.execSQL(Connection.java:2248)


at com.mysql.jdbc.Connection.execSQL(Connection.java:2196)


at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)


at chemaxon.jchem.db.TableInfo.containsHashColumn(TableInfo.java:1229)


at chemaxon.jchem.db.Updater.getTablesWithNoHashColumn(Updater.java:340)


at chemaxon.jchem.db.Updater.getUpdateInfoForAddingHashColumn(Updater.java:155)


at chemaxon.jchem.db.Updater.getNextUpdateInfo(Updater.java:102)


at chemaxon.jchem.Command.updateTables(Command.java:569)


at chemaxon.jchem.Command.main(Command.java:500)

User 34fa07fa99

22-11-2006 22:12:46

I overcame this problem by renaming the table to the proper case and run jcman but the Naphthalene still doesn't yield any results. I am joining a png image of a molecule in the database that should be found as containing the Naphthalene.

ChemAxon 9c0afc9aaf

23-11-2006 09:46:48

Hi,





You write:
Quote:
I have run jcman and regenerated all the data but the search still returns no results,
then:
Quote:
I have decided to run jcman after all (since I hadn't done it till now).
It is hard to help if you confuse me ... :)
Quote:



How does it know the table InventoryStructures needs to be updated since I didn't specify it in the command?
I believe you ran the "jcman u" command ?


(jcman can do a lot of things, so "run jcman" is not a very explicit expression).


jcman first checks if the data structure needs to be upgraded, then offers to regenerate all tables. The table list comes from the actual property table.
Quote:
On the other hand, the table does exist but in all lowercase and under linux this is a problem.
It seems like a JDBC driver bug specific to version 3.1.1, an other user had a similar problem:





http://www.chemaxon.com/forum/ftopic1298.html&highlight=case+mysql





Unfortunately once 3.1.1 inserted the wrong record into the property table, replacing the driver is not enough in itself, but I see you could find a solution.
Quote:



but the Naphthalene still doesn't yield any results. I am joining a png image of a molecule in the database that should be found as containing the Naphthalene.
Strange.


I have inserted the very same structure into our live example (table "editexample"), and it is found by naphthalene.





http://www.chemaxon.com/jchem/examples/jsp1_x/index.jsp





(Actually we have 3.2.1 online now, but there were no major changes since 3.2).





If you have not done this, please regenerate the table (this can take for a while for big tables):


Code:



jcman r <table_name>






Let me know if this helps.





Szilard

User 34fa07fa99

23-11-2006 17:29:08

You are right, I did confuse you :)





So I had run the JChem visual manager on my development machine (which is equivalent to running the command in a console I believe) and it didn't solve the problem but after that I ended up running it on the production server. The command I run was:


Code:
/jchem_3_2/bin/jcman -u --driver com.mysql.jdbc.Driver --login root --password "" --proptable jchemproperties --dburl jdbc:mysql://localhost:3306/






Today I run the jcman -r <inventorystructures> command but it did not solve the pb.





My question now is: Do I need to update the jchem.jar as well as the marvin applet to their latest versions and do I need to restart the server after all these regeneration commands?





Thanks for all your help.

User 34fa07fa99

23-11-2006 19:38:22

I decided to update everything to the last version just to try it out but I run into the following javascript error: can_signed_be_used is not defined





I checked and indeed, the function is no longer there in the new marvin.js file. What should I use instead?





Thanks

User 34fa07fa99

23-11-2006 19:58:10

I fixed the js error by commenting the call :


Code:
signed = false;//can_signed_be_used();






Now the search works!





Thank you again and I hope I won't bother you soon :)

ChemAxon 7c2d26e5cf

24-11-2006 10:40:31

Yes, the "can_signed_be_used()" function is deleted from marvin.js because it is deprecated.


Where did you find reference to it? I have found reference to it neither in JChem nor in Marvin examples.

User 34fa07fa99

24-11-2006 15:35:21

It was referred in our own code :)