axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Nordberg (JIRA)" <>
Subject [jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions
Date Tue, 13 Sep 2005 21:52:54 GMT
    [ ] 

Henrik Nordberg commented on AXISCPP-731:

Just wanted to add something here that I wrote to the list.

John Hawkins wrote:
> We really need to sort out this whole problem resolution thing. How any times have we
seen emails like this !? 
> Any one got any clues as to what we can do ? 
Yes, I have some suggestions:
1. Solve (this explains why "Apache crashes")
by wrapping the code in 
int axis_handler_helper(request_rec* req_rec)
static void module_init(apr_pool_t* p, server_rec* svr_rec)
in mod_axis2.cpp (and correspondingly for the other "servers", but my guess is mod_axis2 is
by far the most commenly used one), with try and catch, where the catch should look like this:

} catch(AxisException& e) {
    std::cerr << "An error occurred while Axis was initializing: " << e.what()
<< std::endl;
} catch(...) {
    std::cerr << "An unkown error occurred while Axis was initializing: " << e.what()
<< std::endl;
You will need to add two lines at the top of the file:
#include <iostream>
#include <axis/AxisException.hpp>

This will result in errors being written to Apache's access.log. There are other methods you
can use to write to the error.log file too. But writing to stderr is convenient, and the main
point is that we see the error message instead of a crash.
2. But wait, there is more! It turns out that the error messages for the common library loading
problems that many have happening, do not include the name of the library being loaded. This
can fixed this way:
Search the code for the string "Load lib error='%s' \n". Add to this string "Lib = '%s'",
and make sure you include the path of the library after PLATFORM_LOADLIB_ERROR in the sprintf
arg list. (Oh, and while you are at it you can replace sprintf() with std::string. And why
is PLATFORM_GET_ERROR_MESSAGE() returning string* instead of string ??!!)
I did this at work and it works fine (I keep getting an error saying it can't find the xml
parser lib, even though I have Xerces in the path). This code was from memory, but it should
 - Henrik

> extern "C" functions throw exceptions
> -------------------------------------
>          Key: AXISCPP-731
>          URL:
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message