Thanks - I had tried binding into other places in the tree - but thanks to your encouragement (i.e. you didn't say "you can't do that!") I kept at it, and managed to get things working this morning.
I have three more related questions, however, which perhaps someone here can answer. The object in question looks (something) like this: public class ObjectFactory extends Serializable { public Object newInstance( String className ) { return Class.forName( className ).newInstance(); } static { try { Context context = new InitialContext(); System.out.println( "attempting rebind..." ); context.rebind( "ObjectFactory", new DefaultObjectFactory() ); System.out.println( "rebind sucessful..." ); } catch ( NamingException e ) { System.out.println( "rebind failed: " + e.getMessage() ); } } } my test code (a jsp deployed in an ear) just does this: // tickle the classloader and get the static block to execute. ObjectFactory of = new ObjectFactory(); // ... ObjectFactory factory = context.lookup( "ObjectFactory" ); So the questions are: 1. I wanted to setup a res-ref in the jboss-web.xml to map the bound location (java:/EntityFactory) to something under comp/env - the ref gets built, but when I try to dereference it, after tickling the static block, I get a [ERROR,Default] javax.naming.NameNotFoundException: EntityFactory not bound I suspect this is a chicken-egg problem - but was wondering if anyone could confirm that for me. 2. I have a simple JNDI viewer in JSP - it list's a specified context, grabs the NameClassPairs and spits them out in a table. I deployed this jsp in the same WAR (contained in the same EAR) as the object factory - but EntityFactory never appears in it's list - and I thought it should/would. Am I barking up the wrong tree? 3. And the hard one - is there a way, without resorting to an auto-loaded servlet who's job in life is to register all the factories (either by adding a registerFactory() method to the interface and calling it, or by instantiating the classes and causing the static blocks to execute), to make sure these factories are bound into JNDI when the application is deployed? On Fri, 2002-02-01 at 08:12, [EMAIL PROTECTED] wrote: Message: 4 Reply-To: "Scott M Stark" <[EMAIL PROTECTED]> From: "Scott M Stark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: Re: [JBoss-user] Binding objects into JNDI Date: Thu, 31 Jan 2002 22:36:50 -0800 Organization: JBoss Group 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 -- 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