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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:24:03+00:00 2026-05-14T01:24:03+00:00

The problem is taht I get the following error qhile deploying my project to

  • 0

The problem is taht I get the following error qhile deploying my project to Glassfish:

java.lang.RuntimeException: Unable to load EJB module.  DeploymentContext does not contain any EJB  Check archive to ensure correct packaging

But, let us start on how the project structure looks like in Maven2…

I’ve build the following scenario:

MultiModuleJavaEEProject – parent module
-> model —> packaged as jar
-> ejb1 —-> packaged as ebj
-> ejb2 —-> packaged as ebj
-> web —-> packaged as war

So model, ejb1, ejb2 and web are children/modules of the parent MultiModuleJavaEEProject.

_ejb1 depends on model.
_ejb2 depends on ejb1.
_web depends on ejb2.

the pom’s look like:

_parent:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.dyndns.geraldhuber.testing</groupId>
  <artifactId>MultiModuleJavaEEProject</artifactId>
  <packaging>pom</packaging>
  <version>1.0</version>
  <name>MultiModuleJavaEEProject</name>
  <url>http://maven.apache.org</url>

  <modules>
    <module>model</module>
    <module>ejb1</module>
    <module>ejb2</module>
    <module>web</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                    <jarName>${project.groupId}.${project.artifactId}-${project.version}</jarName>
                </configuration>
            </plugin>
        </plugins>

    </pluginManagement>
  </build>

</project>

_model:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>testing</groupId>
    <artifactId>MultiModuleJavaEEProject</artifactId>
    <version>1.0</version>
  </parent>

  <artifactId>model</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>model</name>
  <url>http://maven.apache.org</url>
</project>

_ejb1:

  <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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>testing</groupId>
    <artifactId>MultiModuleJavaEEProject</artifactId>
    <version>1.0</version>
  </parent>

  <artifactId>ejb1</artifactId>
  <packaging>ejb</packaging>
  <version>1.0</version>
  <name>ejb1</name>
  <url>http://maven.apache.org</url>

  <dependencies>
     <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.ejb</artifactId>
      <version>3.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>testing</groupId>
      <artifactId>model</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
</project>

_ejb2:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>testing</groupId>
    <artifactId>MultiModuleJavaEEProject</artifactId>
    <version>1.0</version>
  </parent>

  <artifactId>ejb2</artifactId>
  <packaging>ejb</packaging>
  <version>1.0</version>
  <name>ejb2</name>
  <url>http://maven.apache.org</url>

  <dependencies>
     <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.ejb</artifactId>
      <version>3.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>testing</groupId>
      <artifactId>ejb1</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
</project>

_web:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>MultiModuleJavaEEProject</artifactId>
    <groupId>testing</groupId>
    <version>1.0</version>
  </parent>
  <groupId>testing</groupId>
  <artifactId>web</artifactId>
  <version>1.0</version>
  <packaging>war</packaging>
  <name>web Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency> 
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.ejb</artifactId>
      <version>3.0</version>
      <scope>provided</scope>
    </dependency>


    <dependency>
      <groupId>testing</groupId>
      <artifactId>ejb2</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>


    <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
    <finalName>web</finalName>
  </build>  
</project>

And the model is just a simple Pojo:

package testing.model;
public class Data {
    private String data;
    public String getData() {
        return data;
    }
    public void setData(String data) {
        this.data = data;
    }
}

And the ejb1 contains only one STATELESS ejb.

package testing.ejb1;

import javax.ejb.Stateless;
import testing.model.Data;

@Stateless
public class DataService {
    private Data data;
    public DataService(){
        data = new Data();
        data.setData("Hello World!");
    }
    public String getDataText(){
        return data.getData();
    }
}

As well as the ejb2 is only a stateless ejb:

package testing.ejb2;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import testing.ejb1.DataService;

@Stateless
public class Service {
    @EJB
    DataService service;

    public Service(){

    }
    public String getText(){
        return service.getDataText();
    }
}

And the web module contains only a Servlet:

package testing.web;

import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import testing.ejb2.Service;

public class SimpleServlet extends HttpServlet {

    @EJB
    Service service;

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws ServletException, IOException {

        PrintWriter out = response.getWriter();
        out.println( "SimpleServlet Executed" );
        out.println( "Text: "+service.getText() );
        out.flush();
        out.close();
    }
}

And the web.xml file in the web module looks like:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
  <servlet>
    <servlet-name>simple</servlet-name>
    <servlet-class>testing.web.SimpleServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>simple</servlet-name>
    <url-pattern>/simple</url-pattern>
  </servlet-mapping>
</web-app>

So no further files are set up by me. There is no ejb-jar.xml in any ejb files, because I’m using EJB 3.1. So I think ejb-jar.xml descriptors are optional. I this right?
But the problem is, the already mentioned error:

java.lang.RuntimeException: Unable to load EJB module.  DeploymentContext does not contain any EJB  Check archive to ensure correct packaging

Can anybody help?

  • 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-14T01:24:03+00:00Added an answer on May 14, 2026 at 1:24 am

    I don’t know why you have a web.xml (instead of using annotations)… But if you really want to, change this:

    <!DOCTYPE web-app PUBLIC
     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd" >
    

    Into this:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app 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/web-app_3_0.xsd"
    version="3.0">
      <display-name>Archetype Created Web Application</display-name>
      ...
    </web-app>
    

    And rebuild/redeploy.

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

Sidebar

Related Questions

Problem: Following error is arising if I use NavigatorContent in Repeater. Is there a
Problem! I Have the following input (rules) from a flat file (talking about numeric
Problem: I wrote a hello world java program, compiled and created a jar file
Problem: I need to get a random element for a container and also delete
Problem: I need somehow to checkout an existing branch of a project that is
Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text
Problem Consider the following class template <typename T> struct A { T x; };
Problem: -- I have a VS 2005 Report Server project with many reports. --
Problem description is here : http://www.spoj.pl/problems/FASHION/ Process : Took two lists as input ,
Problem Why would compiling a program which has an int main(void) main function differ

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.