I have a .NET console application that runs on a Windows Server 2008 where AutoSys and WebSphere MQ are installed (The application is used to send messages to WebSphere MQ).

I'm trying to set up an AutoSys job that will call the console application every 10 minutes.

If I log into the server and I run the application using the command line, the application works correctly.

But if I run the application using AutoSys I get the following error:

The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.

StackTrace =    at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
   at SendMessage.QueueJobExecutionItem.ExecuteQueueJob(QueueInfo queueInfo, CrmInfo crmInfo, LogFileInfo logFileInfo, List`1 entityList) in C:\SendMessage\QueueJobExecutionItem.cs:line 36
   at SendMessage.Program.StartLoad() in C:\SendMessage\Program.cs:line 75
   at SendMessage.Program.Main(String[] args) in C:\SendMessage\Program.cs:line 111

Error Message InnerException = The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.

InnerException StackTrace =    at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
   at SendMessage.QueueJobExecutionItem.ExecuteQueueJob(QueueInfo queueInfo, CrmInfo crmInfo, LogFileInfo logFileInfo, List`1 entityList) in C:\SendMessage\QueueJobExecutionItem.cs:line 36
   at SendMessage.Program.StartLoad() in C:\SendMessage\Program.cs:line 75
   at SendMessage.Program.Main(String[] args) in C:\SendMessage\Program.cs:line 111

InnerException Source = amqmdnet

Error Message InnerException = Exception has been thrown by the target of an invocation.

InnerException StackTrace =    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.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at IBM.WMQ.CommonServices.CreateCommonServices()
   at IBM.WMQ.CommonServices.TraceConstructor(String objectId, String sccsid)
   at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
   at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
   at IBM.WMQ.MQQueueManager..cctor()

InnerException Source = mscorlib

Error Message InnerException = An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

InnerException StackTrace =    at IBM.WMQ.MQCommonServices.xcsInitialize(UInt16 scope, UInt16 attributes, Byte[] charName, Byte[] charPrefix, xcsHPOOL& hPool)
   at IBM.WMQ.MQCommonServices.Initialize()

InnerException Source = amqmdxcs

I'm using the same user when logging into the server and running AutoSys so I would have expected the application to run in the same way.

I'm wondering if anyone had this issue before or if there is any configuration/parameters,etc that I may be missing in AutoSys that would make the application to work in the same way as when logged into the server.

I hope this make sense

Thanks in advance

有帮助吗?

解决方案

The exception shows An attempt was made to load a program with an incorrect format. and is pointing to amqmdxcs.dll This could be either because your application is 64 bit but it is trying to load a 32 bit version of WMQ libraries or your application is 32 bit but is trying load a 64 bit version of WMQ libraries. You need check the bittage of AutoSys and set the path to load appropriate WMQ libraries.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top