Re: Clicking helloworld link got java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.MethodUtils.getAnnotation
>> 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> 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 >>> 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 نوشت: > 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/
Re: Clicking helloworld link got java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.MethodUtils.getAnnotation
So as I guessed at first, you have `commons-lang3-3.5.jar` in your tomee lib directory (/home/alkao/tomee/apache-tomee-plus-7.0.3/lib/) which has precedence to be loaded before jars in your app's lib folder! i.e. you will have commons-lang3-3.5 loaded rather than 3.6. Unfortunately, with some efforts, I could not find any solution on net to tell tomee to also load commons-lang3-3.6.jar from webapp/web-inf/lib :( please continue at [1] for any solution. [1] mailto:users-subscr...@tomee.apache.org 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> 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 >>> 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 نوشت: > 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/
Re: Clicking helloworld link got java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.MethodUtils.getAnnotation
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 Zamaniwrote: > 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 > > 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 نوشت: > >> > >>> 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/ > >>