Current Quercus java_bean() method does not work in Glassfish v3, because Caucho are cooking their own soup with everything new of JavaEE6 (I don’t understand why they need to reinvent all of JavaEE6 like JSF, CDI, etc. for their own app-server… why don’t use something existing and build on top of it? Why don’t push your own projects further, like Quercus, Hessian, Burlap and co.? )
If you, like me, want to use managed beans from inside your php code, and find out, that jndi_lookup and java_bean() do not work (= return null every time), try this little method
1 2 3 4 5 6 7 8 9 10 | 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; } |