jslamka
jslamka

Reputation: 261

Unable to load EJB module

I am taking a course in Enterprise Application Development. I am new to JSF. I am trying to deploy my app using Glassfish 3.1 using JSF and Netbeans IDE.

The error I get is listed below.

Error occurred during deployment: Exception while preparing the app : Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for F:\Seagate\docs backup\NetBeansProjects\ent-app-dev\Slamka_Project1\build\web. If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected. Please see server.log for more details.

Below are the references to EJB I have made.

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ejb.EJB;
@EJB

Any help would be appreciated.

EDIT: This is a Java Web Application.

EDIT WAR FILE STRUCTURE TREE

My file does not have an EJB tag in teh xhtml document. it has what is listed below.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsf/core">

Upvotes: 11

Views: 21550

Answers (3)

rnsammeta
rnsammeta

Reputation: 61

Changing the web.xml web-app attribute version to 2.5 or higher resolved this issue.

Updated web-app element of web.xml will be,

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

Upvotes: 6

jslamka
jslamka

Reputation: 261

Turns out the issue was a typo in a SQL statement (1 and l [lower case L]) and I needed to do a "Clean and build" on the project. Thank you for those who put effort into helping me solve my issue.

Upvotes: 1

Ilya
Ilya

Reputation: 29673

So you have web application, it's not ejb-jar, it's web module that sould be packeged to *.war archive.
Structure should be

  • *.war/META-INF/persistence.xml
  • *.war/META-INF/MANIFEST.MF
  • *.war/WEB-INF/sun-web.xml
  • *.war/WEB-INF/web.xml
  • *.war/WEB-INF/classes/ - compiled classes in packages
  • *.war/WEB-INF/lib/ - libs
  • *.war/index.jsp - home page

example of sun-web.xml

<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app>
  <context-root>/app</context-root>
</sun-web-app>  

if you are using Maven, you can use maven-war-plugin

Upvotes: 1

Related Questions