jndiConnectionFactory,
jndiDestinationName,
portName);
if (!allStyles.contains(style))
throw new WSIFException("Style must either be queue or topic");
this.style = style;
if (portName == null)
portName = "<null>";
this.portName = portName;
if (((initialContextFactory == null) && (jndiProviderURL != null))
|| ((initialContextFactory != null) && (jndiProviderURL == null)))
throw new WSIFException(
"Either both initialContextFactory and jndiProviderURL "
+ "must be specified or neither of them must be specified. Port="
+ portName);
/*
* Go find the container's JNDI and the JNDI specified in the WSDL.
*/
if (initialContextFactory != null && jndiProviderURL != null) {
Hashtable environment = new Hashtable();
environment.put(
Context.INITIAL_CONTEXT_FACTORY,
initialContextFactory);
environment.put(Context.PROVIDER_URL, jndiProviderURL);
try {
namedJndiContext = new InitialDirContext(environment);
} catch (NamingException ne) {
Trc.exception(ne);
throw new WSIFException(
"WSIFJMSFinderForJndi caught '"
+ ne
+ "'. InitialContextFactory was '"
+ initialContextFactory
+ "' ProviderUrl was '"
+ jndiProviderURL
+ "'. Port="
+ portName);
}
}
try {
containersJndiContext = new InitialDirContext();
} catch (NamingException ne) {
Trc.exception(ne);
if (initialContextFactory == null && jndiProviderURL == null)
throw new WSIFException(
"WSIFJMSFinderForJndi caught '"
+ ne
+ "' using the default JNDI repository. Port="
+ portName);
}
if (STYLE_TOPIC.equals(style))
throw new WSIFException("Topics not implemented. Port=" + portName);
else if (!STYLE_QUEUE.equals(style))
throw new WSIFException(
"jms:address must either be a queue or a topic not a '"
+ (style == null ? "null" : style)
+ "'. Port="
+ portName);
/*
* Go find the queue connection factory.
*/
if (jndiConnectionFactory == null)
throw new WSIFException(
"jndiConnectionFactory must be specified in port " + portName);
try {
factory = (QueueConnectionFactory) lookup(jndiConnectionFactory);
if (factory == null)
throw new WSIFException(
"WSIFJMSFinderForJndi was not able to lookup the ConnectionFactory "
+ jndiConnectionFactory
+ " in JNDI. Port="
+ portName);
} catch (ClassCastException cce) {
Trc.exception(cce);
throw new WSIFException(
"WSIFJMSFinderForJndi caught ClassCastException. The ConnectionFactory "
+ jndiConnectionFactory
+ " in JNDI was not defined to be a connection factory. Port="
+ portName
+ " "
+ cce);
} catch (NamingException ne) {
Trc.exception(ne);
throw new WSIFException(
"WSIFJMSFinderForJndi caught NamingException. The ConnectionFactory "
+ jndiConnectionFactory
+ " in JNDI was not defined to be a connection factory. Port="
+ portName
+ " "
+ ne);
}
/*
* Go find the initial destination.
*/
if (jndiDestinationName != null)
try {
initialDestination = (Destination) lookup(jndiDestinationName);
if (initialDestination == null)
throw new WSIFException(
"WSIFJMSFinderForJndi was not able to lookup the Destination "
+ jndiDestinationName
+ " in JNDI. Port="
+ portName);
} catch (ClassCastException cce) {
Trc.exception(cce);
throw new WSIFException(
"WSIFJMSFinderForJndi caught ClassCastException. The Destination "
+ jndiDestinationName
+ " in JNDI was not defined to be a destination. Port="
+ portName
+ " "
+ cce);
} catch (NamingException cce) {
Trc.exception(cce);
throw new WSIFException(
"WSIFJMSFinderForJndi caught NamingException. The Destination "
+ jndiDestinationName
+ " in JNDI was not defined to be a destination. Port="
+ portName
+ " "