Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003876 [Quercus] minor always 02-04-10 15:02 02-04-10 15:35
Reporter domdorn View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.4 Product Version 4.0.4
  Product Build
Summary 0003876: java_bean and jndi_lookup don't work in glassfish v3
Description java_bean and jndi_lookup don't work in glassfish v3.

Also, those methods are only in full resin.jar (13M) and are highly dependent on resin app server.

this code prints the following, when having resin.jar, resin-kernel.jar and qercus.jar in /WEB-INF/lib

$arr = Array(
      "java"
    , "java_class"
    , "jndi_lookup"
    , "quercus_get_request"
    , "quercus_get_bean"
    , "quercus_get_beans"
    , "quercus_get_servlet_context"
    , "quercus_var_dump"
    , "resin_var_dump"
    , "java_bean"
    , "java_beans"

);




foreach($arr as $values)
{
    echo "function: $values: ";
    echo var_dump ( function_exists($values));
    echo "
\n";

}

result:
function: java: bool(true)
function: java_class: bool(true)
function: jndi_lookup: bool(true)
function: quercus_get_request: bool(true)
function: quercus_get_bean: bool(false)
function: quercus_get_beans: bool(false)
function: quercus_get_servlet_context: bool(true)
function: quercus_var_dump: bool(false)
function: resin_var_dump: bool(true)
function: java_bean: bool(true)
function: java_beans: bool(false)

However, lookup of java_beans registered with CDI do not work as expected:
echo "aaa";
$object = java_bean("testBean");
var_dump($object);
print_r($object);
echo "<hr/>";

echo "bbb";
$object = jndi_lookup("java:app/testBean");
var_dump($object);
print_r($object);
echo "<hr/>";
echo "ccc";
$beanManager = jndi_lookup("comp/BeanManager");
var_dump($beanManager);


echo "eeee";
$object = my_java_bean("testBean");
echo "
";
echo "var_dump: " . var_dump($object);
echo "
";
echo "print_r : " . print_r($object);
echo "
";
echo $object->getMessage();

echo "<hr/>";

prints:
aaaNULL bbbNULL cccNULL eeee
var_dump: resource(com.dominikdorn.lyrix.TestBean@18481697)
print_r : resource(com.dominikdorn.lyrix.TestBean@18481697)1
Hello World

code of my_java_bean() is:
function my_java_bean($name)
{
    $beanManager = quercus_get_servlet_context()->getAttribute("javax.enterprise.inject.spi.BeanManager");
    $beans = $beanManager->getBeans($name);
    if($beans == null || count($beans) < 1)
        return null;
    $object = $beanManager->getReference($beans[0], $beans[0]->getClass(), $beanManager->createCreationalContext($beans[0]));
    return $object;
}


I'm using latest trunk (rev. 6727)

Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0004414)
ferg
02-04-10 15:35

Thanks for the bug report. I've removed the dependencies. The ResinModule will still remain in the resin.jar, which is fine because resin.jar can be used in other app servers.
 

- Issue History
Date Modified Username Field Change
02-04-10 15:02 domdorn New Issue
02-04-10 15:35 ferg Note Added: 0004414
02-04-10 15:35 ferg Assigned To  => ferg
02-04-10 15:35 ferg Status new => closed
02-04-10 15:35 ferg Resolution open => fixed
02-04-10 15:35 ferg Fixed in Version  => 4.0.4
02-04-10 15:35 ferg Additional Information Updated


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker