- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- JNI call JNI_CreateJavaVM hangs when used in Apach...
Categories
Company
Local Language
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
Forums
Discussions
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
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО12-21-2005 07:22 PM
тАО12-21-2005 07:22 PM
JNI call JNI_CreateJavaVM hangs when used in Apache Child Init
I am using JDK 1.4 and Apache 1.3.33 On HPUX V2 ia64.
An external module in Apache Uses JNI to communicate with the JAR's.
The problem is that the JNI Code(written in C) works fine as an independent process but when integrated with Apache (in the child process Initialization), it doesnt return from JNI_CreateJavaVM resulting in kill of the apache process.
This results in too many processes getting spawned and killed by apache.
There are no log entry in the error log which can provide any clue.
Path for libjvm.so used to build the JNI: ~JAVAHOME/jre/lib/IA64W/hotspot
Any clue would be of great help.
thanks and regards
shiva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-21-2005 07:48 PM
тАО12-21-2005 07:48 PM
Re: JNI call JNI_CreateJavaVM hangs when used in Apache Child Init
Here is a guide to "Using Java 2 JNI on HP-UX"
http://www.hp.com/products1/unix/java/infolibrary/prog_guide/JNI_java2.html
Also, a similar problem reported in ITRC,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=68956&admit=-682735245+1135241173844+28353475
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2005 07:50 PM
тАО12-26-2005 07:50 PM
Re: JNI call JNI_CreateJavaVM hangs when used in Apache Child Init
Thanks for the document. But i am afraid my problem still persists.(Though using the document creation of JVM in non-main thread was possible).
In case i am trying to create JVM using native code in the child process(in an multi process environment), the child process simply hangs. (dont have much hands on in java also)
any clues how to fix the same!!!
thanks and regards
shiva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2005 07:55 PM
тАО12-26-2005 07:55 PM
Re: JNI call JNI_CreateJavaVM hangs when used in Apache Child Init
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2005 09:51 PM
тАО12-26-2005 09:51 PM
Re: JNI call JNI_CreateJavaVM hangs when used in Apache Child Init
One more observation. It doesnt work in the main process itself(sorry for not finding it earlier). there is no response once the call to create JVM is made.
I had a sample program which calls the native code to create the JVM. Find the portions of code below
SamProcess.c
===========================
int nRet=-1;
nRet=InitJNI();
libJNI.c
====================================================
typedef int (*JNI_CreateJavaVM_t)(JavaVM**, void**, void*);
JavaVM* g_JVM = NULL;
JNI_CreateJavaVM_t func = NULL;
shl_t libsym = shl_load("libjvm.so", BIND_IMMEDIATE|DYNAMIC_PATH, 0L);
if (libsym == 0) {
l_Result = VM_INIT_ERROR;
goto end;
}
else
printf("shl_loaded libjvm.so successfully!\n");
l_Result = shl_findsym(&libsym, "JNI_CreateJavaVM", TYPE_PROCEDURE, &func);
if (l_Result == 0)
printf( "Found symbol JNI_CreateJavaVM!\n");
else {
printf( "Unable to find symbol JNI_CreateJavaVM!\n");
l_Result = VM_INIT_ERROR;
goto end;
}
// load and init a java vm, return a JNI interface ptr in env
printf ("before CreateJavaVM\n");
l_Result = (*func)(&jvm, (void **)&l_JNIEnv, (void *)&l_JVMInitArgs);
if (l_Result != 0) {
printf ("JNI_CreateJavaVM failed.\n");
l_Result = VM_INIT_ERROR;
goto end;
}
else
printf("after CreateJavaVM \n");
=====================================================
No response is observed while executing this line...l_Result = (*func)(&jvm, (void **)&l_JNIEnv, (void *)&l_JVMInitArgs);
Following is the truss result
===============================
12241: open("/opt/java1.4/jre/lib/IA64W/hotspot/libm.so.1", O_RDONLY|0x800, 0) ERR#2 ENOENT
12241: open("/home/secure/libs/libm.so.1", O_RDONLY|0x800, 0) ERR#2 ENOENT
12241: open("/opt/java1.4/jre/lib/IA64W/libm.so.1", O_RDONLY|0x800, 0) ERR#2 ENOENT
12241: open("/usr/lib/hpux64/libm.so.1", O_RDONLY|0x800, 0) = 6
12241: fstat(6, 0x9fffffffffffe6c0) = 0
12241: read(6, "7fE L F 0202010101\0\0\0\0\0\0\0".., 64) = 64
12241: close(6) = 0
12241: brk(0x6000000000068000) = 0
12241: getpid() = 12241 (12240)
12241: getuid() = 105 (105)
12241: open("/var/spool/pwgr/status", O_RDONLY|0x800, 0) = 6
12241: mmap(NULL, 532, PROT_READ, MAP_SHARED|MAP_VARIABLE|MAP_FILE|MAP_ADDR32, 6, 0) = 0xc09d2000
12241: close(6) = 0
12241: socket(AF_UNIX, SOCK_DGRAM, 0) = 6
12241: getpid() = 12241 (12240)
12241: unlink("/var/spool/sockets/pwgr/client12241") ERR#2 ENOENT
12241: bind(6, 0x9fffffffef7cdfe0, 38) = 0
12241: fcntl(6, F_SETFD, 1) = 0
12241: time(NULL) = 1135679111
12241: poll(0x9fffffffffffdf08, 1, 0) = 1
12241: sendto(6, "\0\0\00 \0\0\001\0\0\0\0\0\0\001".., 48, 0, 0x9fffffffef7ce040, 0x19) = 48
12241: poll(0x9fffffffffffdf08, 1, 1000) = 1
12241: recvfrom(6, "\0\0\0C \0\0\0\0\0\0\0\0\0\0\03 ".., 2064, 0, 0x9fffffffffffdf10, 0x9fffffffffffdf00) = 67
12241: open("/var/tmp/hsperfdata_secure", O_RDONLY|0x800|0x200000, 035) = 7
12241: fstat(7, 0x9ffffffffffff100) = 0
12241: fcntl(7, F_SETFD, 1) = 0
12241: sysfs(GETFSIND, 0xc000000000170bf0, 0x9fffffffef7c6c40) = 9
12241: brk(0x600000000006c000) = 0
12241: lstat("/var/tmp/hsperfdata_secure", 0x9ffffffffffff100) = 0
12241: pathconf("/var/tmp/hsperfdata_secure", _PC_NAME_MAX) = 255
12241: getdents(7, 0x6000000000067650, 16384) = 96
12241: getpid() = 12241 (12240)
12241: kill(26712, SIG#0) ERR#3 ESRCH
12241: unlink("/var/tmp/hsperfdata_secure/26712") = 0
12241: getdents(7, 0x6000000000067650, 16384) = 0
12241: close(7) = 0
12241: mkdir("/var/tmp/hsperfdata_secure", 0755) ERR#17 EEXIST
12241: lstat("/var/tmp/hsperfdata_secure", 0x9ffffffffffff120) = 0
12241: open("/var/tmp/hsperfdata_secure/12241", O_RDWR|O_CREAT|O_TRUNC|0x800, 0600) = 7
12241: ftruncate(7, 16384) = 0
12241: mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_SHARED, 7, 0) = 0xc00000000283c000
12241: close(7) = 0
12241: In user-mode [running]
Thanks and regards
shiva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2006 02:54 PM
тАО01-03-2006 02:54 PM