The import chemaxon.sss cannot be resolved

User 821bd24b08

08-03-2010 12:02:22

Hi all,


I am getting "The import chemaxon.sss cannot be resolved" this error in Eclipse and i am not able to find the solution for this. I tried by deleting JAR files from lib and again pasted those JAR files ....but its not working..can any body please give me a hind to overcome this issues.


import chemaxon.sss.search.MolSearch;//shows error
  import chemaxon.sss.search.SearchException;//shows error
  import chemaxon.util.MolHandler;//shows error
  import chemaxon.formats.MolInputStream;
  import chemaxon.formats.MolImporter;
  import chemaxon.struc.Molecule;

  import java.io.BufferedInputStream;
  import java.io.FileInputStream;
  import java.io.IOException;

  public class searchTest {

      public static void main(String[] args) {
          try {
              MolSearch s = new MolSearch();

              // queryMode = true forces string to be imported as SMARTS
              // If SMILES import needed, set queryMode = false.
              MolHandler mh1 = new MolHandler("c1ccccc1Cl", true);
              
              // The query molecule must be aromatized if it uses the
              // alternating single/double bonds for the description of
              // aromaticity.
              mh1.aromatize();
              s.setQuery(mh1.getMolecule());

              // use Molfile molecule as target
              BufferedInputStream tis=null;
              tis = new BufferedInputStream(
                              new FileInputStream("target.mol"));
              MolInputStream tmis = new MolInputStream(tis);
              MolImporter tmolimp = new MolImporter(tmis);
              Molecule target = tmolimp.read();

              target.aromatize(true);
              s.setTarget(target);

              // search all matching substructures and print hits
              int[][] hits=null;

              hits = s.findAll();
              if(hits==null)
                  System.out.println("No hits");
              else  {
                  for(int i=0; i < hits.length; i++) {
                      System.out.print("Hit " + (i+1) + ":  ");
                      int[] hit = hits;
                      for(int j=0; j < hit.length; j++) {
                          System.out.print(hit[j]+" ");
                      }
                      System.out.println();
                  }
              }//end else
          } catch (IOException e) {
              e.printStackTrace();
              System.exit(1);
          } catch (SearchException e) {
              e.printStackTrace();
              System.exit(1);
          }//end catch
      }//end main
  }//end searchTest



 


Please help me..


Thanks in advance


 

ChemAxon e274e1bada

08-03-2010 12:14:41

Hi,


could you specify your JChem version?


Regards, Edvard

User 821bd24b08

09-03-2010 04:25:10

Hi Mr Edvard,


Thanks for your reply and the version follows...


Version 5.3.0.2


Could you please give a solution for this..


Thanks & regards,


Jeevan


 

ChemAxon e274e1bada

10-03-2010 09:55:52

Hi Jeevan,


please make sure if all jar files from the <JChem home directory>/lib directory are in the libraries of the project's build path. It seems, justMarvin specific jars are in the project's classpath.
If all are there and the problem has not disappeared, please send me a snapshot about your build path.


Regards, Edvard

User 821bd24b08

19-03-2010 04:11:36

Hi Mr Edvars,


Thanks fo ryour suggesstion.....i copied JARS from /lib folder to webapps/lproj/web-inf/lib..now its working fine..but now one more problem...


Code...


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.io.File;


import chemaxon.formats.MolFormatException;
import chemaxon.formats.MolImporter;
import chemaxon.jchem.db.Importer;
import chemaxon.jchem.db.PropertyNotSetException;
import chemaxon.jchem.db.TransferException;
import chemaxon.jchem.db.UpdateHandler;
import chemaxon.struc.Molecule;
import chemaxon.util.ConnectionHandler;
import chemaxon.util.MolHandler;
public class Molecule_Db {
 public static void main(String[] args){
  try {
  String filename = "xxx";
     MolImporter mi = new MolImporter(filename);
     mi.read();
    
     Importer imp = new Importer();
     Connection con=null;
     Statement stmt=null;
     String driver="com.mysql.jdbc.Driver",name="",comments="",tabname="molecules";
         String url = "xxx";



     ConnectionHandler conh = new ConnectionHandler();
     conh.setDriver(driver);
     conh.setUrl(url);
     conh.setLoginName("root");
     conh.setPassword("root");
    
    
         Importer importer = new Importer();
        
         importer.setInput(filename);
         importer.setConnectionHandler(conh);        
         importer.setTableName("molecules");
         importer.setLinesToCheck(100);
         importer.setHaltOnError(false);
         // checking duplicates may slow down import!
         importer.setDuplicateImportAllowed(true);
        
         // gathering information about file
         importer.init();
        
         // importing molecules into database table
          importer.importMols();
  }
  catch(TransferException e){
   System.out.println("Transfer Exception" + e);
  }
  catch(IOException ioe){
   System.out.println("IO Exception" + ioe);
  }
  
  
 }
}


 


but i am geeting the following error


java.lang.NullPointerException
Transfer Exceptionchemaxon.jchem.db.TransferException
 at chemaxon.jchem.db.TableInfo.getTableNameWithSchema(TableInfo.java:793)
 at chemaxon.jchem.db.Importer.init(Importer.java:616)
 at Molecule_Db.main(Molecule_Db.java:52)


 


please help me...


Regards,


Jeevan

 


ChemAxon 9c0afc9aaf

22-03-2010 17:13:53

Hi,


Seems like you forgot to call ConnnectionHandler.connect(), so the Connection object inside is null.


 


 ConnectionHandler conh = new ConnectionHandler();


     conh.setDriver(driver);
     conh.setUrl(url);
     conh.setLoginName("root");
     conh.setPassword("root");


     conh.connect();


After this you can obtain the Connection if directly needed by ConnectionHandler.getConnection().


 


Best regards,


 


Szilard

User 821bd24b08

23-03-2010 05:14:05

Hi Mr. Szilard,


Thanks a lot for your reply,it worked for me after your valuable information.


Regards,


Jeevan