Uploaded image for project: 'Commons Daemon'
  1. Commons Daemon
  2. DAEMON-129

jsvc unable to start in OS X Snow Leopard (10.6)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Mac OS X 10.6, Tomcat 6, JDK 1.6

      Description

      After following the directions posted here (http://www.malisphoto.com/tips/tomcatonosx.html) I am unable to start up jsvc. Starting Tomcat 6 works just fine.

      When I attempt to start jsvc, it immediately exits with the following error:

      02/09/2009 16:46:42 30987 jsvc error: Cannot load required shell library /Library/Java/Home/../Libraries/libjvm_compat.dylib
      02/09/2009 16:46:42 30986 jsvc error: Service exit with a return value of 1

      Looking in my frameworks, it looks like "libjvm_compat.dylib" doesn't exist in Snow Leopard's installations of JDK 1.5 and 1.6. It looks like the reference to this file is made in java.c, but I'm not sure what to change this to. When changing it to simply "libjvm.dylib", I get this error:

      03/09/2009 16:20:45 594 jsvc error: Cannot find JVM library entry point
      03/09/2009 16:20:45 593 jsvc error: Service exit with a return value of 1

      Any thoughts would be much appreciated!

        Activity

        Hide
        dougkiley Doug Kiley added a comment - - edited

        Adam,

        I don't have any particular knowledge of the jsvc code, but I have been poking around for the last day. I could be way off base with what I've done so far, but judging from the amount of people around the web asking for a fix and the lack of a solution I bet the problem isn't a simple one.

        Here's what I have found:
        I got the same initial error message that you got. This led me to look for info on what replaces libjvm_compat.dylib. Couldn't find anything on that.

        Next I found myself in java.c. It looks like what eventually fails is a call to JNI_CreateJavaVM which used to be in libjvm_compat.dylib. So now we need to find a new place to load this from.

        I wrote the following C program to run through the 6 choices of dylibs that were in Libraries.

        #include <stdio.h>
        #include <dlfcn.h>
        
        int main (int argc, const char * argv[]) {
        	
        	/*
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libclient.dylib
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libhotspot.dylib
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjawt.dylib  ** works
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjvm.dylib
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libserver.dylib
        	 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libverify.dylib ** works
        	 
        	 */
        	
        	void* hndl = dlopen("/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjawt.dylib",RTLD_GLOBAL|RTLD_NOW);
        	void* success = dlsym(hndl,"JNI_CreateJavaVM");
        	if (success != NULL)
        	{
        		printf("Found JNI_CreateJavaVM");
        	}
        	else
        	{
        		printf("NOT FOUND");
        	}
        	
            return 0;
        }
        

        As you can see I found two that worked. I couldn't find any info on the web about the differences between libjawt and libverify.

        I changed my java.c to load from libverify.dylib instead of libjvm_compat.dylib. The only reason I picked liberify is because I found some Linux forums that were using libverify.so – this wasn't for jsvc, but some other project.

        My current state is that jsvc will build and it does execute, but it won't grab any ports. I get 2 processes called jsvc, but they are both owned by root. It should be that one is owned by root and the other by my Tomcat user.

        I am working on getting the project into Xcode so that I can step through it and see what's going on.

        In debug.c I set log_debug_flag to true.
        In tomcatctl I set JSVC_DEBUG="-debug -verbose".

        I am not getting any error messages to the console or catalina.out/err.

        I've tried my Utilities/Java Preferences in both 32 bit and 64 bit mode. No difference either way.

        I'm running Tomcat 5. Maybe I'll try 6 next.

        I hope this has given someone else an idea on what to try next.

        -Doug

        Show
        dougkiley Doug Kiley added a comment - - edited Adam, I don't have any particular knowledge of the jsvc code, but I have been poking around for the last day. I could be way off base with what I've done so far, but judging from the amount of people around the web asking for a fix and the lack of a solution I bet the problem isn't a simple one. Here's what I have found: I got the same initial error message that you got. This led me to look for info on what replaces libjvm_compat.dylib. Couldn't find anything on that. Next I found myself in java.c. It looks like what eventually fails is a call to JNI_CreateJavaVM which used to be in libjvm_compat.dylib. So now we need to find a new place to load this from. I wrote the following C program to run through the 6 choices of dylibs that were in Libraries. #include <stdio.h> #include <dlfcn.h> int main (int argc, const char * argv[]) { /* /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libclient.dylib /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libhotspot.dylib /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjawt.dylib ** works /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjvm.dylib /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libserver.dylib /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libverify.dylib ** works */ void* hndl = dlopen("/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjawt.dylib",RTLD_GLOBAL|RTLD_NOW); void* success = dlsym(hndl,"JNI_CreateJavaVM"); if (success != NULL) { printf("Found JNI_CreateJavaVM"); } else { printf("NOT FOUND"); } return 0; } As you can see I found two that worked. I couldn't find any info on the web about the differences between libjawt and libverify. I changed my java.c to load from libverify.dylib instead of libjvm_compat.dylib. The only reason I picked liberify is because I found some Linux forums that were using libverify.so – this wasn't for jsvc, but some other project. My current state is that jsvc will build and it does execute, but it won't grab any ports. I get 2 processes called jsvc, but they are both owned by root. It should be that one is owned by root and the other by my Tomcat user. I am working on getting the project into Xcode so that I can step through it and see what's going on. In debug.c I set log_debug_flag to true. In tomcatctl I set JSVC_DEBUG="-debug -verbose". I am not getting any error messages to the console or catalina.out/err. I've tried my Utilities/Java Preferences in both 32 bit and 64 bit mode. No difference either way. I'm running Tomcat 5. Maybe I'll try 6 next. I hope this has given someone else an idea on what to try next. -Doug
        Hide
        dougkiley Doug Kiley added a comment -

        I got mine working! ! !

        Here's my patch file.

        I patched against the 1.0.1 source. Some of the changes came from other people's patch files. The important stuff for this issue is in java.c

        -Doug

        Show
        dougkiley Doug Kiley added a comment - I got mine working! ! ! Here's my patch file. I patched against the 1.0.1 source. Some of the changes came from other people's patch files. The important stuff for this issue is in java.c -Doug
        Hide
        mturk@apache.org Mladen Turk added a comment -

        Committed as r907206. Thanks

        Show
        mturk@apache.org Mladen Turk added a comment - Committed as r907206. Thanks
        Hide
        srijithunni Srijith Kochunni added a comment -

        Hi Mladen and Doug,

        I applied the same patch on my box and tried to start the daemon, but what i notice is that it loads libverify.dylib correctly, but then it just crashes I see this message "dyld: dyld std::terminate()". looks like some uncaught exception was thrown and it says service did not exit cleanly. I'm not sure it the patch is working. Is it a requirement that jsvc must also be built on 10.6 for it to run on 10.6?

        It would be really helpful if I could get this working.?

        Thanks
        Srijith.

        Show
        srijithunni Srijith Kochunni added a comment - Hi Mladen and Doug, I applied the same patch on my box and tried to start the daemon, but what i notice is that it loads libverify.dylib correctly, but then it just crashes I see this message "dyld: dyld std::terminate()". looks like some uncaught exception was thrown and it says service did not exit cleanly. I'm not sure it the patch is working. Is it a requirement that jsvc must also be built on 10.6 for it to run on 10.6? It would be really helpful if I could get this working.? Thanks Srijith.

          People

          • Assignee:
            Unassigned
            Reporter:
            bemaniac Adam Singer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development