gpt4 book ai didi

eclipse - java.lang.ClassNotFoundException : com. ebank.rajeev.controller.Login 登录

转载 作者:行者123 更新时间:2023-11-28 23:59:47 24 4
gpt4 key购买 nike

我在 eclipse 控制台上遇到这个错误,

java.lang.ClassNotFoundException: com.ebank.rajeev.controllers.Alogin
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:120)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

在运行 jsp 页面时,tomcat 说HTTP 状态 404 -类型状态报告信息描述请求的资源不可用。

我的代码是正确的。我仍然找不到办法。

网络.xml

<servlet-mapping>
<servlet-name>Alogin</servlet-name>
<url-pattern>/Alogin</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>Alogin</display-name>
<servlet-name>Alogin</servlet-name>
<servlet-class>com.ebank.rajeev.controllers.Alogin</servlet-class>
</servlet>

管理.jsp

<form method="post" action="Alogin">
<div>
<input type="password" name="uname" placeholder="username" />
<input type="password" name="pwd" placeholder="password" />
<input type="submit" id="search-submit" value="Login" /><br />
</div>
</form>

登录servlet

String uname=request.getParameter("uname");
String pwd=request.getParameter("pwd");
if(uname.equals("admin") && pwd.equals("admin"))
{
HttpSession session=request.getSession();
session.setAttribute("UNAME",uname);
response.sendRedirect("AdminHome.jsp");
}
else
{
response.sendRedirect("admin.jsp?msg=invalid");
}

Java 构建路径具有所需的 jar 文件,即 servlet-api.jarjsp-api.jarmysql-connector.jar。我为此页面使用了任何 sql 代码,它仍然给出错误。

最佳答案

转到 Project Properties 和 Deployment Descriptor,添加 Java Build path entries 和对源文件夹的引用,通常是 /src/main/resourcesWEB-INF/classes。执行 ProjectClean 并重新启动服务器。

关于eclipse - java.lang.ClassNotFoundException : com. ebank.rajeev.controller.Login 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32794732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com