WorldPay Plugin An error occurred when trying to create a controller of type...

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hey folks,

We use the WorldPay plugin in our implementation of NOP.  Now and again we get told an error has appeared on our One Page Checkout - which we have modified slightly.  As we only have 1 payment provider we thought it not necessary to have the step where a user choose a payment method.  So we modified the controller slightly that when the shipping address was saved, it would programmatically choose the payment method and return the object from that method.  99% of the time it works as expected.  But that's 3-4 occassions now something crashes something goes wrong and MVC cannot create the controller for WorldPay plugin as it does not have a parameterless constructor.

However when we refresh the plugin list via Admin, it all works fine.

So question.  Should the WorldPay plugin have a DependencyRegister added to it so that should something be forgotten/not cached/the world ends, when MVC goes to create the controller it will know about the correct constructor?

This is the error we are getting:
  System.InvalidOperationException: An error occurred when trying to create a controller of type 'Nop.Plugin.Payments.WorldPay.Controllers.PaymentWorldPayController'. Make sure that the controller has a parameterless public constructor. ---> System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
   --- End of inner exception stack trace ---
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<BeginProcessRequest>b__2()
   at System.Web.Mvc.SecurityUtil.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a()
   at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust[TResult](Func`1 func)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.<>c__DisplayClass7.<BeginProcessRequest>b__6()
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
   at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerAsyncWrapper.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
   at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
   at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter)
   at System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues)
   at ASP._Page_Views_Checkout_OpcPaymentInfo_cshtml.Execute() in [PATH REMOVED]\site\Views\Checkout\OpcPaymentInfo.cshtml:line 9
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at Nop.Web.Framework.Controllers.ContollerExtensions.RenderPartialViewToString(Controller controller, String viewName, Object model)
   at Nop.Web.Controllers.CheckoutController.OpcSaveShippingMethod()
11 years ago
I'm getting a similar error on the worldpay plugin, did you get this resolved?

S
10 years ago
Yes, it turns out there was a DLL in the /bin directory that shouldn't have been there.

At some point Nop.Plugin.Payments.WorldPay.dll got added to the /bin directory, when it should have only been in the plugin directory at /Plugins/Payments.WorldPay

It was a really intermittent problem and took ages to track down, but this seemed to resolve it.

Good luck! :-)
10 years ago
thanks for the feedback...my issue is not intermittent but i checked for rogue DLL's and i was ok...still to solve my issue though.

Frustrating...do we know who produced the plugin?

S
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.