1

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.

cello
  • 5,356
  • 3
  • 23
  • 28
Abhijeet Panwar
  • 1,837
  • 3
  • 26
  • 48
  • Possible duplicate of [java.lang.ClassNotFoundException : com.sun.faces.config.ConfigureListener](http://stackoverflow.com/questions/10848341/java-lang-classnotfoundexception-com-sun-faces-config-configurelistener) – Arnaud Jan 10 '17 at 09:21
  • @Berger : I am not using jsf and 'Mojarra' is not in my web.xml. – Abhijeet Panwar Jan 10 '17 at 09:22
  • `com.sun.faces.config.ConfigureListener` is a JSF class, something uses it on your server . – Arnaud Jan 10 '17 at 09:24
  • Same code had been working previously. Could't find any reference to com.sun.faces.config.ConfigureListener in source code. – Abhijeet Panwar Jan 10 '17 at 09:27
  • Still have a look at the above topic, download the jars and put them where the accepted answer says. Maybe one server has this in its libs, and the other one doesn't. – Arnaud Jan 10 '17 at 09:29

2 Answers2

0

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 to jsf-impl.jar or jsf-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.

Little Santi
  • 8,563
  • 2
  • 18
  • 46
0

I have fixed this problem on server.xml file. where we defined <Context docBase="path" path="/" reloadable="true"/> on server.xml file so I just removed this while tomcat unpack war.

On path your project content will be there like web.xml file, classes, and lib(jars) etc.