I have been working on a code on my computer and imported that code on other machine. But when I deploy code and run it on the other machine, tomcat doesn't start properly and throws error.
web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Try</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description>Apache CXF Endpoint</description>
<display-name>cxf</display-name>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/ *</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/jaxrs/*</url-pattern>
</servlet-mapping>
</web-app>
Console Logs:
Jan 11, 2017 1:33:12 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Try' did not find a matching property. Jan 11, 2017 1:33:12 AM org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat/8.0.39
SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Try]] at java.util.concurrent.FutureTask.report(FutureTask.java:122)Blockquote
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Try]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) ... 6 more Caused by: java.lang.IllegalArgumentException: Unable to create an instance of type [com.sun.faces.config.ConfigureListener] at org.apache.catalina.core.ApplicationContext.addListener
Caused by: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
I have tried other solutions for the same problem on Stack Exchange. But nothing works for me.
It seems that the causing class
com.sun.faces.config.ConfigureListener
is present in your computer but not in the target machine. This class usually belongs tojsf-impl.jar
orjsf-ri.jar
libraries.Since you are deploying the same war (I assume) on both machines, that libraries are obivously not into the war, so they are likely to be into your computer's Tomcat runtime: Look for it in directory
<tomcat>/lib
and copy it into the target machine's Tomcat lib directory.