Search code examples
biztalkbiztalk-rule-engine

BizTalk BRE InvalidCastException


I have configured a new VM (MS Virtual Server running Windows Server 2003) as a copy of an existing VM hosting BizTalk server 2006. I have run into a problem with BRE processing. The policy is deployed and vocabulary published exactly as on the working VM.

An orchestration calls a helper component which in turn makes use of the BRE components. The last line in the helper component that seems to execute is:

Policy workflowPolicy = new Policy(policyName)

I have pasted the stack trace from the event log below:

Exception type: InvalidCastException
Source: Microsoft.RuleEngine
Target Site: Int32 GetInt32(System.String, Int32)
The following is a stack trace that identifies the location where the exception occured
   at Microsoft.RuleEngine.Configuration.GetInt32(String key, Int32 defaultValue)
   at Microsoft.RuleEngine.ReteTranslator.RuleSetToReteTranslatorImpl.Translate(RuleSet ruleset, Int32 duration)
   at Microsoft.RuleEngine.ReteTranslator.RuleSetToReteTranslator.Translate(RuleSet ruleset, Int32 duration)
   at Microsoft.RuleEngine.RuleEngine..ctor(RuleSet ruleSet, Boolean doOptimizations)
   at Microsoft.RuleEngine.RuleEngineCache.Allocate(String rulesetName, Int32 majorRevision, Int32 minorRevision, TrackingConfiguration& trackingConfig)
   at Microsoft.RuleEngine.RuleEngineCache.Allocate(String rulesetName, TrackingConfiguration& trackingConfig)
   at Microsoft.RuleEngine.Policy..ctor(String policyName)
   at Tesco.BRE.Services.PolicyServices.Direct.OrderWorkflowServices.Commands.GetNextTaskList.Execute()
   at Tesco.DataSources.Integration.Common.CommandBase.CommandDecorators.CommandLoggingDecorator`1.Execute()
   at Tesco.DataSources.Integration.Common.CommandBase.CommandUtilities.GetCommandResponse[T](CommandBase`1 command)
   at Tesco.BRE.Services.PolicyServices.Direct.OrderWorkflowServices.OrderWorkflowOperations.GetNextTaskList(String currentTaskName, String currentTaskStatus, XmlDocument order)
   at Tesco.Direct.OrderManagement.Orchestrations.FollowTaskResult.segment2(StopConditions stopOn)
   at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception&

It looks like Microsoft.RuleEngine.Configuration.GetInt32 is being passed a value that cannot be cast to an Int32?

I have tried un-configuring / re-configuring the BRE. As far as I can tell everything on the new server is configured exactly as per the working server.

Any help, gratefully receive - I've been stuck with this all day!


Solution

  • Thanks for your response Martin. I have now fixed the issue. The problem was user error (mine) in making a registry change. I had to create a reg setting as follows

    HKLM\SOFTWARE\Microsoft\BusinessRules\3.0\StaticSupport (DWORD), value 2
    

    in order to enable the BRE to make use of static methods. This is described at: http://technet.microsoft.com/en-us/library/dd298814.aspx

    Although I had made the addition when configuring the server, I had inadvertently used a string rather than a dword. Since this cost me over a day to figure out - I won't be making the same mistake any time soon!