Internal reference DLL issue

User 82b20b535e

19-08-2015 13:28:31

Hi,


I have packaged the ChemAxon Dlls and create a setup to be installed on a test server which I do not have access. I have Chem Axon version 15.6.2200


Chem Axon is throwing an error as outlined below.  Test server does not have a ChenmAxon installation and all the DLLS required are copied to the bin folder of the application.


What are the DLLS required in order to connect to the database using ChemAxon 


                     MainFactory.Database.OpenJChem(connection);


 


The type initializer for 'ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler' threw an exception.


System.TypeInitializationException: The type initializer for 'ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler' threw an exception. ---> java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver


   at Java_java_lang_Class.forName0(String name, Boolean initialize, ClassLoader loader)


   at java.lang.Class.forName(String className, CallerID )


   at java.lang.Class.forName(String className)


   at ChemAxon.NET.IKVM.DB.Driver.DriverManager.???


?????(Object )


   at ChemAxon.NET.IKVM.DB.Driver.DriverManager.Load(DatabaseDriver driver)


   at ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler.???


??????(DatabaseDriver driver)


   at ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler.LoadJDBCDrivers()


   at ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler.???


??????()


   at ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler..cctor()


   --- End of inner exception stack trace ---


   at ChemAxon.NET.IKVM.DB.Entities.AbstractDatabaseHandler..ctor(IDatabaseURLConverter databaseURLConverter)


   at ChemAxon.NET.IKVM.DB.Entities.JChemDatabaseHandler..ctor(IDatabaseURLConverter databaseURLConverter)


   at ChemAxon.NET.API.DB.DBHandlerFactory.OpenJChem(IDatabaseURLConverter connection)


   at ASPStructure.PanacheDatabase..ctor(ConnectionData connectioninfo)


   at ASPStructure.PanacheStructure.GetStructure(ConnectionData connectioninfo, String primarykey, PASSEDKEY keypassed)

ChemAxon 2e7d8629fa

19-08-2015 22:08:47

 Hi,


 


As I can see your JTDS JDBC driver is missing.


Please check the following links:


https://www.chemaxon.com/dotNET/6.3/examples.html#jchemsetup


http://jtds.sourceforge.net/


 


I removed all of the installed ChemAxon products from my machine and copied the DLLs into the bin folder of my test project. (The GAC is empty.) The zip file which contains the DLLs is here:


https://www.chemaxon.com/download.php?d=%2Fdata%2Fdownload%2Fjchem%2F15.8.17.0%2FJChem_NET_API_15.8.17.0.zip


My test project works properly. It refers to 4 DLLs explicitly:


- ChemAxon.NET.Base.dll


- ChemAxon.NET.IKVM.dll


- ChemAxon.NET.Windows.Forms.dll


- ChemAxon.NET.dll


 


Calling MainFactory.Database.OpenJChem(connection) works correctly.


 


Best regards,


Gergely

ChemAxon 2e7d8629fa

19-08-2015 22:18:45

Please check this code snippet:


DriverManager.Load(DatabaseDriver.jTDS_JDBC_Driver);


Does it work? If not, that means the driver is missing.


I guess you use MS SQL server. If you would like to use Windows authentication you need ntlmauth.dll as well.


 


Regards,


Gergely

User 82b20b535e

20-08-2015 12:19:19










gkovacs wrote:

Please check this code snippet:


DriverManager.Load(DatabaseDriver.jTDS_JDBC_Driver);


Does it work? If not, that means the driver is missing.


I guess you use MS SQL server. If you would like to use Windows authentication you need ntlmauth.dll as well.


 


Regards,


Gergely



Hi Gergely,


I am connecting to SQL Server 2014 on Windows 2012 Server OS


I do not see the ntlmauth.dll in the installation folder. is my installation wrong as i do have a copy of the ntlmauth.dll but version I have installed is no longer present. See the attachment?


You are correct that the ntlmauth.dll doesn ot exist in the bin folder. I copied the  ntlmauth.dll into the bin folder and still I get the same error as described above.


I have also attached the ntlmauth version I have copied. Since I do not see issues with my development server where as i see issues in the Test Sever and difference is Test Server doesn't have Chem Axon Installed.


Would it be helpful to you if i can demo this. let me know?



User 82b20b535e

21-08-2015 16:28:56

Hi Gergely,


Can you mark this issue as high priority as we are suppose to go to production in 2 another weeks.


Please help


 



ChemAxon 2e7d8629fa

24-08-2015 10:09:57

 Hi,


Before calling MainFactory.Database.OpenJChem(connection); please try to use this:


var driver = new net.sourceforge.jtds.jdbc.Driver();


java.sql.DriverManager.registerDriver(driver);


