HomeDocumentation > User's guide > Naming (JNDI) > JNDI

Global JNDI

In Geronimo 2.1 most accessible javaee objects are bound in global jndi automatically. Generally the names they are bound under can be adjusted if necessary by means of templates.

J2CA objects: ConnectionFactory, DataSource, AdminObject

All J2CA objects are now bound automatically into a global jndi context. Note that these objects can only be accessed in the geronimo vm. The default locations are under jca: and use a formatting pattern of

{groupId}/{artifactId}/{j2eeType}/{name}

where groupId and artifactId are from the module the j2ca object is deployed in, and the j2eeType and name are from the AbstractName or ObjectName identifying the object. j2eeType is normally JCAManagedConnectionFactory or JCAAdminObject. Note that although this format appears to specify a gbean such as a ManagedConnectionFactoryWrapper gbean what is actually obtained from jndi is what you get by calling the $getResource() method on this gbean, in this case a connection factory such as a DataSource. Similarly for a JCAAdminObject you are likely to get a Topic or Queue if you are working with a jms adapter such as that for ActiveMQ.

Customizing binding of J2CA Objects

You can customize which objects are bound and where they end up with these properties from var/config/config-substitutions.properties:

  • ResourceBindingsFormat default
    {groupId}/{artifactId}/{j2eeType}/{name}
    . Specify a format string. "variables" are enclosed in curly brackets
    {}
    and text outside these brackets is copied literally. You can use any component of the module artifact (groupId, artifactId, version, type) and any name-value pair in the object name as a variable.
  • ResourceBindingsNameInNamespace default jca: There seems to be a bug in xbean-naming that requires this to be different from any other nameInNamespace in a context gbean. So, java: doesn't seem to work
  • ResourceBindingsNamePattern default null. If set, a regexp matched against the name component of the object name to filter those object to be bound.
  • ResourceBindingsQuery default ?#org.apache.geronimo.naming.ResourceSource. This can also be used to filter which objects will be bound for instance
    ?j2eeType=JCAManagedConnectionFactory#org.apache.geronimo.naming.ResourceSource 
    will only bind DataSources and ConnectionFactories and not AdminObjects.

EJBs

All session and (ejb 2.1) entity beans are bound into global jndi automatically. Remote interfaces can be accessed from other vms. This is documented extensively at http://cwiki.apache.org/GMOxDEV/client-jndi-names.html