struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From albert kao <albertk...@gmail.com>
Subject Re: Clicking helloworld link got java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.MethodUtils.getAnnotation
Date Tue, 05 Sep 2017 11:21:36 GMT
I tried
export
CLASSPATH=$JAVA_HOME/lib:$HOME/Struts2/struts-2.5.12/lib:$CATALINA_HOME/lib:$CLASSPATH:.

but the helloworld link in index.jsp still did not see the
/home/alkao/Struts2/struts-2.5.12/lib/commons-lang3-3.6.jar.


my_tomcat.log did not have this line any more
[Loaded org.apache.commons.lang3.reflect.MethodUtils from
file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-lang3-3.5.jar]


It had lines such as:
[Loaded org.apache.commons.lang3.text.StrLookup from
file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-lang3-3.5.jar]
[Loaded org.apache.commons.lang3.CharSequenceUtils from
file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-lang3-3.5.jar]
...


On Mon, Sep 4, 2017 at 1:30 PM, Yasser Zamani <yasser.zamani@live.com>
wrote:

> >> Although I had done the following:
> >> export
> >> CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$HOME/Struts2/struts-
> 2.5.12/lib:$CATALINA_HOME/lib:.
>
> If you would like to solve it like above, I think you may try below
> instead ($CLASSPATH at end):
>
> export
> CLASSPATH=$JAVA_HOME/lib:$HOME/Struts2/struts-2.5.12/
> lib:$CATALINA_HOME/lib:.:$CLASSPATH
>
> On 9/4/2017 5:24 PM, albert kao wrote:
> > As per your instruction, modify catalina.sh:
> > JAVA_OPTS="$JAVA_OPTS
> > -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
> > -XX:+TraceClassLoading -XX:+TraceClassUnloading"
> >
> > $ catalina.sh run > my_tomcat.log 2>&1
> >
> > my_tomcat.log:
> > [Loaded org.apache.commons.lang3.reflect.MethodUtils from
> > file:/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/commons-
> lang3-3.5.jar]
> >
> > Although I had done the following:
> > export
> > CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$HOME/Struts2/struts-
> 2.5.12/lib:$CATALINA_HOME/lib:.
> >
> > $ ls /home/alkao/Struts2/struts-2.5.12/lib/commons-lang3*
> > /home/alkao/Struts2/struts-2.5.12/lib/commons-lang3-3.6.jar
> >
> > Therefore the helloworld link in index.jsp did not see the
> > /home/alkao/Struts2/struts-2.5.12/lib/commons-lang3-3.6.jar.
> >
> >
> > On Sat, Sep 2, 2017 at 2:46 PM, Yasser Zamani <yasser.zamani@live.com>
> > wrote:
> >
> >> I did as you said and did not get any exception!
> >>
> >> Could you please add following line to catalina.bat:
> >>
> >> set "JAVA_OPTS=-XX:+TraceClassLoading -XX:+TraceClassUnloading"
> >>
> >> then:
> >>
> >> catalina.bat run > my_tomcat.log 2>&1
> >>
> >> then finally search my_tomcat.log for MethodUtils?
> >>
> >> I would like to see from where your tomcat load MethodUtils class!
> >>
> >>
> >> On 9/2/2017 7:06 PM, albert kao wrote:
> >>> My hello-world.war has the commons lang3 3.6:
> >>> hello-world/WEB-INF/lib
> >>> hello-world/WEB-INF/lib/commons-fileupload-1.3.3.jar
> >>> hello-world/WEB-INF/lib/ognl-3.1.12.jar
> >>> hello-world/WEB-INF/lib/struts2-core-2.5.12.jar
> >>> hello-world/WEB-INF/lib/freemarker-2.3.23.jar
> >>> hello-world/WEB-INF/lib/log4j-core-2.8.2.jar
> >>> hello-world/WEB-INF/lib/log4j-api-2.8.2.jar
> >>> hello-world/WEB-INF/lib/commons-io-2.4.jar
> >>> hello-world/WEB-INF/lib/javassist-3.20.0-GA.jar
> >>> hello-world/WEB-INF/lib/commons-lang3-3.6.jar
> >>>
> >>> However, the helloworld link in index.jsp did not see it.
> >>>
> >>>
> >>> On Sat, Aug 26, 2017 at 7:43 PM, Yasser Zamani <yasser.zamani@live.com
> >
> >>> wrote:
> >>>
> >>>> I checked it's codes and seems ok. It has a dependency to struts
> 2.5.12
> >>>> which has (not optional) dependency to commons lang3 3.6. So you
> should
> >>>> have commons lang3 3.6 in your war lib. Do you? Or maybe you have
> lower
> >>>> version of commons lang3 jar in your tomcat lib? Please check both.
> >>>>
> >>>> albert kao <albertkao3@gmail.com> نوشت:
> >>>>
> >>>>> I downloaded struts-examples-master.zip from
> >>>>> https://github.com/apache/struts-examples.
> >>>>> Unzip it and run mvn.
> >>>>>
> >>>>> # mvn -version
> >>>>> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
> >>>>> 2015-11-10T11:41:47-05:00)
> >>>>> Maven home: /home/alkao/maven/apache-maven-3.3.9
> >>>>> Java version: 1.8.0_131, vendor: Oracle Corporation
> >>>>> Java home: /home/alkao/jdk/jdk1.8.0_131/jre
> >>>>> Default locale: en_CA, platform encoding: UTF-8
> >>>>> OS name: "linux", version: "4.4.0-21-generic", arch: "i386", family:
> >>>> "unix"
> >>>>>
> >>>>>
> >>>>> $ mvn -e clean package
> >>>>> [INFO] Error stacktraces are turned on.
> >>>>> [INFO] Scanning for projects...
> >>>>> [WARNING]
> >>>>> [WARNING] Some problems were encountered while building the effective
> >>>> model
> >>>>> for org.apache.struts:annotations:war:1.0.0
> >>>>> [WARNING] The expression ${artifactId} is deprecated. Please use
> >>>>> ${project.artifactId} instead.
> >>>>> [WARNING]
> >>>>> ...
> >>>>> [WARNING]
> >>>>> [WARNING] It is highly recommended to fix these problems because
they
> >>>>> threaten the stability of your build.
> >>>>> [WARNING]
> >>>>> [WARNING] For this reason, future Maven versions might no longer
> >> support
> >>>>> building such malformed projects.
> >>>>> [WARNING]
> >>>>> [INFO]
> >>>>> ------------------------------------------------------------
> >> ------------
> >>>>> [INFO] Reactor Build Order:
> >>>>> [INFO]
> >>>>> ...
> >>>>> [INFO] Building Action chaining 1.0-SNAPSHOT
> >>>>> [INFO]
> >>>>> ------------------------------------------------------------
> >> ------------
> >>>>> Downloading:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom
> >>>>> Downloaded:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom
> >>>>> (12 KB at 21.7 KB/sec)
> >>>>> Downloading:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-plugins/27/maven-plugins-27.pom
> >>>>> Downloaded:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-plugins/27/maven-plugins-27.pom
> >>>>> (0 B at 0.0 KB/sec)
> >>>>> Downloading:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> maven-parent/26/maven-parent-26.pom
> >>>>> Downloaded:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> maven-parent/26/maven-parent-26.pom
> >>>>> (0 B at 0.0 KB/sec)
> >>>>> Downloading:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar
> >>>>> Downloaded:
> >>>>> https://repo.maven.apache.org/maven2/org/apache/maven/
> >>>> plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar
> >>>>> (46 KB at 415.4 KB/sec)
> >>>>> Downloading:
> >>>>> https://repository.apache.org/content/groups/public/org/
> >>>> apache/struts/struts2-core/2.5.12/struts2-core-2.5.12.pom
> >>>>> Downloaded:
> >>>>> https://repository.apache.org/content/groups/public/org/
> >>>> apache/struts/struts2-core/2.5.12/struts2-core-2.5.12.pom
> >>>>> (17 KB at 30.1 KB/sec)
> >>>>> ...
> >>>>> [INFO]
> >>>>> ------------------------------------------------------------
> >> ------------
> >>>>> [INFO] BUILD SUCCESS
> >>>>> ...
> >>>>>
> >>>>>
> >>>>>
> >>>>> Copy hello-world.war to Apache TomEE:
> >>>>> # cp helloworld/target/hello-world.war $CATALINA_HOME/webapps/.
> >>>>>
> >>>>>
> >>>>> In a browser accessing URL:
> >>>>> http://localhost:8080/hello-world/index.jsp
> >>>>>
> >>>>>
> >>>>> which display:
> >>>>> "Welcome To Struts 2!
> >>>>>
> >>>>> Hello World"
> >>>>>
> >>>>>
> >>>>>
> >>>>> Then 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.
> >> AnnotationValidationIntercepto
> >>>> r.doIntercept(AnnotationValidationInterceptor.java:47)
> >>>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.
> intercept(
> >>>> MethodFilterInterceptor.java:98)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.
> >>>> doIntercept(ConversionErrorInterceptor.java:139)
> >>>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.
> intercept(
> >>>> MethodFilterInterceptor.java:98)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor.
> doIntercept(
> >>>> ParametersInterceptor.java:134)
> >>>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.
> intercept(
> >>>> MethodFilterInterceptor.java:98)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ParametersInterceptor.
> doIntercept(
> >>>> ParametersInterceptor.java:134)
> >>>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.
> intercept(
> >>>> MethodFilterInterceptor.java:98)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.
> >>>> intercept(StaticParametersInterceptor.java:199)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.MultiselectInterceptor.intercept(
> >>>> MultiselectInterceptor.java:69)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(
> >>>> DateTextFieldInterceptor.java:115)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.CheckboxInterceptor.intercept(
> >>>> CheckboxInterceptor.java:88)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.FileUploadInterceptor.intercept(
> >>>> FileUploadInterceptor.java:246)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.
> intercept(
> >>>> ModelDrivenInterceptor.java:99)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.
> >>>> intercept(ScopedModelDrivenInterceptor.java:139)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(
> >>>> ChainingInterceptor.java:157)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(
> >>>> PrepareInterceptor.java:174)
> >>>>> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.
> intercept(
> >>>> MethodFilterInterceptor.java:98)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.I18nInterceptor.
> >> intercept(I18nInterceptor.
> >>>> java:123)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(
> >>>> ServletConfigInterceptor.java:171)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.AliasInterceptor.
> >>>> intercept(AliasInterceptor.java:201)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.
> >>>> intercept(ExceptionMappingInterceptor.java:193)
> >>>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(
> >>>> DefaultActionInvocation.java:247)
> >>>>> org.apache.struts2.factory.StrutsActionProxy.execute(
> >>>> StrutsActionProxy.java:53)
> >>>>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(
> >> Dispatcher.java:
> >>>> 577)
> >>>>> org.apache.struts2.dispatcher.ExecuteOperations.executeAction(
> >>>> ExecuteOperations.java:81)
> >>>>> 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)
> >>>>
> >>>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message