0

Recently I deployed an app to Tomcat Server. It's not working because the app can't find the Servlet. I thought the servlet-class in web.xml was okay but apparently the syntax/mapping is wrong since they cant find it...

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)
Bic Mitchun
  • 478
  • 2
  • 9
  • 21

1 Answers1

0

It's not working because the app can't find the Servlet.

Wrong.

javax.naming.NameNotFoundException: Name [controller.ControllerServlet/categoryFacade] is not bound in this Context. Unable to find [controller.ControllerServlet].

It can't find the name controller.ControllerServlet in the naming resources Somewhere you are using java:comp/.../controller.ControllerServlet/categoryFacade.

I suggest you look into where you are using categoryFacade for a start.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • I like your answer man. I tested few fixes like adding this ` ControllerServlet /controller ` see if it can find the name... Without succes... What do you mean by looking where I'm using `categoryFacade`? You mean the directory? Because I checked the directory.. I just dont know what you are suggesting to check? – Bic Mitchun Jun 09 '15 at 05:49
  • Something somewhere is trying to lookup `controller.ControllerServlet/categoryFacade` as a JNDI name. Possibly it's an annotation in your servlet. Scan your entire source code for that string, or for just `categoryFacade`. – user207421 Jun 09 '15 at 07:25