<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem launching JVM from within a shared library in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-launching-jvm-from-within-a-shared-library/m-p/2994221#M718472</link>
    <description>You might get useful information by running the plugin with the tusc system call reporting utility.  That may, for example, show that the jvm was looking for libhpi and not finding it because it wasn't in the shared library search path.&lt;BR /&gt;You can download tusc from&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html" target="_blank"&gt;http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html&lt;/A&gt;</description>
    <pubDate>Wed, 11 Jun 2003 14:31:59 GMT</pubDate>
    <dc:creator>Mike Stroyan</dc:creator>
    <dc:date>2003-06-11T14:31:59Z</dc:date>
    <item>
      <title>Problem launching JVM from within a shared library</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-launching-jvm-from-within-a-shared-library/m-p/2994220#M718471</link>
      <description>We are writing a plugin for a commercial product to customise it for our use. The plugins are in the form of .sl files. What we're trying to do is, via JNI, load a JVM and launch some Java code from within this plugin. However, the output from the plugin gives the following error:&lt;BR /&gt;&lt;BR /&gt;"There was an error trying to initialize the HPI library.&lt;BR /&gt;Please check your installation, HotSpot does not work correctly&lt;BR /&gt;with any JDK 1.1.x release."&lt;BR /&gt;&lt;BR /&gt;The same JNI code works fine within a standalone executable. The SHLIB_PATH settings are the same for both the standalone executable and the application we're plugging in to.&lt;BR /&gt;&lt;BR /&gt;The code is as follows:&lt;BR /&gt;&lt;BR /&gt;#include &lt;JNI.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;EXITEXT.H&gt;&lt;BR /&gt;#include &lt;ITPDEFS.H&gt;&lt;BR /&gt;&lt;BR /&gt;int ExitRcProtoConn_C( In_TlsSessionInfo_t *tls_info, In_ExitRcProtoConn_t *in, Out_ExitRcProtoConn_t *out )&lt;BR /&gt;{&lt;BR /&gt; memset(out, 0, sizeof(*out));&lt;BR /&gt;&lt;BR /&gt; if (in-&amp;gt;protocol != ITP_PROTO_HTTP)&lt;BR /&gt; {&lt;BR /&gt;  return 0;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;    char* buffer;&lt;BR /&gt;&lt;BR /&gt;    JNIEnv *env;&lt;BR /&gt;    JavaVM *jvm;&lt;BR /&gt;    JavaVMInitArgs vm_args;&lt;BR /&gt;    jint res;&lt;BR /&gt;    jclass cls;&lt;BR /&gt;    jmethodID mid;&lt;BR /&gt;    jstring user;&lt;BR /&gt;    jstring password;&lt;BR /&gt;    jstring hostname;&lt;BR /&gt;    jobjectArray args;&lt;BR /&gt;    char classpath[1024];&lt;BR /&gt;&lt;BR /&gt; JavaVMOption options[4];&lt;BR /&gt;&lt;BR /&gt; options[0].optionString = (char*) "-Djava.class.path=/home/tstxfb:/home/tstxfb/log4j.jar:/home/tstxfb/wcxfb.jar:.:/opt/java1.4/jre/lib/rt.jar"; /* user classes */&lt;BR /&gt; options[1].optionString = (char*) "-Djava.compiler=NONE";&lt;BR /&gt; options[2].optionString = (char*) "-verbose:jni,class,gc";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; vm_args.version = JNI_VERSION_1_4;&lt;BR /&gt; vm_args.options = options;&lt;BR /&gt; vm_args.nOptions = 3;&lt;BR /&gt; vm_args.ignoreUnrecognized = 1;&lt;BR /&gt;&lt;BR /&gt;    /* Create the Java VM */&lt;BR /&gt;      printf("Creating VM\n");&lt;BR /&gt;    res = JNI_CreateJavaVM(&amp;amp;jvm,(void **)&amp;amp;env,&amp;amp;vm_args);&lt;BR /&gt;    if (res &amp;lt; 0) {&lt;BR /&gt;     fprintf(stderr, "Can't create Java VM: %d\n", res);&lt;BR /&gt;&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    printf( "Locating class\n");&lt;BR /&gt;    cls = env-&amp;gt;FindClass( "com/amadeus/webcom/xfb/LdapAuthenticator");&lt;BR /&gt;    if (cls == 0) {&lt;BR /&gt;        fprintf(stderr, "Can't find LdapAuthenticator class\n");&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    printf( "Finding Method\n");&lt;BR /&gt;    mid = env-&amp;gt;GetStaticMethodID( cls, "authenticateObfuscated",&lt;BR /&gt;     "(Ljava/lang/String;Ljava/lang/String;)Z");&lt;BR /&gt;    if (mid == 0) {&lt;BR /&gt;        fprintf(stderr, "Can't find authenticateObfuscated() method\n");&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;    printf( "Creating strings\n");&lt;BR /&gt;    user = env-&amp;gt;NewStringUTF( in-&amp;gt;login_user);&lt;BR /&gt;    if (user == 0) {&lt;BR /&gt;        fprintf(stderr, "Out of memory\n");&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    password = env-&amp;gt;NewStringUTF( in-&amp;gt;login_password);&lt;BR /&gt;    if (password == 0) {&lt;BR /&gt;        fprintf(stderr, "Out of memory\n");&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    hostname = env-&amp;gt;NewStringUTF( in-&amp;gt;http_host_name);&lt;BR /&gt;    if (hostname == 0) {&lt;BR /&gt;        fprintf(stderr, "Out of memory\n");&lt;BR /&gt;        return(-1);&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    printf( "Calling Java code\n");&lt;BR /&gt;    bool result = env-&amp;gt;CallStaticBooleanMethod( cls, mid, user, password,&lt;BR /&gt;     hostname);&lt;BR /&gt;&lt;BR /&gt;    jvm-&amp;gt;DestroyJavaVM();&lt;BR /&gt;&lt;BR /&gt; if (result)&lt;BR /&gt; {&lt;BR /&gt;  return 1;&lt;BR /&gt; }&lt;BR /&gt; return -1;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Can anyone shed any light on this?&lt;BR /&gt;&lt;/ITPDEFS.H&gt;&lt;/EXITEXT.H&gt;&lt;/STDIO.H&gt;&lt;/JNI.H&gt;</description>
      <pubDate>Wed, 11 Jun 2003 07:33:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-launching-jvm-from-within-a-shared-library/m-p/2994220#M718471</guid>
      <dc:creator>Simon Brown_3</dc:creator>
      <dc:date>2003-06-11T07:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem launching JVM from within a shared library</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-launching-jvm-from-within-a-shared-library/m-p/2994221#M718472</link>
      <description>You might get useful information by running the plugin with the tusc system call reporting utility.  That may, for example, show that the jvm was looking for libhpi and not finding it because it wasn't in the shared library search path.&lt;BR /&gt;You can download tusc from&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html" target="_blank"&gt;http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html&lt;/A&gt;</description>
      <pubDate>Wed, 11 Jun 2003 14:31:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-launching-jvm-from-within-a-shared-library/m-p/2994221#M718472</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2003-06-11T14:31:59Z</dc:date>
    </item>
  </channel>
</rss>

