无法处理部署的POST_MODULE阶段

时间:2014-11-25 15:39:35

标签: java servlets jboss

我在jboss中部署了一个简单的Web应用程序,其中包含一个servlet,一个jsp文件和一个easy EJB。这是servlet的代码:

package webejb;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ejb.Convert;
import java.math.BigDecimal;

import javax.ejb.EJB;
import javax.servlet.ServletException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



public class test extends HttpServlet {
private static final long serialVersionUID = 1L;
@EJB(name = "ejb/Convert")
private Convert converter;   
/**
 * @see HttpServlet#HttpServlet()
 */
public test() {
    super();
    // TODO Auto-generated constructor stub
}

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    String amount = request.getParameter("amount");
    if (amount != null && amount.length() > 0) {
        BigDecimal d = new BigDecimal(amount);
        BigDecimal rupeeAmount = converter.dollarToRupees(d);
        out.println("<p>" + amount + " Dollars are " + rupeeAmount + " Rupees.<p>");
        BigDecimal euroAmount = converter.rupeesToEuro(rupeeAmount);
        out.println(amount + " Dollars are " + euroAmount + " Euro.");
    }
}

当我在类的开头包含注释@WebServlet(“/ test”)时,得到此错误:

10:12:21,253 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870:
Deploy of deployment "WebEJB.war" was rolled back with failure message {"JBAS014671:
Failed services" => {"jboss.deployment.unit.\"WebEJB.war\".POST_MODULE" => 
"org.jboss.msc.service.StartException in service jboss.deployment.unit.\"WebEJB.war
\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"WebEJB.war\""}}

当擦除注释时,不要让我部署应用程序。

1 个答案:

答案 0 :(得分:0)

我已经发现了我的错误。问题是我不知道我必须使用WAr端EJB部署EAR。