Reputation: 11741
I am so new in Java and I have cloned one project from Gitlab and imported it into Eclipse.
I also added tomcat server and also set properties for project as well as for tomcat server.
I have currently 2 projects added in Eclipse and one is working fine but another is failing. I have changed ports for server of another project.
It looks like some files are missing?
I have gone through many answers here but none helped.
But upon running second project, I am getting below errors:
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Nov 15, 2016 7:41:27 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 411 ms
Nov 15, 2016 7:41:27 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 15, 2016 7:41:27 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.72
Nov 15, 2016 7:41:27 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ProductEngine]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1119)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ProductEngine]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
... 6 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:63)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:417)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:891)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
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.StandardContext.startInternal(StandardContext.java:5522)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
... 20 more
Update: my pom.xml is as below and it does not have provided state
Upvotes: 0
Views: 1494
Reputation: 1047
It seems the Java Common Logging
lib is on provided scope in your project.
Either you modify the pom.xml to remove the "provided" scope, or you put the common logging JAR in your tomcat lib
directory. I would suggest you to use the first possibility
Edit: After talking will Neel, the problem was that the maven project wasn't exactly well set up. Indeed, Eclipse was not deploying the maven dependencies while deploying the project on Tomcat.
So the way to solve this is:
right click on project > deployment assembly > Add > Java Build path entry > Maven dependencies
Upvotes: 1
Reputation: 394
Right click on your project, Maven -> Update project. Then you have to select your project and update it.
If you don't see the "Maven" option when right clicking on the project, you have to do this: Right click on your project, Configure -> Convert to Maven Project.
Hope it helps.
Upvotes: 0