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 8552173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:21:53+00:00 2026-06-11T14:21:53+00:00

I have a Spring JMS application. Infact there is no UI. Just Spring configuration

  • 0

I have a Spring JMS application. Infact there is no UI. Just Spring configuration (JMS listener) and the Spring configuration is loaded by web.xml .
so when i deploy in server, the listener starts working.

But I do not want the web part, because, there no UI, It is just a project which listen to a Queue and do its processing. So I think it should be JAR and it should run standalone(or when i deploy in server) How to create such project/ JAR when deployed in server it automatically starts running. I do not want run a main class every time I update the JAR.

  • 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-06-11T14:21:55+00:00Added an answer on June 11, 2026 at 2:21 pm

    I have used an executable jar to launch a JMS queue before. You just have to make sure you have access to all the jar dependencies for Spring and JMS, which is a lot. This can be done by setting the classpath to point at the dependency jars or create an Uberjar and pack all the dependency jars in the executable jar.

    Here is an example class that will start up ActiveMQ from a Jar when you set it as a the main-class in the jar manifest. A jms.pid will be created with the process id for process. You must set the paths to your Spring contexts for JMS in the ConfigurableApplicationContext.

    public class Server {
    
        public static void main(String[] args) throws Exception {
    
            // Define Spring contexts required for JMS to run
            List<String> contexts = Arrays.asList( "classpath:applicationContext.xml", "classpath:spring/jmsContext.xml" );
            ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(contexts);
    
            // Get activeMQ from JMS context
            BrokerService broker = applicationContext.getBean( "broker" );
    
            // Start up activeMQ
            broker.start();
    
            // Get pid for this process
            String sysId = ManagementFactory.getRuntimeMXBean().getName();
            String pid = sysId.substring(0, sysId.indexOf("@"));
    
            // Write PID file
            File file = new File("jms.pid");
            DataOutputStream outs = new DataOutputStream(new FileOutputStream(file, false));
            outs.write(pid.getBytes());
            outs.close();
    
        }
    
    }
    

    Example Spring configuration for getting access to the BrokerService

    <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
        <property name="config" value="classpath:org/activemq/xbean/activemq.xml" />
        <property name="start" value="true" />
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Spring web application. I would like to put some common piece of
I have a Spring MVC web app running on my server. Recently I wanted
I have my web application written in Spring MVC. It is quite simple app
greetings all i have a web application using (spring-hibernate) frameworks and when tried to
I have successfully sent email in my web application using JMS, but the result
I have a Spring JMS listener that receives a BytesMessage/JMSBytesMessage. I want to convert
I have a java web application wired using Spring on Tomcat. I need a
I am trying to configure a JMS server (OpenJMS) into a Spring application and
I have a JMS Message Listener under JBoss 5.1, configured by Spring. Although the
I have a grails 1.3.7 application. I am making use of Spring's JMS classses

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.