最近我向Tomcat Server部署了一个应用程序。它无法正常工作,因为应用无法找到Servlet。我认为web.xml
中的servlet类是可以的,但显然语法/映射是错误的,因为它们找不到它......
的web.xml
<servlet>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>controller.ControllerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
catalina.log
INFO myapp.com-startStop-2 org.apache.catalina.startup.HostConfig - Deployment of web application archive /home/username/tomcat/webapps/myapp.com/ROOT.war has finished in 442 ms
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]] org.apache.catalina.startup.HostConfig - Reloading context []
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]] org.apache.catalina.core.StandardContext - Reloading Context with name [] has started
INFO ContainerBackgroundProcessor[StandardEngine[Catalina]] org.apache.catalina.core.ContainerBase.[Catalina].[myapp.com].[/] - Marking servlet ControllerServlet as unavailable
ERROR ContainerBackgroundProcessor[StandardEngine[Catalina]] org.apache.catalina.core.ContainerBase.[Catalina].[myapp.com].[/] - Servlet threw load() exception
javax.naming.NameNotFoundException: Name [controller.ControllerServlet/categoryFacade] is not bound in this Context. Unable to find [controller.ControllerServlet].
at org.apache.naming.NamingContext.lookup(NamingContext.java:818)
at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
at org.apache.catalina.core.DefaultInstanceManager.lookupFieldResource(DefaultInstanceManager.java:603)
at org.apache.catalina.core.DefaultInstanceManager.processAnnotations(DefaultInstanceManager.java:491)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:174)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4923)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5209)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3775)
at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1307)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1290)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1474)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1141)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
它无法正常工作,因为应用无法找到Servlet。
错误。
javax.naming.NameNotFoundException: Name [controller.ControllerServlet/categoryFacade] is not bound in this Context. Unable to find [controller.ControllerServlet].
在命名资源中找不到名称 controller.ControllerServlet
您使用的地方java:comp/.../controller.ControllerServlet/categoryFacade
。
我建议您先查看使用categoryFacade
的位置。