2012-09-13 2 views
9

Sto frequentando un corso in Enterprise Application Development. Sono nuovo di JSF. Sto provando a distribuire la mia app usando Glassfish 3.1 usando JSF e Netbeans IDE.Impossibile caricare il modulo EJB

L'errore che ottengo è elencato di seguito.

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.

Qui di seguito sono i riferimenti per EJB ho fatto.

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

Qualsiasi aiuto sarebbe apprezzato.

MODIFICA: Questa è un'applicazione Web Java.

EDIT GUERRA FILE struttura ad albero

  • META-INF/MANIFEST.MF
  • WEB-INF/classes
  • WEB-INF/lib/primefaces-2.1.1.jar
  • WEB-INF/web.xml
  • index.shtml

Il mio file non ha un tag EJB nel documento xhtml. ha ciò che è elencato di seguito.

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

+0

postale più codice e vaso struttura – Ilya

+0

non riesco a ottenere la struttura di directory in un formato lista. – jslamka

risposta

1

In modo da avere applicazione web, non è ejb-jar, è il modulo web che sould essere packeged a *.war archivio.
struttura dovrebbe essere

  • * .war/META-INF/persistence.xml
  • * .war/META-INF/MANIFEST.MF
  • * .war/WEB-INF/sole-web .xml
  • * .war/WEB-INF/web.xml
  • * .war/WEB-INF/classes/- classi compilate in pacchetti
  • * .war/WEB-INF/lib/- libs
  • * .war/index.jsp - home page

esempio di 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> 

se si utilizza Maven, è possibile utilizzare maven-war-plugin

+0

Ho provato a sostituire l'html con ejb-jar e questo non ha funzionato. Probabilmente non farlo bene però. – jslamka

+0

Sto usando Facelets e GlassFish. So che non sto usando Maven. – jslamka

1

scopre il problema era un errore di battitura in un'istruzione SQL (1 e l [minuscolo L]) e avevo bisogno di fare un "Clean and build" sul progetto. Grazie per coloro che si sono sforzati di aiutarmi a risolvere il mio problema.

6

Cambiare la versione attributo web.xmlweb-app-2.5 o superiore risolto questo problema.

Elemento web-app aggiornato di web.xml sarà,

<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">