summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms-runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
index 61080516b3..c0f063d377 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
@@ -128,10 +128,14 @@ public class JMSResourceFactoryImpl implements JMSResourceFactory {
}
protected void createConnection() throws NamingException, JMSException {
- ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(connectionFactoryName);
- if (connectionFactory == null) {
+ Object o = jndiLookUp(connectionFactoryName);
+ if (o == null) {
throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
}
+ if (!(o instanceof ConnectionFactory)) {
+ throw new JMSBindingException("JNDI resource '" + connectionFactoryName +"' is not a JMS ConnectionFactory");
+ }
+ ConnectionFactory connectionFactory = (ConnectionFactory)o;
connection = connectionFactory.createConnection();
}