Tridion: Unable to load .Net dll while publishing
Asked Answered
C

3

9

I am using a .Net dll Newtonsoft.Json in my C# TBB to process components and generate Json data. I have already added this dll in GAC[Global Assembly Cache], and it works as well. But sometimes it doesn't work and I get the following error while publishing:

JScriptException: Expression 'RenderComponentPresentation()' had error 'Could not load file or assembly 'Newtonsoft.Json, Version=4.0.5.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.'

But when I preview the page in Tridion it works fine. To fix this issue we restart the Tridion Services, and after restart we publish the page it woks fine. But this problem keep on reappearing again and again. Is there any way to solve this issue permanently?

Recently I could reproduce issue when I published the same page again when it was already under the process of getting published. The second publish attempt returned the above error, but the first publish attempt finished after the failure of second publish attempt and it returned Success. Any idea why this weird behavior.

Callous answered 28/3, 2012 at 11:53 Comment(6)
This sounds like it could be a threading issue as preview is single threaded, and publishing/rendering is multithreaded. How many render threads do you have? Can you try changing it to one and retest to see if tee issue still occurs. This won't solve the problem, but. Ay prove the cause.Africanize
you may want to consider committing to the Tridion SE site - A lot of these question would be appropriate there: area51.stackexchange.com/proposals/38335/…Africanize
Hey @Sunil. I just noticed that this question is still open. Did any of the answers below help you solve the problem? If so, can you accept that answer by clicking the large check mark to the left of it?Gaultiero
Hi @FrankvanPuffelen. Unfortunately below answers didn't help in solving the problem.Callous
It indeed sounds most likely that you're having what Bart describes: the DLL is present on some, but not all, publisher machines. So depending on which publisher picks up your transaction, it may succeed or fail. Since the preview runs in the GUI (which is most likely not scaled out), the rendering will always succeed (or always fail) there.Gaultiero
Hi @FrankvanPuffelen. We have only one Publisher Server(i.e. TCM) and we have added Newtonsoft.Json DLL in the GAC. We have configured publisher server to push content on 2 different targets(Publication Targets). We have the similar configuration on our staging server but we are NOT able to reproduce it. Its only reproducible on live Publisher Server(TCM).Callous
E
6

Sometimes your platform is not set properly. Check this by right-clicking the project and setting the framework to 4.0 (or whatever is compatible) to use the dll. Then, close the application and try running it again. Your platform might be set to .NET Framework 4 client Profile.

Entertainer answered 28/3, 2012 at 12:23 Comment(0)
M
6

If it weren't for the fact that it works better after restarting the service, I'd have thought this was about an assembly that NewtonSoft.Json depends on. If there are any such assemblies, then they too will need to be registered in the GAC. Note that the publisher process does not necessarily have the same application folder or probing path as the Tridion kernel (which performs previews).

As Chris says, maybe this is a threading issue, but sometimes this kind of weirdness shows up under memory pressure. Can you monitor the memory use of your publisher process to see if there's a leak?

Matheson answered 28/3, 2012 at 17:55 Comment(1)
having similar thoughts here, the only thing that jumps to mind is if the environment is possibly scaled out with multiple publishers. In that case each one of the CM/Publisher servers will need the depending assembly in the GAC and have its services restarted afterwards, else something wierd is going on.Montenegro
S
3

The fusion log files could provide you with more details on why it fails. Did you use this tool already?

Fuslogvw.exe (Assembly Binding Log Viewer)

Other than that I recommend getting the latest JSON.NET versions for .NET 4.0 and ensure that you deployed the right versions to all publish servers.

Stagnate answered 16/7, 2012 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.