Jobs Module Resources error

Posted by Community Admin on 05-Aug-2018 15:01

Jobs Module Resources error

All Replies

Posted by Community Admin on 24-Jan-2011 00:00

Hi,

I've just followed the Jobs Module example word for word. I have managed to register the module, however when I try to go to it I get the error message:

Could not find the specified key "FirstName" or class id "JobsResources".


[ArgumentException: Could not find the specified key "FirstName" or class id "JobsResources".]
   Telerik.Sitefinity.Localization.Resource.GetString(ResourceDataProvider provider, String classId, String key, CultureInfo culture, Boolean falback, Boolean throws) +455
   Telerik.Sitefinity.Localization.Res.Get(String classId, String key, CultureInfo culture, Boolean fallback, Boolean throws) +168
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +92


[TemplateException: A resource file with the specified class ID "JobsResources" was not found. This class ID declaration appears in Jobs.Resources.Views.JobApplicationsOverviewTemplate.ascx.]
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +229
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor, Control bindingContainer) +53
   Telerik.Sitefinity.Web.UI.Templates.Attribute.SetAttribute(Object component, Control bindingContainer, Boolean bound) +167
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +203
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.CollectionBuilder.SetCollection(IList list, Control bindingContainer) +151
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +727
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +759
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +687
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer, PlaceHoldersCollection placeHolders) +18
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.RootBuilder.CreateChildControls(Control parent, Control bindingContainer) +269
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders) +88
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container) +6
   Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template) +35
   Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +33
   Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +46
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

I have set both templates to be embedded resources so I can't really see anything else that could be producing the error.

Any ideas? Did anyone else get this error?

Thanks in advance
higgsy
[ArgumentException: Could not find the specified key "FirstName" or class id "JobsResources".]
   Telerik.Sitefinity.Localization.Resource.GetString(ResourceDataProvider provider, String classId, String key, CultureInfo culture, Boolean falback, Boolean throws) +455
   Telerik.Sitefinity.Localization.Res.Get(String classId, String key, CultureInfo culture, Boolean fallback, Boolean throws) +168
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +92

[TemplateException: A resource file with the specified class ID "JobsResources" was not found. This class ID declaration appears in Jobs.Resources.Views.JobApplicationsOverviewTemplate.ascx.]
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +229
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor, Control bindingContainer) +53
   Telerik.Sitefinity.Web.UI.Templates.Attribute.SetAttribute(Object component, Control bindingContainer, Boolean bound) +167
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +203
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.CollectionBuilder.SetCollection(IList list, Control bindingContainer) +151
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +727
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +759
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +687
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer, PlaceHoldersCollection placeHolders) +18
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.RootBuilder.CreateChildControls(Control parent, Control bindingContainer) +269
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders) +88
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container) +6
   Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template) +35
   Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +33
   Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +46
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
[ArgumentException: Could not find the specified key "FirstName" or class id "JobsResources".]
   Telerik.Sitefinity.Localization.Resource.GetString(ResourceDataProvider provider, String classId, String key, CultureInfo culture, Boolean falback, Boolean throws) +455
   Telerik.Sitefinity.Localization.Res.Get(String classId, String key, CultureInfo culture, Boolean fallback, Boolean throws) +168
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +92

