Latest Version - Portability Issue

User 764dd4e021

01-05-2012 14:49:17

Using Marvin latest version 5.9.3, my old code for SMILE conversion is giving me exception :


 Code :


        String aSmileString = "CC";


        byte[] byteSmiles = aSmileString.getBytes();
        java.io.ByteArrayInputStream theInputStream = new java.io.ByteArrayInputStream(byteSmiles);
        java.io.ByteArrayOutputStream theOutputStream = new java.io.ByteArrayOutputStream();
        try
        {
            MolConverter theConverter = new MolConverter(theInputStream, theOutputStream, "mol:-a", false);
            theConverter.convert();
            mol = theOutputStream.toString();
            mol = mol.replace('\n','|');
            
        }
        catch(MolFormatException MFE)
        {
            theDto.setMolString("");
            return theDto;
        }
        
        catch(Exception e)
        {
            System.out.println("Error in getMolFromSmiles: " + e.getMessage());
            theDto.setMolString("");
            return theDto;
        }


 


Exception is ClassCastException : 


chemaxon.marvin.io.formats.mdl.MolExport cannot be cast to chemaxon.marvin.io.MolExportModule.

Please share any idea on the above problem; whether it is a portability issue or coding one.

Regards.

ChemAxon 7c2d26e5cf

07-05-2012 15:04:54

We have tried out your code with Marvin Beans 5.9.3 API. It has worked fine.


I assume it may be a configuration issue on your side.


Probably, there is some deprecated code in your classpath that cause conflict by MDL molfile export.


Please also check wheather the jar files are not damaged in the lib folder of the Marvin Beans package.
The simplest way to do it, launch MolConverter, MarvinView or MarvinSketch application from the installed Marvin Beans package and do any conversion into "mol" file format.