'The import org.apache.commons.lang3 compilation error

I am trying to change my Java code from commons.lang to commons.lang3. So I did the below changes to my code and try to build it. But I am getting an error message. It would be great if someone can guide me on the way I need to change the code and about the jar I need to download.

before code

<%@ page import="org.apache.commons.lang.StringEscapeUtils"%>

firstname = StringEscapeUtils.escapeHtml(user.getFirstName());

Code change to add lang3

<%@ page import="org.apache.commons.lang3.StringEscapeUtils"%>

firstname = StringEscapeUtils.escapeHtml4(user.getFirstName());

Now I am getting below error

weblogic.utils.compiler.ToolFailureException: jspc failed with errors :weblogic.servlet.jsp.CompilationException: studentData.jsp:7:18: The import org.apache.commons.lang3 cannot be resolved
<%@ page import="org.apache.commons.lang3.StringEscapeUtils"%>

                 ^----------------------------------------^
studentData.jsp:148:21: StringEscapeUtils cannot be resolved
                                                                firstname = StringEscapeUtils.escapeHtml4(user.getFirstName());


Solution 1:[1]

Make sure your webapp has the correct commons-lang in WEB-INF/lib. The file you need is part of https://dlcdn.apache.org//commons/lang/binaries/commons-lang3-3.12.0-bin.zip and has the name commons-lang3-3.12.jar. In case you have an older version of commons-lang still in that folder, remove it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hiran Chaudhuri