| Author | Message | 
		
		  | bath | 
			  
				|  Posted: Wed Jan 05, 2005 8:57 am    Post subject: Unable to load APPC communication program with the code erro |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| Hello All, please could someone help me?
 I write a small c++ service that must connect to a queue manager
 and put messages in the queue.
 But when i start my service i receive the message
 " Unable to load APPC communication program with the code error 126"
 any help will be greatly appreciated
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kman | 
			  
				|  Posted: Wed Jan 05, 2005 4:45 pm    Post subject: |   |  | 
		
		  | Partisan
 
 
 Joined: 21 Jan 2003Posts: 309
 Location: Kuala Lumpur, Malaysia
 
 | 
			  
				| APPC ? That sounded like SNA problem. What platform are these? Have you tested the SNA connection if the client can reach the server? |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 3:44 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| thanks, i'm on windows 2000 platform. My program executes in the server machine.
 when  I start my service , I can not connect to the Queue manager
 and the error I received in the Event Viewer is
 
 "The APPC communications program could not be loaded.
 
 The attempt to load the APPC library or procedure 'wcpic32' failed with error code 126.
 
 Either the library must be installed on the system or the environment changed to allow the program to locate it.
 "
 which library should I install?
 
 any help will be appreciated
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 5:33 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| how can i test the SNA connection? How do i know if my program use such connection?
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Thu Jan 06, 2005 5:34 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| Ask your network administrator. _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 5:52 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| thank you jefflowrey, I will like to take this opportunity to ask another question.
 i link my program with all these libraries:
 
 imqb23in.Lib
 imqb23vn.Lib
 imqs23vn.Lib
 imqc23in.Lib
 imqc23vn.Lib
 imqs23in.Lib
 mqic32.Lib
 mqiccb32.Lib
 mqiccbb.Lib
 mqm.Lib
 mqmax.Lib
 mqmcb32.Lib
 mqmcbb.Lib
 mqmcics.Lib
 mqmcics4.Lib
 mqmenc.Lib
 mqmsom.Lib
 mqmtux.Lib
 mqmvx.Lib
 mqmvxd.Lib
 mqmxa.Lib
 mqmzf.Lib
 mqutl.LIB
 
 I removed all the library and I just left
 imqb23vn.Lib
 imqs23vn.Lib
 
 I did not have an error in the Event viewer.
 but my service does not connect to the queue manager.
 may be it's anothe problem.
 
 PS: My application run in the same machine where the MQseries server is installed.
 
 question1:
 are  these two libraries
 imqb23vn.Lib
 imqs23vn.Lib
 sufficient?
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | clindsey | 
			  
				|  Posted: Thu Jan 06, 2005 6:28 am    Post subject: |   |  | 
		
		  | Knight
 
 
 Joined: 12 Jul 2002Posts: 586
 Location: Dallas, Tx
 
 | 
			  
				| 
   
	| Quote: |  
	| PS: My application run in the same machine where the MQseries server is installed.
 
 question1:
 are these two libraries
 imqb23vn.Lib
 imqs23vn.Lib
 sufficient?
 
 |  
 Yes.
 
 What error do you get now?
 
 Charlie
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 7:11 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| thank you, this is the code I use in my service.
 
 
 
 #pragma once
 using namespace System;
 using namespace System::Collections;
 using namespace System::ServiceProcess;
 using namespace System::ComponentModel;
 
 //add
 #include "stdafx.h"
 #using <mscorlib.dll>
 #include <tchar.h>
 #include <windows.h>
 #include <conio.h>
 #include "OSidHelper.h"
 using namespace System;
 using namespace System::IO;
 //#include <string.h>
 
 #ifndef MQ_zero
 #include <imqi.hpp>  //WebSphere MQ MQI
 #endif
 
 
 namespace MyService
 {
 /// <summary>
 /// Summary for MyServiceWinService
 /// </summary>
 ///
 /// WARNING: If you change the name of this class, you will need to change the
 ///          'Resource File Name' property for the managed resource compiler tool
 ///          associated with all .resx files this class depends on.  Otherwise,
 ///          the designers will not be able to interact properly with localized
 ///          resources associated with this form.
 public __gc class MyServiceWinService : public System::ServiceProcess::ServiceBase
 {
 public:
 StreamWriter *logfile;
 public:
 MyServiceWinService()
 {
 InitializeComponent();
 }
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 void Dispose(bool disposing)
 {
 if (disposing && components)
 {
 components->Dispose();
 }
 __super::Dispose(disposing);
 }
 
 protected:
 /// <summary>
 /// Set things in motion so your service can do its work.
 /// </summary>
 void OnStart(String* args[])
 {
 // TODO: Add code here to start your service.
 Threading::ThreadStart* threadStart = new Threading::ThreadStart(this,mainLoop);
 servicethread = new Threading::Thread(threadStart);
 servicethread->Start();
 }
 
 
 
 void mainLoop()
 {
 Diagnostics::EventLog* log;
 if(!Diagnostics::EventLog::SourceExists("Myservice"))
 Diagnostics::EventLog::CreateEventSource("Myservice","MySrviceLog");
 
 log = new Diagnostics::EventLog("MyserviceLog");
 //log->Source="MyService";
 
 
 logfile = new StreamWriter ("C:\\LogFile.log");
 
 CReg reg;             //helper class for registry operations
 loopsleep = 1000;            //milliseconds
 stopping = false;
 
 CString lusedatabase,lworkdir,larcdir,lwext;   //working variables used to store registry entries.
 CString m_msg,m_errorText,sformat, m_channel,m_mgr,m_queue;
 
 ImqQueueManager mgr;
 ImqQueue queue;
 ImqChannel channel;
 ImqMessage msg;
 ImqString strToken,strParse,imq_mgr,imq_queue;
 
 
 reg.GetRegKeyValue( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\MQservice\\MQParametres"), _T("manager"), m_mgr);
 reg.GetRegKeyValue( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\MQservice\\MQParametres"), _T("channel"), m_channel);
 reg.GetRegKeyValue( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\MQservice\\MQParametres"), _T("queue"), m_queue);
 
 logmessage(m_mgr);
 logmessage(m_channel);
 logmessage(m_queue);
 
 LPTSTR my_channel= new TCHAR[m_channel.GetLength()+1];
 _tcscpy(my_channel,m_channel);
 
 
 LPTSTR my_mgr =new TCHAR[m_mgr.GetLength()+1];
 _tcscpy(my_mgr,m_mgr);
 imq_mgr = ImqString((const char*)my_mgr);
 
 LPTSTR my_queue =new TCHAR[m_queue.GetLength() +1];
 _tcscpy(my_queue,m_queue);
 imq_queue =ImqString((const char*)my_queue);
 
 strParse = ImqString((const char*)my_channel);
 
 
 mgr.setName(imq_mgr);
 queue.setName(imq_queue);
 
 
 logmessage(CString(imq_mgr));
 logmessage(CString(imq_queue));
 
 
 
 channel.setHeartBeatInterval(1);
 
 //Set the channel name
 if (strParse.cutOut(strToken,'/'))
 channel.setChannelName(strToken);
 logmessage(CString(strToken));
 
 
 //set the transport type
 if ( strParse.cutOut( strToken,'/'))
 {
 logmessage(CString(strToken));
 if ( strToken.upperCase( ) == (ImqString)"LU62")
 channel.setTransportType( MQXPT_LU62 );
 if ( strToken.upperCase( ) == (ImqString)"NETBIOS")
 channel.setTransportType( MQXPT_NETBIOS );
 if ( strToken.upperCase( ) == (ImqString)"SPX")
 channel.setTransportType( MQXPT_SPX );
 if ( strToken.upperCase( ) == (ImqString)"TCP")
 channel.setTransportType( MQXPT_TCP );
 }
 // Establish the connection name.
 if ( strParse.cutOut(strToken))
 channel.setConnectionName( strToken );
 logmessage(CString(strToken));
 
 //Link the channel to the queue manager
 mgr.setChannelReference(channel );
 
 //establish the connection
 if(mgr.connect())
 {
 
 logmessage("connect succeed");
 
 queue.setConnectionReference( mgr );
 queue.setOpenOptions( MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING );
 
 queue.open();
 if (queue.completionCode()== MQCC_FAILED)
 {
 logmessage("unable to open queue for output" );
 }
 }else
 {
 m_errorText = "connection failed with reason code" ;
 logmessage("connection failed with reason code");
 logmessage(CString((TCHAR)mgr.reasonCode()));   !!can not log the error code ????
 }
 
 
 
 
 while (!stopping)
 {
 DirectoryInfoDemo2(lworkdir,larcdir,lwext);
 Threading::Thread::Sleep(loopsleep);
 }
 }
 
 
 void StreamWriterDemo()
 {
 //Console::WriteLine("Creating C:\\TempFile.txt");
 StreamWriter *sw = new StreamWriter ("C:\\TempFile.txt");
 
 sw->WriteLine("This is the second line");
 sw->WriteLine("This is the second line");
 sw->WriteLine("This is the third/last line");
 sw->Close();
 }
 
 
 
 
 void logmessage(CString s)
 {
 
 logfile->WriteLine(s);
 
 }
 
 
 
 /// <summary>
 /// Stop this service.
 /// </summary>
 void OnStop()
 {
 // TODO: Add code here to perform any tear-down necessary to stop your service.
 logfile->Close();
 }
 
 private:
 /// <summary>
 /// Required designer variable.
 /// </summary>
 System::ComponentModel::Container *components;
 //add
 bool stopping;
 int loopsleep;              //milliseconds
 Threading::Thread* servicethread;
 //add
 
 
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 void InitializeComponent(void)
 {
 this->components = new System::ComponentModel::Container();
 this->CanStop = true;
 this->CanPauseAndContinue = true;
 this->AutoLog = true;
 this->ServiceName = S"MyServiceWinService";
 }
 };
 }
 
 i don't know how i can  log the error code.
 
 
 when executing this in a visaul application i can connect to my queue manager
 
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Thu Jan 06, 2005 7:16 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| 
   
	| bath wrote: |  
	| when executing this in a visaul application i can connect to my queue manager
 |  
 Then you probably have a security problem with the service user.
 _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 7:36 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| thank, is anyway to solve this security issue?
 
 in the properties of my service process install
 the account is LocalSystem and modifiers is public?
 
 any idea will be greatly appreciated
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Thu Jan 06, 2005 7:55 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| Yes, the way to resolve the security issue is to authorize the service user to MQSeries. 
 I would recommend not running your service as LocalSystem.
 _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kevinf2349 | 
			  
				|  Posted: Thu Jan 06, 2005 9:43 am    Post subject: |   |  | 
		
		  |  Grand Master
 
 
 Joined: 28 Feb 2003Posts: 1311
 Location: USA
 
 | 
			  
				| Jeff 
 I am having some issues with a VB.Net service that I am writting and I would like you to expand on:
 
 
 
   
	| Quote: |  
	| I would recommend not running your service as LocalSystem |  
 What is the problem with doing this? Is it purely security? The problem I am having is that when I try to create a listener in my service the service just stops doing anything (no event messages get written but the process still shows as "started"). I have searched on the Internet and have found nothing that gives a good explaination of the differences in the service type.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Thu Jan 06, 2005 10:18 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| how have you solve this? the reason code is 2058 . I think this is a security problem.
 My service is running in the same computer as my MQserver and i'm logged as administrator.
 any issue to solve this?
 thansk
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bower5932 | 
			  
				|  Posted: Thu Jan 06, 2005 10:32 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Aug 2001Posts: 3023
 Location: Dallas, TX, USA
 
 | 
			  
				| 2058 is usually a qmgr name error.  Double-check that the name in your program and the actual qmgr name are identical (eg, same case). |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | bath | 
			  
				|  Posted: Fri Jan 07, 2005 1:50 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 23 Nov 2004Posts: 29
 
 
 | 
			  
				| When  running the same code in  a user interface i can connect to my queue manager. so I think the name of my queue manager is correct.
 I also run the service as administrator I  faced the same problem
 reason code 2058.
 I have to choose an account when running my service.
 
 please i need some advice
 thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |