albert kao
2017-09-15 12:04:57 UTC
I created a hello-world.war from the struts-examples-master.zip from
https://github.com/apache/struts-examples.
Clicking the 'Hello World' link got the url:
http://localhost:8080/hello-world/hello.action;jsessionid=8EEA47306A76BAE87F665C6090D518E3
which display:
HTTP Status 500 - Filter execution threw an exception
type Exception report
message Filter execution threw an exception
description The server encountered an internal error that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception
root cause
java.lang.NoSuchMethodError:
org.apache.commons.lang3.reflect.MethodUtils.getAnnotation(Ljava/lang/reflect/Method;Ljava/lang/Class;ZZ)Ljava/lang/annotation/Annotation;
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
...
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143)
note The full stack trace of the root cause is available in the Apache
Tomcat (TomEE)/8.5.11 (7.0.3) logs.
Apache Tomcat (TomEE)/8.5.11 (7.0.3)
Therefore the war file has a dependency to struts 2.5.12 which has (not
optional) dependency to commons lang3 3.6.
The war file directory structure is:
hello-world/WEB-INF/lib/commons-lang3-3.6.jar
I add following line to catalina.sh:
set "JAVA_OPTS=-XX:+TraceClassLoading -XX:+TraceClassUnloading"
then do:
catalina.sh run > my_tomcat.log 2>&1
then finally search my_tomcat.log for MethodUtils
my_tomcat.log has this line:
[Loaded org.apache.commons.lang3.reflect.MethodUtils from
file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-lang3-3.5.jar]
i.e. tomee 7.0.3 loads commons-lang3-3.5.jar.
How to load commons-lang3-3.6.jar from web-inf/lib of a war file using
tomee 7.0.3?
https://github.com/apache/struts-examples.
Clicking the 'Hello World' link got the url:
http://localhost:8080/hello-world/hello.action;jsessionid=8EEA47306A76BAE87F665C6090D518E3
which display:
HTTP Status 500 - Filter execution threw an exception
type Exception report
message Filter execution threw an exception
description The server encountered an internal error that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception
root cause
java.lang.NoSuchMethodError:
org.apache.commons.lang3.reflect.MethodUtils.getAnnotation(Ljava/lang/reflect/Method;Ljava/lang/Class;ZZ)Ljava/lang/annotation/Annotation;
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
...
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143)
note The full stack trace of the root cause is available in the Apache
Tomcat (TomEE)/8.5.11 (7.0.3) logs.
Apache Tomcat (TomEE)/8.5.11 (7.0.3)
Therefore the war file has a dependency to struts 2.5.12 which has (not
optional) dependency to commons lang3 3.6.
The war file directory structure is:
hello-world/WEB-INF/lib/commons-lang3-3.6.jar
I add following line to catalina.sh:
set "JAVA_OPTS=-XX:+TraceClassLoading -XX:+TraceClassUnloading"
then do:
catalina.sh run > my_tomcat.log 2>&1
then finally search my_tomcat.log for MethodUtils
my_tomcat.log has this line:
[Loaded org.apache.commons.lang3.reflect.MethodUtils from
file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-lang3-3.5.jar]
i.e. tomee 7.0.3 loads commons-lang3-3.5.jar.
How to load commons-lang3-3.6.jar from web-inf/lib of a war file using
tomee 7.0.3?