[TemplateException: A resource file with the specified class ID "JobsResources" was not found. This class ID declaration appears in Jobs.Resources.Views.JobApplicationsOverviewTemplate.ascx.]
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Control bindingContainer) +229
   Telerik.Sitefinity.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor, Control bindingContainer) +53
   Telerik.Sitefinity.Web.UI.Templates.Attribute.SetAttribute(Object component, Control bindingContainer, Boolean bound) +167
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +203
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.CollectionBuilder.SetCollection(IList list, Control bindingContainer) +151
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +727
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.PropertyBuilder.SetProperty(Object component, Control bindingContainer) +759
   Telerik.Sitefinity.Web.UI.Templates.PropertiesBuilder.SetProperties(Object component, Control bindingContainer) +183
   Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.CreateObject(Control bindingContainer, PlaceHoldersCollection placeHolders) +687
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer, PlaceHoldersCollection placeHolders) +18
   Telerik.Sitefinity.Web.UI.Templates.ControlBuilder.CreateControl(Control bindingContainer) +12
   Telerik.Sitefinity.Web.UI.Templates.RootBuilder.CreateChildControls(Control parent, Control bindingContainer) +269
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container, PlaceHoldersCollection placeHolders) +88
   Telerik.Sitefinity.Web.UI.StringTemplate.InstantiateIn(Control container) +6
   Telerik.Sitefinity.Web.UI.SimpleView.CreateContainer(ITemplate template) +35
   Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +33
   Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +46
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

Posted by Community Admin on 25-Jan-2011 00:00

Hi higgsy,

Please, check if the JobsResources class contains public string property named "FirstName".

Kind regards,
Pavel
the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 25-Jan-2011 00:00

Hi Pavel, Thanks for your response. Yes it does, my code is a copy and paste from the jobs module PDF included in the sdk. I have literally built it, included it in my main sitefinity web app, and received the error. The error message is indicating it cannot find the JobsResources class. Thanks Higgsy

Posted by Community Admin on 28-Jan-2011 00:00

Hello Higgsy,

Did you manage to solve the problem?

Kind regards,
Pavel
the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 28-Jan-2011 00:00

Hi Pavel,

No I havent. The problem appears to be that the JobsResources class cannot be found - and I have no idea why, its part of the same namespace afterall.

Any ideas?

Thanks
higgsy

Posted by Community Admin on 03-Feb-2011 00:00

Hello Higgsy,

Do you have the registration code of the resource class in the Initialize method of the module?
Something like:

Res.RegisterResource<ProductsResources>()


Kind regards,
Pavel
the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 16-Mar-2011 00:00

Picking up where Higgsy left off since he has the same exact problem that I encountered, yes I have Res.RegisterResource<JobsResources>(); in the Initialize method of JobsModule.cs.

What now?

Posted by Community Admin on 22-Mar-2011 00:00

Hello Suzanne,

Can you please check the SDK which comes with SP1 - we have the exact sample which should be working fine.

Greetings,
Pavel
the Telerik team

Posted by Community Admin on 12-Apr-2011 00:00

Picking up where Suzanne left off

I compiled from default example and got this problem

Posted by Community Admin on 18-Apr-2011 00:00

Hello Suzanne,

The Jobs sample works fine at my end. The error you are getting is thrown, because the application cannot find the resource declared inside

Jobs Intermediate\Resources\Views\JobApplicationsOverview.ascx

<telerik:GridBoundColumn DataField="FirstName" HeaderText="<%$ Resources:JobsResources, FirstName %>" />

The resource is registered when the module is initialized

public override void Initialize(ModuleSettings settings)
       
            base.Initialize(settings);
            Config.RegisterSection<JobsConfig>();
            Res.RegisterResource<JobsResources>();
       

Can you remove the Jobs module ( or use a new project) and put a breakpoint inside Initialize method to see whether the resource gets registered?

It looks like there was an issue when you had tried to install the module. I do not see other explanation for the behavior you see.

Kind regards,
Ivan Dimitrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Posted by Community Admin on 26-Apr-2011 00:00

I am having the same problem as they all do 
I think there must be some step missing int the documentation ... I still can not find the solution 

so any help

Posted by Community Admin on 29-Apr-2011 00:00

Hello Suzanne,

I checked the SDK samples today ( 4.1) release and I wasn't able to replicate issues. Can you give a try using the new SDK and a new project? Please make sure that you have not modified any of module files.

Kind regards,
Ivan Dimitrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Posted by Community Admin on 03-May-2011 00:00

Hi,

