I think I’m having a problem with the classpath or included libraries or something of that sort. I’m using the latest version of eclipse and myeclipse and I use WebLogic 9.
In a servlet, I’ve successfully implemented Triple DES encryption, but when I try to move the code to a JSP file, I run into problems:
My imports in the Servlet look like this:
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import sun.misc.*;
In the JSP they look like this:
<%@ page import=”javax.crypto.Cipher” %>
<%@ page import=”javax.crypto.SecretKey” %>
<%@ page import=”sun.misc.*” %>
The error occurs on the following line:
java.security.Security.addProvider(new com.sun.crypto.provider.SunJCE());
The error occurs on JSP precompiling, but the code runs successfully in the servlet.
The error I receive is this:
weblogic.servlet.jsp.CompilationException: connector.jsp:89:66: Package com.sun.crypto.provider contains no member type of this name.
java.security.Security.addProvider(new com.sun.crypto.provider.SunJCE());
^—-^
Based upon the ^—-^ it is referring to the “SunJCE()”.
Why does this deploy and run properly as a servlet, but not as a JSP file. I’m thinking this has something to do with the order of class files and something extra that must get included (or needs to be included) when a JSP pre-compiles…
Thank you.