Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 1079

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- Debugging</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/orber-3.6.24.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>orber</strong><br><strong>User's Guide</strong><br><small>Version 3.6.24</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Chapters</strong></small></p>
<ul class="flipMenu" imagepath="../../../../doc/js/flipmenu">
<li id="no" title="The Orber Application" expanded="false">The Orber Application<ul>
<li><a href="ch_contents.html">
              Top of chapter
            </a></li>
<li title="Content Overview"><a href="ch_contents.html#id61214">Content Overview</a></li>
<li title="Brief Description of the User's Guide"><a href="ch_contents.html#id62498">Brief Description of the User's Guide</a></li>
</ul>
</li>
<li id="no" title="Introduction to Orber" expanded="false">Introduction to Orber<ul>
<li><a href="ch_introduction.html">
              Top of chapter
            </a></li>
<li title="Overview"><a href="ch_introduction.html#id64790">Overview</a></li>
</ul>
</li>
<li id="no" title="The Orber Application" expanded="false">The Orber Application<ul>
<li><a href="ch_orber_kernel.html">
              Top of chapter
            </a></li>
<li title="ORB Kernel and IIOP "><a href="ch_orber_kernel.html#id57197">ORB Kernel and IIOP </a></li>
<li title="The Object Request Broker (ORB)"><a href="ch_orber_kernel.html#id63374">The Object Request Broker (ORB)</a></li>
<li title="Internet Inter-Object Protocol (IIOP)"><a href="ch_orber_kernel.html#id65057">Internet Inter-Object Protocol (IIOP)</a></li>
</ul>
</li>
<li id="no" title="Interface Repository" expanded="false">Interface Repository<ul>
<li><a href="ch_ifr.html">
              Top of chapter
            </a></li>
<li title="Interface Repository(IFR)"><a href="ch_ifr.html#id64309">Interface Repository(IFR)</a></li>
</ul>
</li>
<li id="no" title="Installing Orber" expanded="false">Installing Orber<ul>
<li><a href="ch_install.html">
              Top of chapter
            </a></li>
<li title="Installation Process "><a href="ch_install.html#id62824">Installation Process </a></li>
<li title="Configuration"><a href="ch_install.html#id74009">Configuration</a></li>
<li title="Firewall Configuration"><a href="ch_install.html#id76130">Firewall Configuration</a></li>
<li title="Interface Configuration"><a href="ch_install.html#id76571">Interface Configuration</a></li>
</ul>
</li>
<li id="no" title="OMG IDL to Erlang Mapping" expanded="false">OMG IDL to Erlang Mapping<ul>
<li><a href="ch_idl_to_erlang_mapping.html">
              Top of chapter
            </a></li>
<li title="OMG IDL to Erlang Mapping - Overview"><a href="ch_idl_to_erlang_mapping.html#id76788">OMG IDL to Erlang Mapping - Overview</a></li>
<li title="OMG IDL Mapping Elements"><a href="ch_idl_to_erlang_mapping.html#id76811">OMG IDL Mapping Elements</a></li>
<li title="Getting Started"><a href="ch_idl_to_erlang_mapping.html#id76868">Getting Started</a></li>
<li title="Basic OMG IDL Types"><a href="ch_idl_to_erlang_mapping.html#id76929">Basic OMG IDL Types</a></li>
<li title="Template OMG IDL Types and Complex Declarators"><a href="ch_idl_to_erlang_mapping.html#id77470">Template OMG IDL Types and Complex Declarators</a></li>
<li title="Constructed OMG IDL Types"><a href="ch_idl_to_erlang_mapping.html#id77956">Constructed OMG IDL Types</a></li>
<li title="Scoped Names and Generated Files"><a href="ch_idl_to_erlang_mapping.html#id78395">Scoped Names and Generated Files</a></li>
<li title="Typecode, Identity and Name Access Functions"><a href="ch_idl_to_erlang_mapping.html#id78787">Typecode, Identity and Name Access Functions</a></li>
<li title="References to Constants"><a href="ch_idl_to_erlang_mapping.html#id78931">References to Constants</a></li>
<li title="References to Objects Defined in OMG IDL"><a href="ch_idl_to_erlang_mapping.html#id78990">References to Objects Defined in OMG IDL</a></li>
<li title="Exceptions"><a href="ch_idl_to_erlang_mapping.html#id79013">Exceptions</a></li>
<li title="Access to Attributes"><a href="ch_idl_to_erlang_mapping.html#id79046">Access to Attributes</a></li>
<li title="Invocations of Operations"><a href="ch_idl_to_erlang_mapping.html#id79103">Invocations of Operations</a></li>
<li title="Implementing the DB Application"><a href="ch_idl_to_erlang_mapping.html#id79262">Implementing the DB Application</a></li>
<li title="Reserved Compiler Names and Keywords"><a href="ch_idl_to_erlang_mapping.html#id79480">Reserved Compiler Names and Keywords</a></li>
<li title="Type Code Representation"><a href="ch_idl_to_erlang_mapping.html#id80225">Type Code Representation</a></li>
</ul>
</li>
<li id="no" title="CosNaming Service" expanded="false">CosNaming Service<ul>
<li><a href="ch_naming_service.html">
              Top of chapter
            </a></li>
