Showing posts with label Document base ... does not exist. Show all posts
Showing posts with label Document base ... does not exist. Show all posts

Sunday, 16 September 2012

Document base ... does not exist or is not a readable directory

I am having problems trying to get a simple Spring Controller to run on Tomcat 7.0 on kubuntu. I am using maven.

Error 


Sep 17, 2012 12:08:14 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /home/prayag/jdk1.6.0_23/jre/lib/i386/client:/home/prayag/jdk1.6.0_23/jre/lib/i386:/home/prayag/jdk1.6.0_23/jre/../lib/i386:/home/prayag/jdk1.6.0_23/jre/lib/i386/client:/home/prayag/jdk1.6.0_23/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib
Sep 17, 2012 12:08:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:RestServer' did not find a matching property.
Sep 17, 2012 12:08:15 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 17, 2012 12:08:15 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 17, 2012 12:08:15 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 641 ms
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/prayag/workspace_java/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/RestServer does not exist or is not a readable directory
 at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
 at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4814)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4994)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
 at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
 at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error in resourceStart()
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Sep 17, 2012 12:08:15 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/RestServer] startup failed due to previous errors
Sep 17, 2012 12:08:15 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 17, 2012 12:08:15 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 17, 2012 12:08:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 371 ms



DIAGNOSIS
Hack 1 : Check eclipse .metadata/.plugins
prayag@Prayag:~$ ls -la /home/prayag/workspace_java/.metadata/.plugins/org.eclipse.wst.server.core

total 32
drwxrwxrwx  3 prayag prayag 4096 Nov 27 11:22 .
drwxrwxrwx 98 prayag prayag 4096 Nov 26 16:48 ..
-rwxrwxrwx  1 prayag prayag  424 Sep 25 17:44 modules.xml
-rwxrwxrwx  1 prayag prayag   67 Nov 22 14:56 monitors.xml
drwxrwxrwx  2 prayag prayag 4096 Nov 27 11:22 publish
-rwxrwxrwx  1 prayag prayag   71 Nov 27 11:22 publish.xml
-rwxrwxrwx  1 prayag prayag   66 Nov 27 11:22 servers.xml
-rwxrwxrwx  1 prayag prayag   75 Nov 27 11:22 tmp-data.xml



Hack 2 :  Check .project file

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>RestServer</name>
  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
  <projects/>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.m2e.core.maven2Builder</name>
    </buildCommand>
    <buildCommand>
      <name>org.springframework.ide.eclipse.core.springbuilder</name>
    </buildCommand>
    <buildCommand>
      <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.springframework.ide.eclipse.core.springnature</nature>
    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
  </natures>
</projectDescription>


Hack 3 : Check eclipse workspace Servers folder
prayag@Prayag:~/workspace_java$ ls -la Servers/
total 16
drwxrwxr-x  3 prayag prayag 4096 Nov 27 11:22 .
drwxrwxr-x 16 prayag prayag 4096 Nov 27 10:31 ..
-rw-rw-r--  1 prayag prayag  200 May 11  2012 .project
drwxrwxr-x  2 prayag prayag 4096 Nov 26 16:46 .settings

Check .project file inside Servers folder
prayag@Prayag:~/workspace_java$ sudo vi Servers/.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
        <name>Servers</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
        </buildSpec>
        <natures>
        </natures>
</projectDescription>


Solution
prayag@Prayag:~/workspace_java$ rm -rf Servers/

restart server

References
Unable to “Run on Server” a webapp from Eclipse, available at http://stackoverflow.com/a/12292469/432903

Problem running simple Servlet on Tomcat, at http://www.coderanch.com/t/86668/Tomcat/running-simple-Servlet-Tomcat