I'm developing webapp on Tomcat 7. Everything works fine on my local version of Tomcat, but when I deploy it on production server, it throws this exception.
java.lang.VerifyError: (class: org/apache/commons/logging/impl/Log4JLogger, method: fatal signature: (Ljava/lang/Object;Ljava/lang/Throwable;)V) Incompatible object argument for function call
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595)
at java.lang.Class.getConstructor0(Class.java:2895)
at java.lang.Class.getConstructor(Class.java:1731)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.fop.apps.FopFactory.<clinit>(FopFactory.java:68)
at cz.soma.tomcat.generator.DokumentaceUtils.createPdfDocument(DokumentaceUtils.java:818)
at cz.soma.tomcat.generator.FileFactory.createPdfDocument(FileFactory.java:58)
at cz.soma.tomcat.generator.Generator.doPost(Generator.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
The error is thrown, when I try to FopFactory.newInstance();
(from Apache FOP 1.0). After that, it tries to LogFactory.getLog(FopFactory.class);
. It causes, that logClass.getConstructor(logConstructorSignature);
is called, where logConstructorSignature contains one String.class. (at least on my local machine)
try {
logConstructor = logClass.getConstructor(logConstructorSignature);
return (logConstructor);
} catch (Throwable t) {
throw new LogConfigurationException
("No suitable Log constructor " +
logConstructorSignature+ " for " + logClassName, t);
}
After this are called the java.lang.Class functions and thrown exception. Have you any idea, why the error is only thrown on production server, but not on my local machine?
java.lang.VerifyError would be the result when you have compiled against a different library than you are using at runtime(in your production server).
You can use commons-logging-1.1.1.jar
instead of commons-logging-1.0.4.jar
. Then rebuild your project and check.
Resource Link: http://www.java-samples.com/showtutorial.php?tutorialid=674
If you are using maven,then add this dependency in your pom.xml,
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
and remove the following dependency from your pom.xml
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
Resource Link: Getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory exception
templatetypedef has dig the issue and give 2 solutions
A VerifyError usually means that you loaded in a class file that is somehow malformed or which references another class file that has changed in a way that causes the code in another class file to no longer be valid. For example, if you compiled a class file that referenced a method in some other class, then independently modified and recompiled the second class after altering that method's signature, you'd get this sort of error.
I'd suggest doing a clean build and seeing if this issue goes away. If not, check whether you're using up-to-date JARs and source files.
Resource Link: https://stackoverflow.com/a/5411528/2293534
If your JDK version mismatch between local and production server, then make it same if possible. You may also try compiling with a different JDK version and on a different machine.
Resource Link: Causes of getting a java.lang.VerifyError
Hopefully it will help you.
You probably have a different version of the logging jars in the common lib directory on the production Tomcat server. Have someone check the \lib directory and see if there are any logging jars in the lib directory. Either remove those jars so your local app jars are used or make sure the same version of dependencies are being defined in your application.
If you want to try reproducing locally replicate the set of jars in the production lib directory to your local install.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With