Neel Neel - 1 year ago 85
Java Question

Error on running tomcat server in Eclipse

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.get(
at org.apache.catalina.core.ContainerBase.startInternal(
at org.apache.catalina.core.StandardHost.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase$
at org.apache.catalina.core.ContainerBase$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ProductEngine]]
at org.apache.catalina.util.LifecycleBase.start(
... 6 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(
at java.lang.Class.getDeclaredFields(
at org.apache.catalina.util.Introspection.getDeclaredFields(
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(
at org.apache.catalina.startup.ContextConfig.configureStart(
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
... 20 more

Update: my pom.xml is as below and it does not have provided state

enter image description here

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download