|
From: <php...@li...> - 2006-02-15 18:37:46
|
Hi,
> Cannot instantiate class:
> org.jnp.interfaces.NamingContextFactory
assuming that you have copied the
/usr/share/doc/php-java-bridge-devel-3.0.7/examples/j2ee/documentBean.jar
to the jboss deploy directory and changed globals.php:
// jboss specific changes in globals.php
$app_url="jnp://127.0.0.1:1099";
put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
and documentClient.php:
// jboss specific changes in documentClient.php
java_require("/opt/jboss-4.0.2/client/;/usr/share/doc/php-java-bridge-devel-3.0.7/examples/j2ee/documentBean.jar");
include("globals.php");
$doc=createDocument($app_url, "DocumentEJB");
the example works with jboss, at least when the VM
running the documentBean is different than the VM
running the server part of documentBean (I haven't
tested rmi/iiop within only one VM, yet).
> was trying to load the jars in this style
> java_require(" http://localhost/jnp-client.jar");
The java_require() makes the jnp classes available to
the bridge, only. It does not "inject" the loaded
classes into the application server.
The above standalone example works because the client
VM loads everything fresh from the bridge classloader
and therefore the jnp-client classes are visible to
the factory.
But if the factory is already available to the global
or jboss class loader and you load the jnp-client via
java_require(), the global or jboss classloader would
still report the jnp-client class as missing unless
you make it available to the global or jboss class
loader.
BTW: Correct me if I am wrong, but is there a reason
why delegate to the parent loader and then abort when
the parent fails with anything than a
ClassNotFoundException? I think we should check for
other exceptions and try again w/o the parent; the
code should try to load everything from the user's
java_require path. In this case
java_require("$jboss_home/client/) would work,
regardless of how many classes the parent has cached.
> In the JBoss console I get the following stack
> trace:
>
php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:28)
>
> Caused by: javax.naming.NoInitialContextException :
I think jsp and servlets have the same problem. I mean
there must be some jboss installation instructions
which probably state that one must copy the client jar
file(s) into the webapp class path, to the
WEB-INF/lib/ probably?
I'll check the classpath issue, please see PR 1432361
for details
(http://sourceforge.net/tracker/index.php?func=detail&aid=1432361&group_id=117793&atid=679233).
Thank you very much for the bug report.
However, I think it should be possible to add the
required .jar files to the webapp classpath, but I
have't tried it, yet. I will check the jboss
documentation and add a note to our j2ee sample
documentation for 3.0.8.
Regards,
Jost Boekemeier
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
|