<li title="Overview of the CosNaming Service"><a href="ch_naming_service.html#id80888">Overview of the CosNaming Service</a></li>
<li title="The Basic Use-cases of the Naming Service"><a href="ch_naming_service.html#id81031">The Basic Use-cases of the Naming Service</a></li>
<li title="Interoperable Naming Service"><a href="ch_naming_service.html#id81378">Interoperable Naming Service</a></li>
</ul>
</li>
<li id="no" title="How to use security in Orber" expanded="false">How to use security in Orber<ul>
<li><a href="ch_security.html">
              Top of chapter
            </a></li>
<li title="Security in Orber"><a href="ch_security.html#id82238">Security in Orber</a></li>
</ul>
</li>
<li id="no" title="Orber Stubs/Skeletons" expanded="false">Orber Stubs/Skeletons<ul>
<li><a href="ch_stubs.html">
              Top of chapter
            </a></li>
<li title="Orber Stubs and Skeletons Description"><a href="ch_stubs.html#id82459">Orber Stubs and Skeletons Description</a></li>
</ul>
</li>
<li id="no" title="CORBA System and User Defined Exceptions" expanded="false">CORBA System and User Defined Exceptions<ul>
<li><a href="ch_exceptions.html">
              Top of chapter
            </a></li>
<li title="System Exceptions"><a href="ch_exceptions.html#id83036">System Exceptions</a></li>
<li title="User Defined Exceptions"><a href="ch_exceptions.html#id83473">User Defined Exceptions</a></li>
<li title="Throwing Exceptions"><a href="ch_exceptions.html#id83493">Throwing Exceptions</a></li>
<li title="Catching Exceptions"><a href="ch_exceptions.html#id83525">Catching Exceptions</a></li>
</ul>
</li>
<li id="no" title="Orber Interceptors" expanded="false">Orber Interceptors<ul>
<li><a href="ch_interceptors.html">
              Top of chapter
            </a></li>
<li title="Using Interceptors"><a href="ch_interceptors.html#id83634">Using Interceptors</a></li>
<li title="Interceptor Example"><a href="ch_interceptors.html#id83850">Interceptor Example</a></li>
</ul>
</li>
<li id="no" title="OrberWeb" expanded="false">OrberWeb<ul>
<li><a href="ch_orberweb.html">
              Top of chapter
            </a></li>
<li title="Using OrberWeb"><a href="ch_orberweb.html#id84111">Using OrberWeb</a></li>
<li title="Starting OrberWeb"><a href="ch_orberweb.html#id84699">Starting OrberWeb</a></li>
</ul>
</li>
<li id="loadscrollpos" title="Debugging" expanded="true">Debugging<ul>
<li><a href="ch_debugging.html">
              Top of chapter
            </a></li>
<li title="Tools and FAQ"><a href="ch_debugging.html#id84785">Tools and FAQ</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<h1>13 Debugging</h1>
  

  <h3><a name="id84785">13.1 
        Tools and FAQ</a></h3>
    
    <p>Persons who use Orber for the first time may find it hard to tell what goes
      wrong when trying to setup communication between an Orber-ORB and ORB:s supplied
      by another vendor or another Orber-ORB. The purpose of this chapter is to inform
      about the most common mistakes and what tools one can use to overcome these 
      problems. </p>

    <h4>Tools</h4>
      
      <p>To begin with, Orber can be configured to run in debug mode. There are four ways
        to set this parameter:</p>
      <ul>
        <li>
<strong>erl -orber orber_debug_level 10</strong> - can be added to a start-script.</li>
        <li>
<strong>corba:orb_init([{orber_debug_level, 10}])</strong> - this operation must
         be invoked <strong>before</strong> starting Orber.</li>
        <li>
<strong>orber:configure(orber_debug_level, 10)</strong> - this operation can
         be invoked at any time.</li>
        <li>
<strong>OrberWeb</strong> - via the <span class="code">Configuration</span> menu one can easily change
         the configuration. For more information, see the OrberWeb chapter in this
         User's Guide.</li>
      </ul>
      <p>When Orber runs i debug mode, printouts will be generated if anything abnormal occurs
        (not necessarily an error). An error message typically looks like:</p>
      <div class="example"><pre>
=ERROR REPORT==== 29-Nov-2001::14:09:55 ===
=================== Orber =================
[410] corba:common_create(orber_test_server, [{pseudo,truce}]); 
not a boolean(truce).
===========================================
      </pre></div>
      <p>In the example above, we tried to create an object with an incorrect option (i.e. should
        have been <span class="code">{pseudo,true}</span>).</p>
      <p>If you are not able to solve the problem, you should include all generated reports when
        contacting support or using the erlang-questions mailing list.</p>
      <p>It is easy to forget to, for example, set all fields in a struct, which
        one may not discover when developing an application using Orber. When using
        a typed language, such faults would cause a compile time error. To avoid
        these mistakes, Orber allows the user to activate automatic typechecking
        of all local invocations of CORBA Objects. For this feature to be really
        useful, the user must create test suites which cover as much as 
        possible. For example, invoking an operation with invalid or incorrect
        arguments should also be tested. This option can be activated for one object
        or all object via:</p>
      <ul>
        <li>
<strong>'MyModuyle_MyInterface':oe_create(Env, [{local_typecheck, true}])</strong> - 
         This approach will only activate, or deactivate, typechecking for
         the returned instance. Naturally, this option can also be passed
         to <span class="code">oe_create_link/2</span>, <span class="code">corba:create/4</span> and 
        <span class="code">corba:create_link/4</span>.</li>
        <li>
<strong>erl -orber flags 2</strong> - can be added to a start-script.
         All object invocations will be typechecked, unless overridden by the
         previous option.</li>
        <li>
