java.lang.Objectorg.apache.log4j.AppenderSkeleton
org.apache.log4j.net.JMSAppender
All Implemented Interfaces:
OptionHandler, Appender
JMS topics and topic factories are administered objects that are retrieved using JNDI messaging which in turn requires the retreival of a JNDI Context .
There are two common methods for retrieving a JNDI Context . If a file resource named jndi.properties is available to the JNDI API, it will use the information found therein to retrieve an initial JNDI context. To obtain an initial context, your code will simply call:
InitialContext jndiContext = new InitialContext();
Calling the no-argument InitialContext() method
will also work from within Enterprise Java Beans (EJBs) because it
is part of the EJB contract for application servers to provide each
bean an environment naming context (ENC).
In the second approach, several predetermined properties are set
and these properties are passed to the InitialContext
contructor to connect to the naming service provider. For example,
to connect to JBoss naming service one would write:
Properties env = new Properties( ); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "jnp://hostname:1099"); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); InitialContext jndiContext = new InitialContext(env);where hostname is the host where the JBoss applicaiton server is running.
To connect to the the naming service of Weblogic application server one would write:
Properties env = new Properties( ); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL, "t3://localhost:7001"); InitialContext jndiContext = new InitialContext(env);
Other JMS providers will obviously require different values.
The initial JNDI context can be obtained by calling the
no-argument InitialContext() method in EJBs. Only
clients running in a separate JVM need to be concerned about the
jndi.properties file and calling InitialContext#InitialContext() or alternatively correctly
setting the different properties before calling InitialContext#InitialContext(java.util.Hashtable) method.
Ceki - Gülcü| Field Summary | ||
|---|---|---|
| String | securityPrincipalName | |
| String | securityCredentials | |
| String | initialContextFactoryName | |
| String | urlPkgPrefixes | |
| String | providerURL | |
| String | topicBindingName | |
| String | tcfBindingName | |
| String | userName | |
| String | password | |
| boolean | locationInfo | |
| TopicConnection | topicConnection | |
| TopicSession | topicSession | |
| TopicPublisher | topicPublisher | |
| Fields inherited from org.apache.log4j.AppenderSkeleton: |
|---|
| layout, name, threshold, errorHandler, headFilter, tailFilter, closed |
| Constructor: |
|---|
|
| Methods from org.apache.log4j.AppenderSkeleton: |
|---|
| activateOptions, addFilter, append, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.log4j.net.JMSAppender Detail: |
|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JMSAppender instance to use the InitialContext#InitialContext(Hashtable) method instead of the
no-argument constructor. If you set this option, you should also
at least set the ProviderURL option.
See also #setProviderURL(String) . |
|
|
|
|
|
Topic from the JNDI context. |
TopicConnectionFactory from the JNDI context. |
|
|