10

I am trying to run a war file via Tomcat in Eclipse. But, when I am trying to run it, I am getting the following error in Server console:

Aug 2, 2013 4:06:58 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/Users/kajarigd/J2EEProject/eclipse/Eclipse.app/Contents/MacOS/lib], exists: [false], isDirectory: [false], canRead: [false]
Aug 2, 2013 4:06:58 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/Users/kajarigd/J2EEProject/eclipse/Eclipse.app/Contents/MacOS/lib], exists: [false], isDirectory: [false], canRead: [false]
Aug 2, 2013 4:06:58 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/Users/kajarigd/J2EEProject/eclipse/Eclipse.app/Contents/MacOS/lib], exists: [false], isDirectory: [false], canRead: [false]
Aug 2, 2013 4:06:58 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/Users/kajarigd/J2EEProject/eclipse/Eclipse.app/Contents/MacOS/lib], exists: [false], isDirectory: [false], canRead: [false]
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:236)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:426)

Please let me know how to solve this.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
kajarigd
  • 1,299
  • 3
  • 28
  • 46
  • how do you run the war via Tomcat in Eclipse? – yair Aug 01 '13 at 22:59
  • I am right-clicking on the war. Then selecting Run As Configuration. In the configuration I am setting Apache Tomcat. – kajarigd Aug 01 '13 at 23:07
  • I have created a maven project and imported it to Eclipse. In the target folder I have the war file. But when I am trying to Add/Remove resource in Tomcat, it is saying "there are no resources that can be added or removed from the server". – kajarigd Aug 01 '13 at 23:14
  • Your project should be created as a Dynamic Web Project. Since your project is already created, you should add the Dynamic Web Module facet to it (right-click the project --> Properties --> Project Facets --> check the Dynamic Web Module facet --> OK). – yair Aug 01 '13 at 23:39
  • I changed it as suggested by you. Now Tomcat is starting fine. But I am getting 404 error when trying to open the resource file. – kajarigd Aug 02 '13 at 00:41
  • OK let's separate here the questions... Your first question was about `ClassNotFoundException` when starting Tomcat in Eclipse. I'll move my comment to an official answer. Solving the 404 error justifies a separate question in which you should elaborate on the way you access that resource etc (which might well have nothing to do with Eclipse). – yair Aug 02 '13 at 00:48

1 Answers1

8

Your project should be created as a Dynamic Web Project.

Since your project is already created, you should add the Dynamic Web Module facet to it.

Right-click the project --> Properties --> Project Facets --> check the Dynamic Web Module facet --> OK.

yair
  • 8,945
  • 4
  • 31
  • 50