How to load commons-lang3-3.6.jar from web-inf/lib of a war file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to load commons-lang3-3.6.jar from web-inf/lib of a war file

albert kao
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?
Reply | Threaded
Open this post in threaded view
|

R: How to load commons-lang3-3.6.jar from web-inf/lib of a war file

Piercarlo Alberto Beghetto - Diennea
Any update on this issue?

Commons-lang3 is currently at version 3.7 but tomee still have reference to 3.5.

Is there any configuration file we can manage to force the load of the updated library for tomee?

P.


Piercarlo Alberto Beghetto
Analyst Developer @ Diennea - MagNews
Tel.: (+39) 0546 066100 - Int. 967
Viale G.Marconi 30/14 - 48018 Faenza (RA)
-----Messaggio originale-----
Da: albert kao [mailto:[hidden email]]
Inviato: venerdì 15 settembre 2017 14:05
A: [hidden email]
Oggetto: How to load commons-lang3-3.6.jar from web-inf/lib of a war file

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?

________________________________

Iscriviti alla nostra newsletter per rimanere aggiornato su digital ed email marketing! http://www.magnews.it/newsletter/

The information in this email is confidential and may be legally privileged. If you are not the intended recipient please notify the sender immediately and destroy this email. Any unauthorized, direct or indirect, disclosure, copying, storage, distribution or other use is strictly forbidden.