0

我有一个在安装了 AutoSys 和 WebSphere MQ 的 Windows Server 2008 上运行的 .NET 控制台应用程序(该应用程序用于向 WebSphere MQ 发送消息)。

我正在尝试设置一个 AutoSys 作业,它将每 10 分钟调用一次控制台应用程序。

如果我登录到服务器并使用命令行运行应用程序,则应用程序可以正常工作。

但是,如果我使用 AutoSys 运行应用程序,则会收到以下错误:

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

我在登录服务器并运行 AutoSys 时使用的是同一用户,因此我希望应用程序以相同的方式运行。

我想知道以前是否有人遇到过这个问题,或者我在 AutoSys 中是否可能缺少任何配置/参数等,这会使应用程序以与登录服务器时相同的方式工作。

我希望这是有道理的

提前致谢

4

1 回答 1

1

异常显示An attempt was made to load a program with an incorrect format.并指向amqmdxcs.dll这可能是因为您的应用程序是 64 位但它正在尝试加载 32 位版本的 WMQ 库,或者您的应用程序是 32 位但正在尝试加载 64 位版本的 WMQ 库。您需要检查 AutoSys 的 bittage 并设置加载适当 WMQ 库的路径。

于 2013-04-16T08:26:12.270 回答