Where is jndi.properties file




















Email Required, but never shown. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? Featured on Meta. Now live: A fully responsive profile. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

Accept all cookies Customize settings. Once you have the jndi. The easiest way is to add jndi. When new InitialContext is called, it will scan the resources and find the file. If you get javax. NamingException , it usually means the jndi. You can also try to create a new initial context using either an instance of properties file or a map.

For example, the approach recommended by JMS specification will work just fine. For the easiest possible configuration with JNDI based programs, there are two dynamic contexts, namely:. For this see How do I embed a Broker inside a Connection. For more information about the available options, see Chapter 5, Configuration options. For example, the following is a connection URI that connects to host example. When failover is configured, the client can reconnect to another server automatically if the connection to the current server is lost.

Additional options are specified at the end. For example, the following is a failover URI that can connect to either of two hosts, host1 or host2 :. As with the connection URI example, the client can be configured with a number of different settings using the URI in a failover configuration. These settings are detailed in Chapter 5, Configuration options , with the Section 5. The SNI extension is automatically included if a fully qualified domain name for example, "myhost.

If the class is not in a package, the resource's name is simply jndiprovider. A provider can put properties that are specific to its service within the provider resource file, but it can also override the standard environment properties.

The following standard JNDI environment properties can be set in the provider resource file and override any value already set for the property:. The JNDI library will consult the provider resource file when determining the values of these properties. The provider might not allow you to set certain properties here.

Check the provider's documentation to determine which properties can be set in the provider specific resource file. Application resource files are text files that are in the java.

These files can be located within the application classpath and will be automatically picked up. The JNDI class libraries will locate these files using one of the getResources methods defined in the java. ClassLoader class. JNDI will automatically read the jndi. If you are using Java 1. You can have multiple jndi. JNDI then makes these properties from the application resource files available to the service providers and other components that need to use them.

Because the system will load the files automatically, application resource files should be considered world-readable and should not contain sensitive information, such as clear-text passwords. When the jndi.

You can now replace the code that used a Hashtable of environment properties and passed them to the constructor of the InitialContext with just the call to the default no-argument constructor of the InitialContext.

The following line shows what this would look like:. Notice that we didn't have to provide any environment properties to the InitialContext. They would be picked up from the jndi. This makes your code much more portable.

You don't have to change any source code when any of the environment properties need to be modified. You can also configure the JNDI for all applications and applets that use the same Java interpreter and keep the properties in one place.

That way, you have to make changes in only a single location.



0コメント

  • 1000 / 1000