Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:32:29+00:00 2026-05-15T04:32:29+00:00

I use Spring-configured jms template with tibco jms library. I get jms connection factory

  • 0

I use Spring-configured jms template with tibco jms library.
I get jms connection factory and topic with JNDI and these objects are not null. But when I try to send message or add listener I get this exception:

For listener:

Exception in thread "main" org.springframework.jms.InvalidDestinationException: Can not send into foreign destinations; nested exception is javax.jms.InvalidDestinationException: Can not send into foreign destinations
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:277)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
    at org.springframework.jms.core.JmsTemplate.receiveSelected(JmsTemplate.java:700)
    at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:682)
    at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:674)

For sender:

Exception in thread "main" org.springframework.jms.InvalidDestinationException: Invalid or foreigndestination; nested exception is javax.jms.InvalidDestinationException: Invalid or foreigndestination
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:277)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:531)

Client app is working with the same topic without problems (so jms server is running). Do you have any ideas? I read about this exception in javadoc, but can’t find how to understand the root issue and fix it.
Thanks

UPD:
JMS-related part of config:

<bean id="JmsFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
          <property name="jndiName" value="${jms.factory}"/>
          <property name="proxyInterface" value="javax.jms.TopicConnectionFactory" />
          <property name="lookupOnStartup" value="false" />
          <property name="jndiEnvironment">
            <props>
              <prop key="java.naming.provider.url">${jms.namingProvider}</prop>
              <prop key="java.naming.factory.initial">${jms.namingFactory}</prop>
              <prop key="java.naming.referral">${jms.namingReferral}</prop>
              <prop key="java.naming.security.credentials">${jms.securityCredentials}</prop>
              <prop key="java.naming.security.principal">${jms.securityPrincipal}</prop>
            </props>
          </property>
      </bean>

        <bean id="JmsTopic" class="org.springframework.jndi.JndiObjectFactoryBean">
          <property name="jndiName" value="${jms.topic}"/>
          <property name="proxyInterface" value="javax.jms.Topic" />
          <property name="lookupOnStartup" value="false" />
          <property name="jndiEnvironment">
            <props>
              <prop key="java.naming.provider.url">${jms.namingProvider}</prop>
              <prop key="java.naming.factory.initial">${jms.namingFactory}</prop>
              <prop key="java.naming.referral">${jms.namingReferral}</prop>
              <prop key="java.naming.security.credentials">${jms.securityCredentials}</prop>
              <prop key="java.naming.security.principal">${jms.securityPrincipal}</prop>
            </props>
          </property>
      </bean>

      <bean id="UserCredentialsConnectionFactory"
        class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory">
          <ref bean="JmsFactory" />
        </property>
        <property name="username" value="${jms.user}" />
        <property name="password" value="${jms.password}" />
      </bean>

      <bean id="JmsTemplate"
        class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory"
          ref="UserCredentialsConnectionFactory" />
        <property name="defaultDestination">
            <ref bean="JmsTopic"/>
        </property>
        <property name="pubSubDomain" value="true" />
      </bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:32:30+00:00Added an answer on May 15, 2026 at 4:32 am

    It sounds like you have it configured so that it is attempting to create a destination rather than do a jndi lookup to get the destination that has been defined on the EMS instance.

    You need to post your spring config to be sure though.

    edit: if you set a destinationname on the JmsTemplate and provide it with a JndiDestinationResolver then it should work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We use Spring's JdbcTemplate which is configured through Spring config as illustrated below. Is
I'm trying to get my Portlets work with some DAO Objects which I configured
i want to use The Spring Security Facelets tag library to secure my UI
I have configured spring security with a ldap server (but continue reading, it's not
I use Hibernate (through JPA) configured by Spring and when I launch my application
as my question title, how to configure jms template at spring for weblogic? i
I currently have Spring configured to use HSQL, but I would like to use
I would like use from Spring.NET Aspect library Logging aspect together with log4Net. I
Hello guys I have configured a connection pool and JNDI resource in glassfish 2.1.
I use Spring MVC [version: 2.5] and Security[version: 2.0.4]. My problem looks like that:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.