php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20148 The document contains no data....
Submitted: 2002-10-29 08:06 UTC Modified: 2002-11-02 14:17 UTC
From: frederic dot linot at free dot fr Assigned:
Status: Closed Package: Java related
PHP Version: 4.2.3 OS: Linux (Mandrake 8.2)
Private report: No CVE-ID: None
 [2002-10-29 08:06 UTC] frederic dot linot at free dot fr
**** here is my problem ****

When I try to create a new java object, or when I call a java related php function (like 'java_last_exception_get()') I get the message 'Document contains no data' in my browser.


**** here is my test file ****

<html>
 <body>
  yes

<?php
echo "yes again";


/**
* problem was the same with this single line :
* java_last_exception_get() ;
*/
  
  // get instance of Java class java.lang.System in PHP
  $system = new Java('java.lang.System');

  // demonstrate property access
  print 'Java version='.$system->getProperty('java.version').' <br>';
  print 'Java vendor=' .$system->getProperty('java.vendor').' <br>';
  print 'OS='.$system->getProperty('os.name').' '.
              $system->getProperty('os.version').' on '.
              $system->getProperty('os.arch').' <br>';

  // java.util.Date example
  $formatter = new Java('java.text.SimpleDateFormat',
                        "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");

  print $formatter->format(new Java('java.util.Date'));

?>
 </body>
</html>


**** here is my config options ****

./configure \
--prefix=/usr/local/php4 \
--with-apxs2=/usr/local/apache-2.0.43/bin/apxs \
--with-regex=system \
--enable-inline-optimization \
--enable-debug=yes \
--enable-ftp \
--with-mysql \
--with-java=/usr/java/j2sdk1.4.1 \
--with-sybase=/usr/local/freetds \
--enable-sysvshm \
--enable-sysvsem

**** here is my php.ini [java] section ****
[java]
;   java.home = /usr/java/j2sdk1.4.1
   java.class.path=/usr/local/php4/lib/php/php_java.jar:/home/fred/java/travail/class
;   java.library=/usr/java/j2sdk1.4.1/jre/lib/i386/server/libjvm.so
   extension_dir=/usr/local/php4/lib/php/extensions/debug-zts-20020429
   extension=java.so


**** here is my 'error.log' file ****
[Tue Oct 29 14:21:12 2002] [notice] caught SIGTERM, shutting down
[Tue Oct 29 14:30:48 2002] [notice] Apache/2.0.43 (Unix) PHP/4.2.3 configured -- resuming normal operations
[Tue Oct 29 14:31:04 2002] [notice] child pid 29488 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:04 2002] [notice] child pid 29487 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:04 2002] [notice] child pid 29486 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:04 2002] [notice] child pid 29485 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:04 2002] [notice] child pid 29484 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:04 2002] [notice] child pid 29483 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:05 2002] [notice] child pid 29489 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:06 2002] [notice] child pid 29492 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:06 2002] [notice] child pid 29491 exit signal Segmentation fault (11)
[Tue Oct 29 14:31:06 2002] [notice] child pid 29490 exit signal Segmentation fault (11)


please help !
Thank you very much

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-29 08:34 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2002-10-30 03:45 UTC] frederic dot linot at free dot fr
I found the problem ...
In fact there was 2 problems !

1) The first was with the library path
When I put in the php.ini file the command 'java.library = /path/to/libjvm.so' it solve the prompt on screen saying that the library couldn't be found.. But If you look apache execution with gdb, you see apache crashing anyway, with the error 'libjvm.so can not be found' !! 

So, I add in my /etc/ld.so.conf file the 2 lines "/usr/java/j2sdk1.4.1/jre/lib/i386/" and "/usr/java/j2sdk1.4.1/jre/lib/i386/server/" but after a ldconfig, I saw that the "/usr/java/j2sdk1.4.1/jre/lib/i386/" did not work.
I think this is a problem with my OS. Peraps because the last folder ends with a number, I don't know. But If I create a folder "/usr/java/j2sdk1.4.1/jre/lib/i386/test" and add it to the 'ld.so.conf', it works !!! (I copied libraries '/i386/*.so' into before...)
The cleanest solution was to define "LD_LIBRARY_PATH=/usr/java/j2sdk1.4.1/jre/lib/i386/:/usr/java/j2sdk1.4.1/jre/lib/i386/server/" and in this case, it works !! (without the created 'test' folder)

That's strange...

2) My second problem was with the 'java.so' file.
I had to create a symbolic link to it with the name 'libphp_java.so'
because the JVM crashed if not.


And that's all !! 
I think this kind of information (like the symbolic link for exemple) should be present in the ext/java/README file, because the documentation online is not detailed enought.


thank you, and good luck for solving bugs... Java and php are realy great langages. I would be fine that they perfectly work together ;-)

Fred
 [2002-11-02 14:17 UTC] kalowsky@php.net
Symbolic link issue is already in another bug, but I've added a comment in the java readme for now.  Thanks for taking the time to help.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 00:03:49 2021 UTC