calling Java methods from PHP
| From: | Mat Jones | Date: | Mon, 31 Jul 2000 11:21:35 +0000 |
| Subject: | calling Java methods from PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9140@lists.php.net to get a copy of this message | ||
Has anyone used the native java interface in php? I'm trying to use php
to
interface to the Apache XML project. As an example here's some code to
call
the Xalan XSLT processor :
<?
// Have the XSLTProcessorFactory obtain a interface to a new
XSLTProcessor object.
$xslt_processor_factory = new
Java("org.apache.xalan.xslt.XSLTProcessorFactory");
$xslt_processor = $xslt_processor_factory->getProcessor();
$xslt_input = new
Java("org.apache.xalan.xslt.XSLTInputSource","foo.xml");
$xslt_xsl = new
Java("org.apache.xalan.xslt.XSLTInputSource","foo.xsl");
$xslt_result = new
Java("org.apache.xalan.xslt.XSLTResultTarget","output.html");
// Have the XSLTProcessor processor object transform "foo.xml" to
// output.html, using the XSLT instructions found in "foo.xsl".
$xslt_processor->process($xslt_input, $xslt_xsl, $xslt_result);
?>
It doesn't work! I don't have a great deal of experience with Java and
don't
know what is wrong with the above code. When I try and call the xslt
processor
I get the following server error:
SIGSEGV received at bfffe8e8 in
/usr/jdk118/lib/linux/native_threads/libjava.so. Processing terminated
Writing stack trace to javacore17278.txt ... OK
[Mon Jul 31 11:49:07 2000] [notice] child pid 17278 exit signal
Segmentation fault (11)
Has anyone got this to work? If so can you offer any advice?
Thanks in advance
Mat Jones
mjones@plus.net.uk
---
The java stack trace is :
Application Environment
-----------------------
Signal Handlers -
SIGHUP : unknown handler
SIGINT : unknown handler
SIGQUIT : ignored
SIGILL : sysThreadIDump (libjava.so)
SIGABRT : sysThreadIDump (libjava.so)
SIGFPE : sysThreadIDump (libjava.so)
SIGBUS : sysThreadIDump (libjava.so)
SIGSEGV : sysThreadIDump (libjava.so)
SIGPIPE : ignored
SIGALRM : unknown handler
SIGTERM : unknown handler
SIGURG : unknown handler
SIGUSR1 : doSuspendLoop (libjava.so)
SIGPROF : unknown handlerLibraries Loaded by the JVM
---------------------------
<main>
libjitc.so
libzip.so
libphp_java.so
Current Thread Details
----------------------
"main" (TID:0x404212d8, sys_thread_t:0x821c0d8)
Native Thread State: ThreadID: 00000400 Reuse: 1 USER PRIMORDIAL
RUNNING
Native Stack Data : base: bfffec0c pointer bffdf9e4 used(127528)
free(-10792)
----- Monitors held -----
----- Native stack -----
__irem_trap6
------ Java stack ------ () prio=5:
pending=java.lang.StackOverflowError *current thread*
net.php.reflect.Invoke(Compiled Code)
--------------------------------------------Total Thread Count: 3
Active Thread Count: 3
JNI Thread Count: 0
Full thread dump:
"Async Garbage Collector" (TID:0x40421238, sys_thread_t:0x825d580)
Native Thread State: ThreadID: 00000803 Reuse: 1 DAEMON MONITOR
WAIT
Native Stack Data : base: bf5ffd00 pointer bf5ffaf4 used(524)
free(116212)
----- Monitors held -----
----- Native stack -----
sysMonitorWait
sysThreadSleep
threadSleep
SetOrigArgs
sysThread_shell
pthread_detach
__clone
------ Java stack ------ () prio=1
----------------------------------------------------------------------
--------------------------
"Finalizer thread" (TID:0x40421288, sys_thread_t:0x825d300)
Native Thread State: ThreadID: 00000402 Reuse: 1 DAEMON MONITOR
WAIT
Native Stack Data : base: bf7ffd00 pointer bf7ffb68 used(408)
free(116328)
----- Monitors held -----
----- Native stack -----
sysMonitorWait - waiting on Finalize me queue lock
finalizeOnExit
sysThread_shell
pthread_detach
__clone "main" (TID:0x404212d8, sys_thread_t:0x821c0d8)
Native Thread State: ThreadID: 00000400 Reuse: 1 USER PRIMORDIAL
RUNNING
Native Stack Data : base: bfffec0c pointer bffdf9d8 used(127540)
free(-10804)
----- Monitors held -----
----- Native stack -----
__irem_trap6
------ Java stack ------ () prio=5:
pending=java.lang.StackOverflowError *current thread*
net.php.reflect.Invoke(Compiled Code)
----------------------------------------------------------------------
System Monitor Status
---------------------
JIT monitor: unowned.
JIT monitor: unowned.
JIT monitor: unowned.
JIT monitor: unowned.
JIT monitor: unowned.
Thread queue lock: unowned.
Name and type hash table lock: unowned.
String intern lock: unowned.
JNI pinning lock: unowned.
JNI global reference lock: unowned.
Zip lock: unowned.
BinClass lock: unowned.
Class loading lock: unowned.
Java stack lock: unowned.
Code rewrite lock: unowned.
Heap Lock: unowned.
Has finalization queue lock: unowned.
Finalize me queue lock: unowned.
Integer lock access-lock: unowned.
Monitor cache lock: unowned.
Monitor registry: unowned.
Object Monitor Status
---------------------