HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problem launching JVM from within a shared library
Operating System - HP-UX
1829467
Members
1480
Online
109991
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2003 12:33 AM
06-11-2003 12:33 AM
Problem launching JVM from within a shared library
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:
"There was an error trying to initialize the HPI library.
Please check your installation, HotSpot does not work correctly
with any JDK 1.1.x release."
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.
The code is as follows:
#include
#include
#include
#include
int ExitRcProtoConn_C( In_TlsSessionInfo_t *tls_info, In_ExitRcProtoConn_t *in, Out_ExitRcProtoConn_t *out )
{
memset(out, 0, sizeof(*out));
if (in->protocol != ITP_PROTO_HTTP)
{
return 0;
}
char* buffer;
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
jint res;
jclass cls;
jmethodID mid;
jstring user;
jstring password;
jstring hostname;
jobjectArray args;
char classpath[1024];
JavaVMOption options[4];
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 */
options[1].optionString = (char*) "-Djava.compiler=NONE";
options[2].optionString = (char*) "-verbose:jni,class,gc";
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 3;
vm_args.ignoreUnrecognized = 1;
/* Create the Java VM */
printf("Creating VM\n");
res = JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM: %d\n", res);
return(-1);
}
printf( "Locating class\n");
cls = env->FindClass( "com/amadeus/webcom/xfb/LdapAuthenticator");
if (cls == 0) {
fprintf(stderr, "Can't find LdapAuthenticator class\n");
return(-1);
}
printf( "Finding Method\n");
mid = env->GetStaticMethodID( cls, "authenticateObfuscated",
"(Ljava/lang/String;Ljava/lang/String;)Z");
if (mid == 0) {
fprintf(stderr, "Can't find authenticateObfuscated() method\n");
return(-1);
}
printf( "Creating strings\n");
user = env->NewStringUTF( in->login_user);
if (user == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
password = env->NewStringUTF( in->login_password);
if (password == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
hostname = env->NewStringUTF( in->http_host_name);
if (hostname == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
printf( "Calling Java code\n");
bool result = env->CallStaticBooleanMethod( cls, mid, user, password,
hostname);
jvm->DestroyJavaVM();
if (result)
{
return 1;
}
return -1;
}
Can anyone shed any light on this?
"There was an error trying to initialize the HPI library.
Please check your installation, HotSpot does not work correctly
with any JDK 1.1.x release."
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.
The code is as follows:
#include
#include
#include
#include
int ExitRcProtoConn_C( In_TlsSessionInfo_t *tls_info, In_ExitRcProtoConn_t *in, Out_ExitRcProtoConn_t *out )
{
memset(out, 0, sizeof(*out));
if (in->protocol != ITP_PROTO_HTTP)
{
return 0;
}
char* buffer;
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
jint res;
jclass cls;
jmethodID mid;
jstring user;
jstring password;
jstring hostname;
jobjectArray args;
char classpath[1024];
JavaVMOption options[4];
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 */
options[1].optionString = (char*) "-Djava.compiler=NONE";
options[2].optionString = (char*) "-verbose:jni,class,gc";
vm_args.version = JNI_VERSION_1_4;
vm_args.options = options;
vm_args.nOptions = 3;
vm_args.ignoreUnrecognized = 1;
/* Create the Java VM */
printf("Creating VM\n");
res = JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM: %d\n", res);
return(-1);
}
printf( "Locating class\n");
cls = env->FindClass( "com/amadeus/webcom/xfb/LdapAuthenticator");
if (cls == 0) {
fprintf(stderr, "Can't find LdapAuthenticator class\n");
return(-1);
}
printf( "Finding Method\n");
mid = env->GetStaticMethodID( cls, "authenticateObfuscated",
"(Ljava/lang/String;Ljava/lang/String;)Z");
if (mid == 0) {
fprintf(stderr, "Can't find authenticateObfuscated() method\n");
return(-1);
}
printf( "Creating strings\n");
user = env->NewStringUTF( in->login_user);
if (user == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
password = env->NewStringUTF( in->login_password);
if (password == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
hostname = env->NewStringUTF( in->http_host_name);
if (hostname == 0) {
fprintf(stderr, "Out of memory\n");
return(-1);
}
printf( "Calling Java code\n");
bool result = env->CallStaticBooleanMethod( cls, mid, user, password,
hostname);
jvm->DestroyJavaVM();
if (result)
{
return 1;
}
return -1;
}
Can anyone shed any light on this?
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2003 07:31 AM
06-11-2003 07:31 AM
Re: Problem launching JVM from within a shared library
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.
You can download tusc from
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html
You can download tusc from
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1433,00.html
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP