3

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.

tripleee
  • 175,061
  • 34
  • 275
  • 318
sjsam
  • 21,411
  • 5
  • 55
  • 102
  • 5
    More than one consecutive `/` is ignored. – Cyrus Nov 14 '15 at 08:39
  • Cross-site duplicate of [How does *nix handle multiple consecutive path separators (/home////username///file)?](http://unix.stackexchange.com/questions/1910/how-does-linux-handle-multiple-consecutive-path-separators-home-username) – Am_I_Helpful Nov 14 '15 at 08:41
  • Voting to close this question as it has been solved. – Am_I_Helpful Nov 14 '15 at 08:42
  • There were historically file systems where double directory separators had significance, but the platforms you seem to be asking about are not among them. (Leading double backslashes denote UNC paths on Windows, but you are asking about path-internal separators.) – tripleee Nov 14 '15 at 08:44
  • @Am_I_Helpful : Appreciate pointing the other question. Please consider that I have a sub-question that may not be covered in the other community. Is this `syntax permitted to open files in languages like C`? – sjsam Nov 14 '15 at 08:45
  • Unhelpful questions and duplicates should be closed. If you regard this as helpful but solved, accept an answer. You can post one of your own and accept it if there are no (acceptable) answers. – tripleee Nov 14 '15 at 08:46
  • 1
    @sjsam - I believe you should try and explore that instead of asking here. That'd be the real fun; and also pass me the answer here. – Am_I_Helpful Nov 14 '15 at 08:47
  • The C question isn't really well-defined. The language assigns no semantics to the strings you pass to system calls as file name identifiers. – tripleee Nov 14 '15 at 08:49
  • 1
    I got confused by `use this syntax to open files`. I first thought "Why use this syntax on files that are already opened", but your question is `use this syntax when opening files`. Perhaps rephrase it like `Can I use it with the `open()` and `fopen()` calls in C ? – Walter A Nov 14 '15 at 16:00
  • @tripleee : Please help me reopen this – sjsam Nov 16 '15 at 06:04
  • Why do you think I have any special role in this? I am no Windows expert. Posting a new question with the new material appears to be a better approach at this point -- ideally, you should get enough reopen votes after updating your question so it's topical, but the extraneous tags are probably getting in the way a bit. Maybe try one more edit and if that fails, just delete this one and post a new, better, more focused question about your actual problem. (Do be aware that deleting questions often is problematic, but a one-off should be harmless.) – tripleee Nov 16 '15 at 06:13
  • The simple explanation would be that the current working directory is different from the binary's directory. As far as I know, the file systems you care about simply disregard repeated directory separators. – tripleee Nov 16 '15 at 06:14
  • @tripleee : Cheers for the suggestions ! There is already a [question](http://stackoverflow.com/questions/18467539/axis2-http-server-fails-to-load-service-library) specific to the dll error, but it is not well received. So posting another question won't help and there is chance that it will marked as a duplicate. – sjsam Nov 16 '15 at 08:03
  • @tripleee : The working directory is indeed different from the dll's directory but as `@Cyrus` suggested above - if the additional `/` in `..//lib/axis2_http_sender.dll` is ignored the exe should be perfectly linked with the dll. Am I right about this? – sjsam Nov 16 '15 at 08:11
  • 1
    I think not, but like I said, I am no Windows expert. I posted a bounty on the other question; hope that's sufficient to get somebody to look at it. – tripleee Nov 16 '15 at 08:18
  • @tripleee : Thankyou for rephrasing the question . i was cracking my head on how to rephrase it. This makes more sense to me. – sjsam Nov 16 '15 at 08:35

1 Answers1

4

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!!

sjsam
  • 21,411
  • 5
  • 55
  • 102