Search code examples
capache-axis

Axis2 fails to load DLL


I came across the below line in the Apache-Axis2 log file.

[Sat Nov 14 12:16:08 2015] [error] ..\..\util\src\class_loader.c(167) Loading shared library ..//lib/axis2_http_sender.dll  Failed. DLERROR IS DLL Load Error 126: The specified module could not be found.

On analyzing the class_loader.c file from line#156 to line#167 as given below:

dll_name = axutil_dll_desc_get_name(dll_desc, env);
    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Shared library to be loaded is %s",dll_name);
    dl_handler = AXIS2_PLATFORM_LOADLIB(dll_name);
    if (!dl_handler)
    {        
#ifndef WIN32
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s  Failed. DLERROR IS %s", 
            dll_name, AXIS2_PLATFORM_LOADLIB_ERROR);
#else
        axis2_char_t buff[AXUTIL_WIN32_ERROR_BUFSIZE];
        axutil_win32_get_last_error(buff, AXUTIL_WIN32_ERROR_BUFSIZE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s  Failed. DLERROR IS %s",dll_name, buff);

I guess the problem is in the very first line - dll_name = axutil_dll_desc_get_name(dll_desc, env);. The value stored in dll_name is ..//lib/axis2_http_sender.dll. Though the axis2_http_sender.dll is present in the lib directory which is relative to the executable, the linker fails to connect to it.

I have never seen file name syntax like below:

..//lib/axis2_http_sender.dll

I tested it in Windows Command line and it worked like :

../lib/axis2_http_sender.dll

What are the implication of using consecutive /s in a C function like fopen()?

I did try few code samples.

Below is a piece of C code:

FILE *fp;
fopen_s(&fp,"C://tempfile.txt", "w");
fputs("Text content", fp);
fclose(fp);

The above code worked fine for me.


Solution

  • Cracked this one finally.
    This CSDN blog post suggested that Axis2C Windows distribution depends on OpenSSL DLLs.

    I listed the dll dependencies of axis2_apache_server.exe using the following command.

    listdlls axis2_apache_server.exe
    

    and the list showed that the two ssl dlls libeay32 and ssleay32 are required to run it. However, these two dlls were missing from the Axis2 Binary Distribution.

    (I don't know why & I think it should have been included. Moreover there is no mention of this in Axis2 documentation.)

    The above dlls are available in either Apache2 or OpenSSL installs the I added the path to these dlls to my PATH variable.

    I ran the axis2_apache_server.exe and voila !!

    Conclusion:Consecutive /s in the file path doesn't affect the linking at all.

    Moral: One should check the dll dependencies of an exe file first and make sure that all the dlls are present when he ran into a dll load error.

    Hard learned moral though!!