Developer forum

Forum » Development » Index build exc: Object reference not set to an instance of an object

Index build exc: Object reference not set to an instance of an object

Dmitrij Jazel
Reply

Hi guys,

Trying to build index, but am getting Object reference not set to an instance of an object exception

The only thing that talks to API is Price provider, and maybe it's just me, but I noticed that Price provider is beying invoked when Index is trying to build!?

Used implementation from here:

http://developer.dynamicweb.com/documentation/for-developers/ecommerce/extensibility/providers/price-providers.aspx

ISupportPriceInfo example

 

Full stack trace:

[501] An error occured while updating an index.

Index: Products
Date: 4/30/2015 3:20:57 PM
Solution: 
Error message: Object reference not set to an instance of an object.
Call stack: at Dynamicweb.eCommerce.Common.Context.get_Country()
at Dynamicweb.eCommerce.Prices.PriceCalculated.FindVATCountry()
at Dynamicweb.eCommerce.Prices.PriceCalculated.GetCountryVAT()
at Dynamicweb.eCommerce.Prices.PriceCalculated.CalcPrice()
at Dynamicweb.eCommerce.Prices.PriceCalculated..ctor(Product Product, PriceRaw PriceRaw, Boolean IsInformative)
at Dynamicweb.eCommerce.Prices.PriceCalculated..ctor(Product Product, PriceRaw PriceRaw)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry.Initialize(Product p)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry..ctor(Product p)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry.Create(IDataReader reader)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexer.Index(IndexerDataRequest request)
at Dynamicweb.Searching.Indexer.PerformIndexModifications(IEnumerable`1 fromEntries, IndexUpdateParameters parameters)
at Dynamicweb.Searching.Indexer.PerformUpdate(IEnumerable`1 data, IndexerQueueContentType expectedContentType, IndexUpdateParameters parameters)
at Dynamicweb.Searching.IndexManager.UpdateIndexInternal(Indexer i, Boolean isFullUpdate, Boolean updateSpell, IDictionary`2 flags)

 


Replies

 
Dmitrij Jazel
Reply

I do remove custom dlls, and it still does not build, neither automatic, or when pressed manually.

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

Seems like you do not have a session OR no countries created in the MC

Nicolai

 
Dmitrij Jazel
Reply

Hmmm that is strange, languages are there.

Today I had an issue, this site was not able to find a correct shop (language shop) when importing activity was importing XML.

Is there atleast some clue I could look for in Database?

Newest application 8.6.1.5

 

Dmitrij

 
Nicolai Høeg Pedersen
Reply

Still, check the countries. It cannot look up the VAT group for the country context - make sure you have valid default languages and country

 
Dmitrij Jazel
Reply

Any particular setting/database table?

I can see that in MC, I have Counties, and I have 2 languages in the site.

While in Norwegian Mode - I have Both sweedish and Norwegian

While in Sweedish Mode - I have Sweedish and Norwegian is grayed out. (maybe that has something to do with this whole multilanguage issue).

 

Question#2) why would Indexing ever Lookup VAT group for the country context? Price calculation, somehow related with Indexing?

 

Dmitrij

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Well, your data seems to be corrupt. Imported data?

The old index loads the product and calculate the price based on the setting if prices in DB has vat or not. It can also be because you have a VAT provider configured on a VAT group that the product is member of.

So if one of your products has a vat group, that could be it, if no country vat is found for that group - or if the vat group has a provider, or you have bad data in that table containing vat (EcomVatGroups table)

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Well, since we are using Live price provider, and as DW manual says (as far as I can see), if I implement : ISupportPriceInfo Than it should rely purely on that provider, when it comes tax calculation etc... Or that is incorrectly understood.

data in XML looks ok, I can give an example snippet of that XML.

I just checked the "Sweedish" view of the settings in MC for languages, and saw that in VAT settings, there was not VAT group, active,

http://screencast.com/t/QrwPIANR and http://screencast.com/t/fykMRUNmVz

Cause default language is Norwegian.

 
Dmitrij Jazel
Reply

Looks prommising so far, Atleast index builds perfectly.

No issues so far, let's wait and see how webshop will import data, will come back a bit later on this one.

 
Dmitrij Jazel
Reply

Ok, after some Good index builds, not sure how, now it throws an error again :/ 

[501] An error occured while updating an index.

Index: Products
Date: 4/30/2015 5:02:52 PM
Solution: 
Error message: Object reference not set to an instance of an object.
Call stack: at Dynamicweb.eCommerce.Common.Context.get_Country()
at Dynamicweb.eCommerce.Prices.PriceCalculated.FindVATCountry()
at Dynamicweb.eCommerce.Prices.PriceCalculated.GetCountryVAT()
at Dynamicweb.eCommerce.Prices.PriceCalculated.CalcPrice()
at Dynamicweb.eCommerce.Prices.PriceCalculated..ctor(Product Product, PriceRaw PriceRaw, Boolean IsInformative)
at Dynamicweb.eCommerce.Prices.PriceCalculated..ctor(Product Product, PriceRaw PriceRaw)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry.Initialize(Product p)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry..ctor(Product p)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexEntry.Create(IDataReader reader)
at Dynamicweb.eCommerce.Searching.Index.ProductIndexer.Index(IndexerDataRequest request)
at Dynamicweb.Searching.Indexer.PerformIndexModifications(IEnumerable`1 fromEntries, IndexUpdateParameters parameters)
at Dynamicweb.Searching.Indexer.PerformUpdate(IEnumerable`1 data, IndexerQueueContentType expectedContentType, IndexUpdateParameters parameters)
at Dynamicweb.Searching.IndexManager.UpdateIndexInternal(Indexer i, Boolean isFullUpdate, Boolean updateSpell, IDictionary`2 flags)
 
Dmitrij Jazel
Reply

And now integration module does not want to import the activity, this was happening before, but ocasionally. Not sure what causes this.

http://screencast.com/t/XS8V3AnQn

 
Dmitrij Jazel
Reply

This is the data from VatGroups table:

http://screencast.com/t/58rpG7nv

There are just 2 languages, VAT is calculated in NAV, and price provider just has to get a price - and present it.

 
Dmitrij Jazel
Reply

Other Groups and Products both have VATGroupID set to null.

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

Good data=no errors. Bad data = Error. Your relations seems to be fu***ed up.

 
Dmitrij Jazel
Reply

Hi Nicolai,

Well, couple things I noticed, Index has to do something with VAT groups, and it looks like that part was not OK.

Cannot say for sure, but my data might aswell have been fu**ed up :-)

Shop2 and Shop1 had some troubles in identifying each other one way or another.

Eventual resetup on fresh DW 8.6.1.5 instance and re-setting up of customcode/items/templates did the trick.

Same data eventually was successfully imported.

 

/Dmitrij

 

You must be logged in to post in the forum