繁体   English   中英

无法加载EJB模块

[英]Unable to load EJB module

我正在参加企业应用程序开发课程。 我是JSF的新手。 我正在尝试使用GlassF 3.1使用JSF和Netbeans IDE部署我的应用程序。

我得到的错误如下所示。

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.

以下是我对EJB的引用。

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

任何帮助,将不胜感激。

编辑:这是一个Java Web应用程序。

编辑战争文件结构树

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

我的文件在teh xhtml文档中没有EJB标记。 它有下面列出的内容。

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

web.xml web-app属性版本更改为2.5或更高版本可解决此问题。

更新了web.xml的 web-app元素,

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

所以你有web应用程序,它不是ejb-jar,它的web模块可以打包到*.war存档。
结构应该是

  • *的.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 / - 包中的编译类
  • * .war / WEB-INF / lib / - libs
  • * .war / index.jsp - 主页

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>  

如果你使用的是Maven ,你可以使用maven-war-plugin

原来问题是SQL语句中的拼写错误(1和l [小写L]),我需要对项目进行“清理和构建”。 感谢那些努力帮助我解决问题的人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM