Does anyone know exactly what javax.jms.InvalidDestinationException: Not allowed to create destination means?

Michael W picture Michael W · Aug 1, 2011 · Viewed 22.9k times · Source

I am try to connect to a Tibco Ems Topic using Spring when I recieve this error.

Here is the config:

    <jms:listener-container connection-factory="Tcf"    acknowledge="auto" >
    <jms:listener id="ListenerContainer" destination="######" ref="MessageListener" />
</jms:listener-container>

<bean id="MessageListener" class="com.dcc.jms.listeners.TestListener"></bean>


<!-- JNDI Template --> 
<bean id="JndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.provider.url">#</prop>
            <prop key="java.naming.factory.url.pkgs">com.sun.jndi.ldap </prop>
            <prop key="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop>
        </props>
    </property>
</bean>

<!-- CONNECTION FACTORY -->
<bean id="Tcf"
    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    <property name="username" value="" />
    <property name="password" value="" />
    <property name="targetConnectionFactory">
        <bean class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiTemplate" ref="JndiTemplate" />
            <property name="jndiName" value="#" />
        </bean>
    </property>
</bean>

What exactly does this mean? Are my details or my config wrong?

Answer

strmqm picture strmqm · Aug 1, 2011

The JMS specification defines it as

This exception must be thrown when a destination either is not understood by a provider or is no longer valid.

Typically it means that the name of the Destination is invalid, e.g. the parameter passed to

Session.createQueue(String qName)

(edit: or defined in JNDI) does not meet provider naming conventions or does not exist, occasionally it can be used for other reasons (e.g. attempting to use a TemporaryQueue that has been closed off). I'd double-check your config to make sure you've specified the correct name, most likely there's an error in there somewhere and/or you're trying something that doesn't match EMS conventions.