class ReferencablePoolingDataSource extends PoolingDataSource implements Referenceable
and the exception goes away.
Tomcat initializas its JNDI tree using a Reference and a ObjectFactory, that's also a way to do it.
-- Dirk
Fumo, Vince wrote:
I'm trying to register a valid PoolingDataSource in JNDI using the following method and code:
private final static String INITIAL_CONTEXT_FACTORY = "com.sun.jndi.fscontext.RefFSContextFactory"; private final static String FACTORY_URL = "file:/D:/jndi";
public static void register(PoolingDataSource datasource, String bindName) throws Exception { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); env.put(Context.PROVIDER_URL, FACTORY_URL); Context context = null; try { context = new InitialContext(env); } catch (NamingException e) { String msg = "Could not initialize the context : " + e.getMessage();; _log.error(msg); e.printStackTrace(); throw new Exception(msg); } try { context.rebind(bindName, datasource); } catch (NamingException e) { String msg = "Could not bind the datasource : " + e.getMessage(); _log.error(msg); e.printStackTrace(); throw new Exception(msg); } }
The problem happens with the call to context.rebind. Apparantly JNDI is complaining as follows:
javax.naming.OperationNotSupportedException: Can only bind References or Referenceable objects at com.sun.jndi.fscontext.RefFSContext.addObjectToBindings(RefFSContext.java:47 9) at com.sun.jndi.fscontext.RefFSContext.bindObject(RefFSContext.java:337) at com.sun.jndi.fscontext.RefFSContext.rebind(RefFSContext.java:189) at com.sun.jndi.fscontext.FSContext.rebind(FSContext.java:194) at javax.naming.InitialContext.rebind(Unknown Source)
Any ideas on what's wrong?
Vincent Fumo Software Engineer ACS State and Local Solutions Government Systems
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