<strong>corba:orb_init([{flags, 16#0002}])</strong> - this operation must
         be invoked <strong>before</strong> starting Orber. Behaves as the previous
         option.</li>
      </ul>
      <p>If incorrect data is passed or returned, Orber uses the <span class="code">error_logger</span>
        to generate logs, which can look like:</p>
      <div class="example"><pre>
=ERROR REPORT==== 10-Jul-2002::12:36:09 ===
========= Orber Typecheck Request =========
Invoked......: MyModule_MyInterface:foo/1
Typecode.....: [{tk_enum,"IDL:MyModule/enumerant:1.0",
                         "enumerant",
                         ["one","two"]}]
Arguments....: [three]
Result.......: {'EXCEPTION',{'MARSHAL',[],102,'COMPLETED_NO'}}
===========================================
      </pre></div>
      <p>Note, that the arity is equivalent to the IDL-file. In the example above,
        an undefined enumerant was used. In most cases, it is useful to set the
        configuration parameter <span class="code">orber_debug_level 10</span> as well. Due to the
        extra overhead, this option <strong>MAY ONLY</strong> be used during testing and
        development.
        For more information, see also
        <span class="bold_code"><a href="ch_install.html#config">configuration settings</a></span>.</p>
      <p>It is also possible to trace all communication between an Orber-ORB and, for example,
        a Java-ORB, communicating via IIOP. All you need to do is to activate an 
        <span class="bold_code"><a href="ch_interceptors.html">interceptor</a></span>. Normally, the users must
        implement the interceptor themselves, but for your convenience Orber includes three
        pre-compiled interceptors called <span class="code">orber_iiop_tracer</span>,
        <span class="code">orber_iiop_tracer_silent</span> and <span class="code">orber_iiop_tracer_stealth</span>.</p>
      <div class="warning">
<div class="label">Warning</div>
<div class="content"><p>
        <p>Logging all traffic is <strong>expensive</strong>. Hence, only use the supplied 
          interceptors during test and development.</p>
      </p></div>
</div>
      <p>The <span class="code">orber_iiop_tracer</span> and <span class="code">orber_iiop_tracer_silent</span> interceptors
        uses the <span class="code">error_logger</span> module to generate the logs. If the traffic 
        is intense you probably want to write the reports to a log-file. 
        This is done by, for example, invoking:</p>
      <div class="example"><pre>
erl&gt; error_logger:tty(false). 
erl&gt; error_logger:logfile({open, "/tmp/IIOPTrace"}). 
      </pre></div>
      <p>The <span class="code">IIOPTrace</span> file will contain, if you use the <span class="code">orber_iiop_tracer</span> 
        interceptor, reports which looks like:</p>
      <div class="example"><pre>
=INFO REPORT==== 13-Jul-2005::18:22:39 ===
=============== new_out_connection =======
Node      : myNode@myHost
From      : 192.0.0.10:47987
To        : 192.0.0.20:4001
==========================================

=INFO REPORT==== 29-Nov-2001::15:26:28 ===
=============== out_request ==============
Connection: {"192.0.0.20",4001,"192.0.0.10",47987}
Operation : resolve
Parameters: [[{'CosNaming_NameComponent',
                "AIK","SwedishIcehockeyChampions"}]]
Context   : [{'IOP_ServiceContext',1,
               {'CONV_FRAME_CodeSetContext',65537,65801}}]
==========================================
      </pre></div>
      <p>The <span class="code">orber_iiop_tracer_silent</span> will not log GIOP encoded data. To activate
        one the interceptors, you have two options:</p>
      <ul>
        <li>
<strong>erl -orber interceptors "{native,[orber_iiop_tracer]}"</strong> - can be added to a start-script.</li>
        <li>
<strong>corba:orb_init([{interceptors, {native, [orber_iiop_tracer_silent]}}])</strong> - this operation must
         be invoked <strong>before</strong> starting Orber.</li>
      </ul>
      <p>It is also possible to active and deactivate an interceptor during
        run-time, but this will only affect currently existing connections. 
        For more information, consult Orber's Reference Manual regarding the
        operations <span class="code">orber:activate_audit_trail/0/1</span> and
        <span class="code">orber:activate_audit_trail/0/1.</span></p>
    

    <h4>FAQ</h4>
      
      <p><strong>Q: When my client, typically written in C++ or Java, invoke narrow on an Orber  object reference it fails?</strong></p>
      <p>A: You must register your application in the IFR by invoking <span class="code">oe_register()</span>. 
        If the object was created by a COS-application, you must run install 
        (e.g. <span class="code">cosEventApp:install()</span>).</p>
      <p>A: Confirm, by consulting the IDL specifications, that the received object reference really
        inherit from the interface you are trying to narrow it to.</p>
      <br>
      <p><strong>Q: I am trying to register my application in the IFR but it fails. Why?</strong></p>
      <p>A: If one, or more, interface in your IDL-specification inherits from
        other interface(s), you must register them before registering your
        application. Note, this also apply when you inherit interfaces
        supported by a COS-application. Hence, they must be installed prior to
        registration of your application.</p>
      <br>
      <p><strong>Q: I have a Orber client and server residing on two different Orber instances but I only get the 'OBJECT_NOT_EXIST' exception, even though I am sure that the object is still alive?</strong></p>
      <p>A: If the two Orber-ORB's are not intended to be a part of multi-node ORB, make sure that the
        two Orber-ORB's have different <strong>domain</strong> names set (see
        <span class="bold_code"><a href="ch_install.html#config">configuration settings</a></span>). The easiest way
        to confirm this is to invoke <span class="code">orber:info()</span> on each node.</p>
      <br>
      <p><strong>Q: When I'm trying to install and/or start Orber it fails?</strong></p>
      <p>A: Make sure that no other Orber-ORB is already running on the same node. If so,
        change the <span class="code">iiop_port</span> configuration parameter (see
        <span class="bold_code"><a href="ch_install.html#config">configuration settings</a></span>).</p>
      <br>
      <p><strong>Q: My Orber server is invoked via IIOP but Orber cannot marshal the  reply?</strong></p>
      <p>A: Consult your IDL file to confirm that your replies are of the correct
        type. If it is correct and the return type is, for example,
        a struct, make sure you have set every field in the struct. If
        you do not do that it will be set to the atom 'undefined', which
        most certainly is not correct.</p>
      <br>
      <p>A: Check that you handle <span class="code">inout</span> and <span class="code">out</span> parameters correctly
        (see the IDL specification). For example, a function which have one
        out-parameter and should return void, then your call-back module
        should return <span class="code">{reply, {ok, OutParam}, State}</span>. Note, even though
        the return value is void (IDL) you must reply with ok.</p>
      <br>
      <p><strong>Q: I cannot run Orber as a multi-node ORB?</strong></p>
      <p>A: Make sure that the Erlang distribution have been started for each
        node and the <span class="code">cookies</span> are correct. For more information,
        consult the <span class="code">System Documentation</span></p>
      <br>
    
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>