I'm currently trying to implement a DD4T solution (running locally), and have had a lot of success with most aspects of the implementation. I have pages setup and working which pull through all types of content from Tridion, but am currently hitting a brick wall with regards to Dynamic Link Resolution. Every other aspect of my website works, that I've tried, but Dynamic Linking doesn't.
Having read around all sources I've been able to find online, I've determined that the only way to resolve the component TCMs I have access to into URLs is through the ResolveLink method within the TridionLinkProvider class (which in turn lives within my compiled DD4T.Providers.SDLTridion2013 dll. However, whenever and however I try to use this method I come up against the following Server Error:
Server Error in '/' Application.
com.tridion.linking.ComponentLink
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: Java.Lang.Exception: com.tridion.linking.ComponentLink
Source Error:
Line 58: if (!_componentLinks.ContainsKey(uri.PublicationId)) // we must test again, because in the mean time another thread might have added a record to the dictionary!
Line 59: {
Line 60: _componentLinks.Add(uri.PublicationId, new ComponentLink(uri.PublicationId));
Line 61: }
Line 62: }
Having investigated, the problem seems to be that the reference to the Tridion.ContentDelivery.Web.Linking dll within that class isn't working properly - all references to the ComponentLink type produce the following error, meaning that I am never able to create a ComponentLink to return:
ComponentLink = 'ComponentLink' threw an exception of type 'Java.Lang.Exception'
base {Java.Lang.Throwable} = {java.lang.ClassNotFoundException: com.tridion.linking.ComponentLink}
What makes it even more confusing is that if I go into the Dynamic Delivery Presentation solution (where I built my Providers DLL from), the reference is fine there! It sees and recognises the type ComponentLink without an issue. So it seems to be losing that information when built. I can also reference "Tridion.ContentDelivery.Web.Linking" successfully using the @using directive in my views, showing that the reference is in a "fit state" there if that's of any use.
Full stack trace follows:
[Exception: com.tridion.linking.ComponentLink]
Codemesh.JuggerNET.JavaClass.ThrowException(Exception ex) +96
Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +413
Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1373
Codemesh.JuggerNET.JavaClass.init() +373
Codemesh.JuggerNET.JavaClass.get_JObject() +33
Codemesh.JuggerNET.JavaMethod.init() +1115
Codemesh.JuggerNET.JavaMethod.get_MethodPtr() +54
Codemesh.JuggerNET.JavaMethod.get_Handle() +47
Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +389
Com.Tridion.Linking.ComponentLink..ctor(Int32 publicationId) +191
Tridion.ContentDelivery.Web.Linking.ComponentLink..ctor(Int32 publicationId) +58
DD4T.Providers.SDLTridion2013.TridionLinkProvider.GetComponentLink(TcmUri uri) in C:\Documents and Settings\jwalters\My Documents\DD4T-New\dotnet\DD4T.Providers.SDLTridion2013\TridionLinkProvider.cs:60
DD4T.Providers.SDLTridion2013.TridionLinkProvider.ResolveLink(String sourcePageUri, String componentUri, String excludeComponentTemplateUri) in C:\Documents and Settings\jwalters\My Documents\DD4T-New\dotnet\DD4T.Providers.SDLTridion2013\TridionLinkProvider.cs:82
DD4T.Providers.SDLTridion2013.TridionLinkProvider.ResolveLink(String componentUri) in C:\Documents and Settings\jwalters\My Documents\DD4T-New\dotnet\DD4T.Providers.SDLTridion2013\TridionLinkProvider.cs:70
DD4T.Factories.LinkFactory.ResolveLink(String componentUri) in C:\Documents and Settings\jwalters\My Documents\DD4T-New\dotnet\DD4T.Factories\LinkFactory.cs:90
ASP._Page_Views_Shared_header_cshtml.Execute() in c:\Documents and Settings\jwalters\My Documents\Visual Studio 2010\Projects\New-DD4T\New-DD4T\Your Website\Views\Shared\header.cshtml:52
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +279
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +113
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName) +31
ASP._Page_Views_Shared__MasterPage_cshtml.Execute() in c:\Documents and Settings\jwalters\My Documents\Visual Studio 2010\Projects\New-DD4T\New-DD4T\Your Website\Views\Shared\_MasterPage.cshtml:19
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
System.Web.WebPages.c__DisplayClass7.b__6(TextWriter writer) +102
System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +12
System.Web.WebPages.WebPageBase.Write(HelperResult result) +67
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +66
System.Web.WebPages.WebPageBase.PopContext() +262
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.c__DisplayClass1c.b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.c__DisplayClass1e.b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.c__DisplayClassb.b__5() +37
System.Web.Mvc.Async.c__DisplayClass1.b__0() +21
System.Web.Mvc.Async.c__DisplayClass8`1.b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.c__DisplayClasse.b__d() +50
System.Web.Mvc.SecurityUtil.b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8862381
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
I've been fighting with this issue for days and am at my wit's end. My lib and config folders seem correct, my licence is fine (else nothing else would work), the Tridion logging (through logback) does not show anything relevant even when set to Verbose. I've tried starting with a new DD4T website solution, re-compiling my Providers DLL, experimenting with references (re-adding them, moving the DLLs to live natively in the solution folders rather than within the DD4T "build" folder where I was previously referencing them), and nothing has changed the error at all.
If anyone could offer some pointers or advice, it would be very much appreciated. I really don't know how else to proceed with this.