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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:16:38+00:00 2026-05-24T21:16:38+00:00

This is my first foray into using JMS. I have a successfully created/deployed a

  • 0

This is my first foray into using JMS. I have a successfully created/deployed a war file that contains a servlet that I can use to upload files. When a file is uploaded it sends a message to a JMS queue. Next I wrote a listener to retrieve the uploaded messages from the queue, but when I try to deploy it, I get this error:

SEVERE: Invalid ejb jar [file-listener-ejb-1.0.jar]: it contains zero ejb. 
Note: 
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-  driven bean. 
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar. 
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
    at    com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:76)
...<snip>...

It’s a very simple project with one class, built using Maven. The class looks like this:

package my.package;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@MessageDriven(mappedName = "jms/FileUploadedQueue", activationConfig = {
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
public class FileListener implements MessageListener
{
    private static Logger log = LoggerFactory.getLogger(FileListener.class);

    public FileListener()
    {
        // empty constructor
    }

    public void onMessage(Message message)
    {
        try
        {
            log.info("Received message: " + ((TextMessage)message).getText());
        }
        catch (JMSException ex)
        {
            String error = "Received error code '"
                    + ex.getErrorCode()
                    + "' retrieving message from queue jms/FileUploadedQueue.";

            Exception linkedEx = ex.getLinkedException();

            if (linkedEx != null)
            {
                log.error(error += "Linked exception: ", linkedEx);
            }
            else
            {
                log.error(error, linkedEx);
            }
        }
    }
}

My pom.xml looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.package</groupId>
    <artifactId>uploaded-file-listener</artifactId>
    <version>1.0</version>
    <packaging>ejb</packaging>
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.4.2</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>                
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

This builds a jar file which when I try to deploy to my Glassfish 3.1 server (via the admin console) results in the above error.

Since I have the @MessageDriven annotation on my class, I’m not sure what I’m doing wrong. Unfortunately, the server.log file does not contain any more details about the error.

Should I be packaging the jar in an ear and deploying that?

———-EDIT———-

I created an ear which includes the ejb jar, and I get the same error when I deploy the ear to Glassfish. So, I think it must be something to do with the annotation. However, I’ve looked at multiple examples/tutorials and I can’t see what’s wrong.

Any insights/suggestions would be most welcome!!

———-EDIT TWO———-

Contents of MANIFEST.MF files:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: <name>
Build-Jdk: 1.6.0_24

Contents of application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
  <display-name>FileListener-ear</display-name>
  <module>
    <ejb>file-listener-ejb-1.0.jar</ejb>
  </module>
</application>

———-EDIT THREE———-

Contents of ejb-jar file:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
    version="3.1">
    <display-name>FileListener</display-name>
    <enterprise-beans>
        <message-driven>
            <ejb-name>FileListener</ejb-name>
            <ejb-class>my.package.FileListener</ejb-class>
            <transaction-type>Container</transaction-type>
        </message-driven>
    </enterprise-beans>
</ejb-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-05-24T21:16:39+00:00Added an answer on May 24, 2026 at 9:16 pm

    Does your jar file contain an ejb-jar.xml file? If it was missing, then it could explain why the whole thing explodes upon deploy

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

Sidebar

Related Questions

This is my first foray into using an MVC construct (CodeIgniter). I'm hoping someone
My first foray into writing jQuery functions. I have this function, but I'm not
My first real foray into using PHP OOP and PDO extensively. I have finally
Using Dozer to map two objects, I have: /** /* This first class uses
#include <iostream> using namespace std; // This first class contains a vector and a
I'm a (near complete) beginner, and this is my first foray into encryption -
I am following this tutorial as a first foray into bootloader/OS development for x86
This is my first foray into designing two versions of images for retina or
This is my first foray into shell scripting so if i'm asking a very
I've worked with CakePHP 1.3, but this is my first foray into CakePHP 2.0

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.