(Instead of ChemAxon.NET.IKVM.DB.Driver.DriverManager.Load(DatabaseDriver.jTDS_JDBC_Driver); but it also should work...)


 


For this you have to refer the following assemblies directly in your project:


- IKVM.OpenJDK.Jdbc.dll


- ChemAxon.IKVM.jtds.1.2.2.dll


 


Anyway, we had a similar issue in the past:


https://www.chemaxon.com/forum/ftopic6717.html&start=0&postdays=0&postorder=asc&highlight=&sid=bff08fe9b88343abb03f60a9aa161b46


 


Does it work?


Regards,


Gergely



User 82b20b535e

24-08-2015 18:34:43










gkovacs wrote:

 Hi,


Before calling MainFactory.Database.OpenJChem(connection); please try to use this:


var driver = new net.sourceforge.jtds.jdbc.Driver();


java.sql.DriverManager.registerDriver(driver);


(Instead of ChemAxon.NET.IKVM.DB.Driver.DriverManager.Load(DatabaseDriver.jTDS_JDBC_Driver); but it also should work...)


 


For this you have to refer the following assemblies directly in your project:


- IKVM.OpenJDK.Jdbc.dll


- ChemAxon.IKVM.jtds.1.2.2.dll


 


Anyway, we had a similar issue in the past:


https://www.chemaxon.com/forum/ftopic6717.html&start=0&postdays=0&postorder=asc&highlight=&sid=bff08fe9b88343abb03f60a9aa161b46


 


Does it work?


Regards,


Gergely





Hi Gergely,


I am surprised that it has worked for you as it gives the same error for me.


Any how, what I have done is copy all the DLLS in CheAxon.net and JChem.net into bin folder and that works with out ntlmauith.dll. I had asked you about the installation which you never replied see above?


I have no clue which dlls are needed but copying all dlls works.


There should be a better way to exclude  unwanted dlls and only have the required. Hope you will help me identify only the required dlls? 


 


 


 


 

ChemAxon 2e7d8629fa

24-08-2015 20:21:29

 Hi,


 


I cannot tell you which DLLs are required and which not. It depends on your workflows. If you use e.g. Marvin for structure drawing/editing you need Marvin DLLs; if you use chemical filtering you need JChem DLLs; if you use any of calculations you need calculator plugin DLLs; etc. Furthermore, I don't know the relations among the DLLs/modules. These are developed by separated teams and I don't know them projects deeply, I don't know which DLLs are used in each module. It is clear that will be helpful to know the reference graph but I cannot help you at this moment. What you can do now is just the trial-and-error method or you have to copy all of the DLLs into the bin folder. Sorry...


 


Best regards,


Gergely

ChemAxon 0e37943a96

26-08-2015 14:04:06

Hi,


Is this a ASP.NET application so the code runs on the server, or are you trying to simply access the SQL Server remotely from a client machine. From the stack trace I assume it is ASP.


I would suggest to install JChem .NET API on the remote machine, that would install all the required DLLs to GAC. From the error message it seems, that it will not even try to authenticate.


With applications running within IIS, the best is copy ntlmauth.dll to System32.


With Windows 2012 unfortunately there is another issue with jTDS. You have to call java.lang.System.setProperty("os.name", "Windows 2012"); somewhere in the code before you open the connection. Initially it returns a wrong value.


Best regards,


Tamas.


 


 

User 82b20b535e

26-08-2015 14:41:03










tpelcz wrote:

Hi,


Is this a ASP.NET application so the code runs on the server, or are you trying to simply access the SQL Server remotely from a client machine. From the stack trace I assume it is ASP.


I would suggest to install JChem .NET API on the remote machine, that would install all the required DLLs to GAC. From the error message it seems, that it will not even try to authenticate.


With applications running within IIS, the best is copy ntlmauth.dll to System32.


With Windows 2012 unfortunately there is another issue with jTDS. You have to call java.lang.System.setProperty("os.name", "Windows 2012"); somewhere in the code before you open the connection. Initially it returns a wrong value.


Best regards,


Tamas.


 


 



Hi Tamas,


Appreciate your response.


Yes it is an ASP.NET Web Forms application and yes it is on Windows 2012. Its a very simple application, only to display structure I use chem Axon component to connect to Database and render structure data as image.


I do not have access on Test or Production Servers to install 3rd party software's. Even if I venture, I have to go a long approval process which I am not sure if possible.


As I indicated before which I hate is to copy all DLLS ( ChemAxon.Net and JChem.Net) as I am sure many are not used. Application started to display Images.


Surprisingly to the fact that I didn't copy ntlmauth.dll and assume that there can be a some copy of ntlmauth.dll in system32 folder ( may be).


Thanks for your email.