This is a migrated thread and some comments may be shown as answers.

[Solved] Unable to create instance of driver class

7 Answers 257 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Garry
Top achievements
Rank 1
Garry asked on 08 Dec 2009, 07:46 PM

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;  
        } 

7 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 11 Dec 2009, 03:39 PM
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.
0
Dmitri Nesteruk
Top achievements
Rank 1
answered on 18 Jun 2010, 04:10 PM
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.
0
PetarP
Telerik team
answered on 24 Jun 2010, 08:23 AM
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
0
paolo
Top achievements
Rank 1
answered on 10 Jul 2010, 02:03 PM
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   

0
PetarP
Telerik team
answered on 14 Jul 2010, 08:21 AM
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
0
paolo
Top achievements
Rank 1
answered on 17 Jul 2010, 05:13 PM
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
0
PetarP
Telerik team
answered on 19 Jul 2010, 08:12 AM
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
Tags
General Discussions
Asked by
Garry
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Dmitri Nesteruk
Top achievements
Rank 1
paolo
Top achievements
Rank 1
Share this question
or