facebook

Encryption in a JSP file.

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #246407 Reply

    hayedid
    Member

    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.

    #246448 Reply

    Riyad Kalla
    Member

    Does this JSP validate in MyEclipse? What version of Java do you see if you drop to a console and type “java -version”? What version of Java are you using to run WebLogic 9?

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Encryption in a JSP file.

You must be logged in to post in the forum log in