如何解决“构建成功”但“你好世界!”不显示 - NetBeans
我使用的是 Apache NetBeans IDE 12.1 和 JDK 8。我使用 Maven > Web 应用程序项目创建了一个 Java,其中包含两个包,ejb 和 web。 ejb 包有一个 AccountManager 和一个 AccountManagerLocal。
客户经理:
@Stateless
public class AccountManager implements AccountManagerLocal {
@Override
public String ping() {
return "ping";
}
}
AccountManagerLocal:
@Local
public interface AccountManagerLocal {
String ping();
}
我在web包中创建了一个Servlet:
@WebServlet(name = "AccountManagerServlet",urlPatterns = {"/AccountManagerServlet"})
public class AccountManagerServlet extends HttpServlet {
@EJB
private AccountManagerLocal accountManager;
protected void processRequest(HttpServletRequest request,HttpServletResponse response)
throws servletexception,IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* Todo output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet AccountManagerServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet AccountManagerServlet at " + request.getcontextpath() + "</h1>");
out.println("<h3>Result of ping()</h3>");
out.println("<p>"+accountManager.ping()+"</p>");
out.println("</body>");
out.println("</html>");
}
}
@Override
protected void doGet(HttpServletRequest request,IOException {
processRequest(request,response);
}
@Override
protected void doPost(HttpServletRequest request,response);
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
我只想运行整个项目 > 形象化“Hello World!”页面打开 > 然后运行文件 AccountManagerServlet > 可视化页面中的变化。
但由于某种原因,什么也没有发生。
Scanning for projects...
--------------------< com.mycompany:AccountManager >--------------------
Building AccountManager-1.0-SNAPSHOT 1.0-SNAPSHOT
--------------------------------[ war ]---------------------------------
--- maven-dependency-plugin:2.6:copy (default) @ AccountManager ---
--- maven-resources-plugin:2.6:resources (default-resources) @ AccountManager ---
Using 'UTF-8' encoding to copy filtered resources.
copying 1 resource
--- maven-compiler-plugin:3.1:compile (default-compile) @ AccountManager ---
Changes detected - recompiling the module!
Compiling 5 source files to C:\Users\UserA\Documents\NetBeansprojects\AccountManager\target\classes
--- maven-resources-plugin:2.6:testResources (default-testResources) @ AccountManager ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\UserA\Documents\NetBeansprojects\AccountManager\src\test\resources
--- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ AccountManager ---
nothing to compile - all classes are up to date
--- maven-surefire-plugin:2.12.4:test (default-test) @ AccountManager ---
No tests to run.
--- maven-war-plugin:2.3:war (default-war) @ AccountManager ---
Packaging webapp
Assembling webapp [AccountManager] in [C:\Users\UserA\Documents\NetBeansprojects\AccountManager\target\AccountManager-1.0-SNAPSHOT]
Processing war project
copying webapp resources [C:\Users\UserA\Documents\NetBeansprojects\AccountManager\src\main\webapp]
Webapp assembled in [78 msecs]
Building war: C:\Users\UserA\Documents\NetBeansprojects\AccountManager\target\AccountManager-1.0-SNAPSHOT.war
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 5.881 s
Finished at: 2021-02-22T14:02:17Z
------------------------------------------------------------------------
deploying on GlassFish Server
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at C:\Users\UserA\Documents\NetBeansprojects\AccountManager\target\AccountManager-1.0-SNAPSHOT
GlassFish Server,deploy,null,false
我认为问题出在 GlassFish 上,但我不确定。我已经再次安装了 NetBeans,但问题仍然存在。有人可以帮我打开页面吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。