I have the same problem, please take a look at my findings see if it helps and if you can pick up ...
I'm working with SDK 4.1 and the Jobs sample and it worked fine at first: I setup a solution with both Jobs project (as in the sample) and the website (with a simple homepage).
I added a reference to the project in my Sitefinity bin folder and registered the module - and at first it worked.

I made a small markup change  and rebuilt the jobs project and I broke the module functionality.
I think it has to do with the fact that at every build, the version of my Jobs assembly changes.

1. Is there a way to keep in the same solution the website and the module project? I'm new to developing modules and I'm not aware of another way to test my modules.

2. If I only add the Jobs.dll to the bin folder (as suggested in the documentation) and develop my module in another solution do i have to unregister the module every time I need to make a change?

Any help will be greatly appreciated.

Thank you,
Ancuta

Posted by Community Admin on 06-May-2011 00:00

Hi There,

I have the same behaviour as Ancute Me. The first build was fine, but as soon as I update my code and rebuild my project, I get the same error. 

Regards,
Jean Erasmus

Posted by Community Admin on 06-May-2011 00:00

Hi Jean,

I did something that I'm not particularly proud of to make it work: I erased all references to the resources, I added plain text.
But I'm still trying to figure out a way to keep the original, I'll keep you updated if I manage to fix it.

Ancuta

Posted by Community Admin on 12-May-2011 00:00

Hi all,

I am experiencing the same issues as Ancuta Me. It seems like on the application restart my resource is not getting registered properly after rebuilding the custom module. Before I did the rebuild, I set a breakpoint in the intialize method of my custom module to make sure my resource was registered. Everything worked fine. Then I added a space to the markup and rebuilt the custom module. I deployed my custom module .dll to the bin directory of the web app. I added a space to the web.config and saved the file to force a restart of the web app. Then an error message gets thrown. Like I said earlier, I called 

Res

 

 

.RegisterResource<CustomModule>(), in the initialize method as stated in this thread.

So, my question is how do resources get loaded on a web app restart. Because, I have a breakpoint set in a static constructor for my custom module and that break point never gets hit. The exception is thrown before it hits my breakpoint. Any help is appreciated.

Thanks,
Bobby

 

Posted by Community Admin on 13-May-2011 00:00

Hi all,

I have managed to clear up my issues but I have not pinpointed the root cause of my original problem. The only difference that I noticed between my old module and the Jobs Module was the following two items. The first item is the following method:

private

 

 

void InstallCustomVirtualPaths(SiteInitializer initialzer)

 

 


var

 

 

virtualPathConfig = initialzer.Context.GetConfig<VirtualPathSettingsConfig>();

 

 

 

 

var questionTemplatesModuleVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)

 

 

 

VirtualPath = Jobs

 

Module.VirtualPath + "*",

 

 

ResolverName =

 

"EmbeddedResourceResolver",

 

 

ResourceLocation =

 

"Jobs"

 

;

 

 

if (!virtualPathConfig.VirtualPaths.ContainsKey(QuestionTemplatesModule.VirtualPath + "*"))

 

 

virtualPathConfig.VirtualPaths.Add(questionTemplatesModuleVirtualPathConfig);



The method was called as followed:

public

 

 

override void Install(SiteInitializer initializer)

 

 

 

 

 

base.Install(initializer);

 

 

 

 

this.InstallCustomVirtualPaths(initializer);

 

 


In addition, the following documentation seems to state that your custom resource file should be located in a directory name Localization. Sitefinity staff, is this required? Does the resource file have to be in a directory called Localization?

http://www.sitefinity.com/40/help/developers-guide/how-to-how-to-create-a-custom-content-based-module-localization.html

So what I did was created a new custom module and carefully followed the Jobs Module sample and included the above items. This seemed to work and resolve my issues. I have been trying to reproduce the original problem but I have not be able to so far. Unfortunately, I erased my project with the problems. I will spend some time trying to reproduce the issue but just in case I can't, if you carefully follow the Jobs Module example, you should be fine. Hope this helps someone or helps pinpoint the orginal issue from this thread.

Posted by Community Admin on 15-May-2011 00:00

Hi all,

I am able to reproduce the behavior from this thread. In my case, I was creating a custom module using the jobs module to guide my development. In the InstallPages method of my module, I was adding my custom pages for my module. Since, I did not see an exception being thrown and module appeared in the administration section under application modules and also had it's own config section displayed in the advanced admin section, I assumed my module was installed properly. However, when i went to the content menu item to look for my custom module under that menu, it did not appear. So, I would force a web application restart by modifying the web.config, and then the resources exception appeared. This exception would not go away unless I erased my whole sitefinity project and started over or I went to my database to the sf_page_node table and erased the reference, to my custom module, from the database. Actually there were several tables I had to removed references from which are the following

sf_page_node,

sf_page_node_attrbutes,

 

 

sf_pg_nd_spprtd_prmission_sets,

 

 

sf_page_node_sf_permissions

The tables may differ in your specific case. But if you start by trying to erase your reference from the sf_page_node, then your database will tell you the tables you need to have references removed from before it finally lets you remove the record.

In any case, I did not realize an exception was being thrown and I finally happened to get wind of it when I was debugging the app. The exception did not get displayed in the browser, I just realized it when I was stepping through the code. Any time an exception is thrown while Sitefinty is constructing the menu items for your custom module, this error will occur. I guess some required code does not get executed and it leaves the application in an unstable state. When I correct the error, the top menu of my custom module got displayed but when I click on the top menu, the same exception occurred again. Once again, I had an exception being thrown on the construction of my child page. When I corrected the error, everything worked fine. So, there are silent errors that are being thrown and caught somewhere in the application that prevent required code dealing with the custom Resource file of your custom module from being executed. I hope this helps.

Happy coding,
Bobby

Posted by Community Admin on 25-May-2011 00:00

Hi all,

I see no particular error in the code everyone has provided that may cause the described issue. What I think gets messed up in most of the cases are assembly references.

In Ancuta Me's description, you add a reference to the module's assembly by copying the DLL to the BIN folder. I would recommend that you include both projects in the same solution and add a project reference in the website (or web application) to the module's project. This ensures that whatever changes you make, the website and the module stay in sync. This is also what we have done in the SDK sample and it works fine there. Could you all try this and see if it resolves the issue?

@Bobby Williams, I would not recommend you manually delete stuff from the database to remove a module. This can have unforeseen side effects. It is true that we don't have any way to uninstall a module. Rather I think you should all work in a development environment (with a temporary database), until you resolve any issues with your custom modul,e and are sure that installation goes smoothly. Then you can install a module on a live DB.

As a rule, the system calls the module's Install() method whenever the version for this module in SystemConfig.config is blank. If you want to re-install, just edit that file and remove the version attribute for your module. This will not reverse database changes, though.

Greetings,
Slavo
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Posted by Community Admin on 01-Jun-2011 00:00

Hi,

I've had this same issue and I think that I have uncovered a way to fix it - which is to simply force Sitefinity to re-load and re-initialize the module. I had a module called Accomodation and every change I made to it, I would get this resources error. To fix it I stopped IIS, changed the config files to remove the version number of the module, rebuilt the project and restarted IIS. The files were:

- \ProjectFolder\App_Data\Sitefinity\Configuration\SystemConfig.config
change: 
<add title="AccomodationModule" description="" resourceClassId="" type="Accomodation.AccomodationModule" startupType="OnFirstCall" version="1.0.4169.21117" name="AccomodationModule" />


to:

<add title="AccomodationModule" description="" resourceClassId="" type="Accomodation.AccomodationModule" startupType="OnFirstCall" version="" name="AccomodationModule" />


Similarly in  \ProjectFolder\App_Data\Sitefinity\Configuration\AccomodationConfig.config
change:
<add version="1.0.4169.21117" name="OpenAccessDataProvider" />
to:
<add version="" name="OpenAccessDataProvider" />

I hope this works for you, it did for me!

Cheers, JP

This thread is closed