The java:comp/env context is a special read-only context available to J2EE
components that is local to one component. The only information that can
be in there is what you have specified in the deployment descriptors. Use
a different binding name like just "factories/ObjectFactory"
xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
From: Dan Berger
To: [EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 7:01 PM
Subject: [JBoss-user] Binding objects into JNDI
Greetings.
I'm writing in the hopes that someone on this list can straighten me out on
something - I'm trying to write non app-server specific code, deployable as
part of a .ear, to bind an object into the JNDI tree and I'm having a devil
of a time.
I've read just about everything I can get my hands on - including the JNDI
tutorial at Sun - and so far, no dice.
I've even sifted through the jboss code a bit hoping to glean the secrets
from it - and still, no progress.
To be more specific - what I want to do is allow a factory object to bind
itself into the JNDI tree during ear deployment - so that application code
in that ear can do something like this:
Context ctx = new InitialContext();
ObjectFactory = ( ObjectFactory ) obj.lookup(
"java:/comp/env/factories/ObjectFactory" );
CreatedObject = ObjectFactory.newInstance( "someArg" );
Where ObjectFactory is just a run-of-the-mill Java class.
I've tried various things - including having ObjectFactory implement
Serializable, Referenceable, and even ObjectFactory. I've tried (re)binding
it into the tree from a static block and from a servlet/jsp. In either
case, I get an exception "Factory not bound."
I've tried adding a jndi.properties file to the jar containing the class -
only to discover (by code inspection) that JBoss only looks for
jndi.properties files once - on startup; not on each application deployment.
Any suggestions or examples would be greatly appreciated.
Cheers.
--
Dan Berger [[EMAIL PROTECTED]]
"We are what we repeatedly do. Excellence, then, is not an act,
but a habit."
-- Aristotle
"It comes in pints?!"
-- Pippin
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user