chetan
chetan

Reputation: 3255

javax.naming.NameNotFoundException in tomcat7

I am getting following error in tomcat7

error:

javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
        at org.apache.naming.resources.BaseDirContext.listBindings(BaseDirContext.java:733)
        at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:546)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

I am accessing content (classes and jsp file) by following entry inside server.xml file

<Host name="test" debug="0" appBase="path where classes and WEB-INF resides"
                unpackWARs="false" autoDeploy="false">

                <Logger className="org.apache.catalina.logger.FileLogger"
                    prefix="om_log." suffix=".log"
                    timestamp="true"/>

        <Context path="" docBase="path where classes and WEB-INF resides" debug="0"
               reloadable="false" crossContext="false" />
       </Host>

Upvotes: 1

Views: 3683

Answers (2)

Tushar Mishra
Tushar Mishra

Reputation: 1400

Assuming the structure of a web application as

TestApp -> WebContent -> WEB-INF
you may set docBase as shown below.

<Context path="/TestApp" docBase="C:/project/TestApp/webapp" debug="0"
           reloadable="false" crossContext="false" />

appBase="webapps"

The error arises when docBase is set to the context name only.

docBase="C:/project/TestApp"

Upvotes: 3

Heiko Rupp
Heiko Rupp

Reputation: 30944

That means that your .war file (in its zipped form) does not contain a directory WEB-INF which is meant to provide meta-data for the web-app such as e.g. web.xml . Or the classes directory within WEB-INF which holds the executable classes of your web-app (e.g. servlet code).

The directory name "WEB-INF" needs to be all uppercase. If you are on Windows, it may be that you have typed it in lower case, but windows zip utility shows it in upper case)

Upvotes: 0

Related Questions