Showing posts with label Exception. Show all posts
Showing posts with label Exception. Show all posts

Saturday, March 26, 2011

Quartz.ObjectAlreadyExistsException: Unable to store Job with name: '' and group: 'DEFAULT', because one already exists with this identification.

Problem:
Exception Caught: Quartz.ObjectAlreadyExistsException: Unable to store Job with name: 'updateMyStuff' and group: 'DEFAULT', because one already exists with this identification.


Code:
                 // construct job info for every 10 seconds
                JobDetail = jobDetail = new JobDetail("updateMyStuff", null, typeof(UpdateMyOneMethod));
                trig = new CronTrigger();
                trig.CronExpression = new CronExpression("0/10 * * * * ?");
                trig.Name = " updateStuff ";
                sched.ScheduleJob(jobDetail, trig);

                // job for every day 12:00 am
                jobDetail = new JobDetail("updateMyStuff", null, typeof(UpdateMyOtherMethod));
                trig = new CronTrigger();
                trig.CronExpression = new CronExpression("0 0 0 * * ?");
                trig.Name = "updateStuff";
                sched.ScheduleJob(jobDetail, trig);



Solution:
I was clearly very tired and not paying attention and made a miserable copy/paste error.  Make sure the JobDetail has a unique name and same with the trigger!  Fixed Code, changes bolded:

                 // construct job info for every 10 seconds
                JobDetail = jobDetail = new JobDetail("updateMyStuff", null, typeof(UpdateMyOneMethod));
                trig = new CronTrigger();
                trig.CronExpression = new CronExpression("0/10 * * * * ?");
                trig.Name = " updateStuff ";
                sched.ScheduleJob(jobDetail, trig);

                // job for every day 12:00 am
                jobDetail = new JobDetail("updateMyOtherStuff", null, typeof(UpdateMyOtherMethod));
                trig = new CronTrigger();
                trig.CronExpression = new CronExpression("0 0 0 * * ?");
                trig.Name = "updateOtherStuff";
                sched.ScheduleJob(jobDetail, trig);



Saturday, March 5, 2011

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

Problem:

Server Error in '/' Application.


The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

Source Error: 
 
Line 32:         /// Initializes a new xxxxEntities object using the connection string found in the 'xxxxEntities' section of the application configuration file.
Line 33:         /// 
Line 34:         public xxxxEntities() : base("name=xxxxEntities", "xxxxEntities")
Line 35:         {
Line 36:             this.ContextOptions.LazyLoadingEnabled = true;

Source File: C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxx.Designer.cs    Line: 34 

Stack Trace: 
 
[ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.]
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +8080056
   System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +42
   System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +16
   xxxx..ctor() in C:\Users\xxxxx.cs:34
   xxxx(Int32 id) in C:\Users\xxx.cs:25
   xxxx() in C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxxDal.cs:36
   xxxx() in C:\Users\xxxx\Documents\Visual Studio 2010\Projects\xxxx.cs:13
   xxxx(Object sender, EventArgs e) in C:\Users\xxxxaspx.cs:145
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1


Solution:
Add the entity connection string to the web.config file in the appropriate project.