Exception loading CustomMeta from Tridion Broker Service (2009 SP1)

Posted by Rob Stevenson-Leggett on Stack Overflow See other posts from Stack Overflow or by Rob Stevenson-Leggett
Published on 2012-04-12T11:25:09Z Indexed on 2012/04/12 11:29 UTC
Read the original article Hit count: 383

Filed under:

I am trying to load some Custom Meta from a component which is published into the Tridion Broker.

This is 2009 SP1

I can see the component in the Custom_Meta table with a query like:

SELECT * FROM [Tridion_Broker].[dbo].[CUSTOM_META] WHERE ITEM_ID = 204221

However using the below code, I get a Java Runtime exception.

    string queryStringId = HttpUtility.UrlDecode(Request.QueryString["component_uri"]);

    string pageId = ((BasePage) Page).PageTcmId;
    int publicationId = int.Parse(pageId.Split(':')[1].Split('-')[0]);
    using (var cmf = new ComponentMetaFactory(publicationId))
    {
        IComponentMeta cm = cmf.GetMeta(queryStringId);
        if(cm != null)
        {
            VideoId = cm.CustomMeta.GetValue("video_url").ToString();
        }
        else
        {
            litMessage.Visible = true;
        }
    }

Stack trace:

[RuntimeException]
   Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +351
   Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1278
   Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +551
   Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, Type declaredType, Boolean bLeaf, JavaMethodArguments jargs) +50
   Com.Tridion.Meta.ComponentMetaFactory.GetMeta(Int32 componentId) +118
   Tridion.ContentDelivery.Meta.ComponentMetaFactory.GetMeta(Int32 componentId) +16
   ASP._controls_video_ascx.Page_Load(Object sender, EventArgs args) in c:\Inetpub\wwwroot\borland\us\_controls\Video.ascx:18
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

© Stack Overflow or respective owner

Related posts about tridion