Unable to create instance of driver class

Thread is closed for posting
8 posts, 0 answers
  1. Garry
    Garry avatar
    205 posts
    Member since:
    Nov 2010

    Posted 08 Dec 2009 Link to this post

    I have upgraded to the latest version of OpenAccess and now a Sitefinity module that uses OpenAccess and that has been working is now throwing the following error message on the following method. Any ideas on how to quickly fix this would greatly be appreciated.

    Thanks!

    Error

    Unable to create instance of driver class 'Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver': System.Exception: The type initializer for 'Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver' threw an exception. ---> System.InvalidCastException: Unable to cast object of type 'Telerik.OpenAccess.Reflect.RuntimeClass' to type 'Telerik.OpenAccess.Reflect.Class'.  
       at Telerik.OpenAccess.RT.ClassHelper.FromFound(Object[] x)  
       at Telerik.OpenAccess.RT.ClassHelper.FromType(Type type)  
       at Telerik.OpenAccess.RT.ClassHelper.FromClass(Type cls)  
       at Telerik.OpenAccess.RT.sql.DriverManager.registerDriver(Driver driver)  
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.Initialize()  
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver..cctor()  
       --- End of inner exception stack trace ---  
       at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type)  
       at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)  
       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)  
       at Telerik.OpenAccess.Reflect.RuntimeClass.newInstance()  
       --- End of inner exception stack trace ---  
       at Telerik.OpenAccess.Reflect.RuntimeClass.newInstance()  
       at OpenAccessRuntime.Relational.sql.SqlDriver.createJdbcDriver(String name, Object cl) 

    Code

    static public IObjectScope GetNewObjectScope()  
            {  
                Database db = Database();  
     
                IObjectScope newScope = db.GetObjectScope();  
                return newScope;  
            } 

  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 11 Dec 2009 Link to this post

    Hi Garry Clark,

    Did you rebuild everything? Is it possible that an old reference to an older version of OpenAccess is still there? You should replace all the references with the newest version installed on your machine. The exception itself seems to be caused by a version mismatch between your installed version and the one you are referencing.

    If this is not the case can you please provide as much information as possible so that we can reproduce this problem here locally? Thank you in advance for your cooperation on this issue.


    Greetings,
    Petar
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Dmitri Nesteruk
    Dmitri Nesteruk avatar
    4 posts
    Member since:
    Dec 2009

    Posted 18 Jun 2010 Link to this post

    I'm having exactly the same problem. Downloaded latest copy of OpenAccess today, updated my project, and am getting this exception. Oh and I checked - I don't have older versions or anything like that.
  4. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 24 Jun 2010 Link to this post

    Hi Dmitri Nesteruk,

    This error is caused by mismatch between versions of Telerik OpenAccess ORM. Maybe you have an older assembly in a local folder that is being referenced? Did you check your GAC for older versions of our assemblies? Another possibility is that you are referencing an assembly that has been built with older version of Telerik OpenAccess ORM. If you are sure that your problem is not caused by any of those reasons we would like to ask you to send us a sample project if possible so that we can inspect your problem further.

    Greetings,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. paolo
    paolo avatar
    9 posts
    Member since:
    Jun 2009

    Posted 10 Jul 2010 Link to this post

    same problem here. i upgraded my telerik openaccess verson to the latest as of this date and my WCF project is throwing this error after building (i deleted all telerik.openaccess references in the project and put them back using "context menu->openaccess>enable project").

    this is the error im getting from vs.net 2008:

    Error   2   OpenAccess Error: Unable to create instance of driver class 'Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver': System.InvalidCastException: Unable to cast object of type 'Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver' to type 'Telerik.OpenAccess.RT.sql.Driver'.
       at OpenAccessRuntime.Relational.sql.SqlDriver.createJdbcDriver(String name, Object cl)   NalewanyjWCF   

  6. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 14 Jul 2010 Link to this post

    Hi paolo,

    Can you confirm that there weren't any old assemblies in the GAC prior to installing the product? The only cause for the exception you are seeing is that there were some old assemblies on your machine when you installed the newest version. Please clean your machine entirely and install the product again. This should fix your problem.

    Kind regards,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. paolo
    paolo avatar
    9 posts
    Member since:
    Jun 2009

    Posted 17 Jul 2010 Link to this post

    Hi Petar,

    Sorry for the late reply. Manila just got hit by a super typhoon last Tuesday. Power was out for two days straight and internet connection restoration followed 2 days after.

    Anyway, before I installed the latest installers, I did uninstall each one (ASP.NET, WPF, and OpenAccess). If that's the case, should I manually get in the GAC and delete all Telerik assemblies and try reinstalling?

    Thanks!

    Paolo
  8. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 19 Jul 2010 Link to this post

    Hi paolo,

     Yes you should. We had problems with the uninstaller in some versions that prevented out assemblies from being removed from the GAC. If that has occurred, installing a new version on a machine that is not entirely clean would result in the problems you have encountered.

    Kind regards,
    Petar
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top