2 Replies Latest reply: Jun 17, 2011 7:40 PM by jschellSomeoneStoleMyAlias RSS

    Destroy JVM hangs the program

    562599
      Hi

      My program hangs when i try to destroy jvm by following statement.

      (*jvm)->DestroyJavaVM(jvm);

      I have created JVM by following code
      int createJVMEnv(void)
      {
      
          JavaVMInitArgs vm_args;
          JavaVMOption options[15];
      
          int res;
          if (env != NULL)
              return SUCCESS;
      
          const char * aim_class_path =getenv("AIM_CLASS_PATH");
      
          if( aim_class_path == NULL )
          {
          WriteLog(FATAL, "CLASSPATH variable is not set in the environment\n");
          }
      
          if(aim_class_path!=NULL)
          {
              char buf[5000];
              sprintf(buf,"-Djava.class.path=%s",aim_class_path);
              options[0].optionString=strdup(buf);
          }
      
      
          options[1].optionString="-DSystemMode=EJB";
          options[2].optionString="-Xms512m";
          options[3].optionString="-Xmx8192m";
      
          options[4].optionString="-Dfltsked.contextFactory=weblogic.jndi.WLInitialContextFactory";
          options[5].optionString="-Dfltsked.remoteObjectLocatorProviderURL=t3://aopcpscm.opc.ual.com:10001";
          /*options[5].optionString="-Dfltsked.remoteObjectLocatorProviderURL=t3://aopcqscmapp01.opc.ual.com:7001";*/
      
          options[6].optionString="-Dfltsked.user.loginID=u298724";
      
          options[7].optionString="-Dlog4j.rootLogger=OFF";
          options[8].optionString="-Dbatchmode.process=true";
          options[9].optionString="-Dweblogic.MaxMessageSize=1000000000";
          options[10].optionString="-Dweblogic.StuckThreadMaxTime=600";
          options[11].optionString="-Dweblogic.CompleteMessageTimeout=480";
      
          options[12].optionString="-Xcheck:jni";
          options[13].optionString="-Xnoclassgc";
          options[14].optionString="-Djava.compiler=NONE";
         vm_args.version = JNI_VERSION_1_6;
          vm_args.options = options;
          vm_args.nOptions = 15;
          vm_args.ignoreUnrecognized = JNI_TRUE;
      
          res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
      
          if (res < 0) {
              WriteLog(FATAL, "Can't create Java VM\n");
              return FAILURE;
          }
          if ((*env)->ExceptionOccurred(env))
          {
              (*env)->ExceptionDescribe(env);
              return NULL;
          }
      
      
          return SUCCESS;
      }
      Can anyone help how can i destroy the jvm? jvm and env are global variable.

      Thanks
      Sas

      Edited by: SasDutta on Jun 16, 2011 10:11 AM