views:

207

answers:

1

Is it possible to add a custom object (String or URL) to JNDI using Weblogic Server Administration Console (Weblogic 10.0) or by editing server's configuration file (config.xml)?

+1  A: 

I don't think so. Quoting Load objects in the JNDI tree:

Using the Administration Console, you can load WebLogic Server J2EE services and components, such as RMI, JMS, EJBs, and JDBC Data Sources, in the JNDI tree.

And indeed, I couldn't find a way to add a String or URL using the console.

AFAIK, the standard way is to put an env-entry in your deployment descriptor (web.xml, ejb-jar.xml):

<env-entry>
    <env-entry-name>string/foo</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>foobar</env-entry-value>
</env-entry>

<env-entry>
    <env-entry-name>url/bar</env-entry-name>
    <env-entry-type>java.net.URL</env-entry-type>
    <env-entry-value>http://foobar/&lt;/env-entry-value&gt;
</env-entry>
Pascal Thivent
But if I put it in web.xml any change will require rebuild and redeploy. It's strange, that I can put JDBC configuration on server, so that changes don't require rebuilding, but I can't put my custom variables (eg. password to mail account, which can't be configured in mail session) there and need to keep them in my application.
Tadeusz Kopec