0

我在 spring mvc 项目中集成 ccAvenue 支付网关,我在其中添加了以下 3 个文件 1. dataForm.html 2. ccavRequestHandler.jsp 3. ccavResponseHandler.jsp

当我单击支付按钮时,我的项目中有支付按钮,然后它在填写所有详细信息后重定向到 dataForm.html 页面我单击结帐按钮,然后它重定向到我收到以下错误的 ccavRequestHandler.jsp 页面

HTTP Status 500 - Unable to compile class for JSP:
type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 25 in the jsp file: /ccavRequestHandler.jsp
AesCryptUtil cannot be resolved to a type
22:           pvalue = request.getParameter(pname);
23:           ccaRequest = ccaRequest + pname + "=" + URLEncoder.encode(pvalue,"UTF-8") + "&";
24:      }
25:      AesCryptUtil aesUtil=new AesCryptUtil(workingKey);
26:      String encRequest = aesUtil.encrypt(ccaRequest);
27:     %>
28:     


An error occurred at line: 25 in the jsp file: /ccavRequestHandler.jsp
AesCryptUtil cannot be resolved to a type
22:           pvalue = request.getParameter(pname);
23:           ccaRequest = ccaRequest + pname + "=" + URLEncoder.encode(pvalue,"UTF-8") + "&";
24:      }
25:      AesCryptUtil aesUtil=new AesCryptUtil(workingKey);
26:      String encRequest = aesUtil.encrypt(ccaRequest);
27:     %>
28:     


Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

我的 ccavRequestHandler.jsp 文件:

<%@page import="java.net.URLEncoder"%>
<%
/*
   This is the sample Checkout Page JSP script. It can be directly used for integration with CCAvenue if your application is developed in JSP. You need to simply change the variables to match your variables as well as insert routines (if any) for handling a successful or unsuccessful transaction.
*/
%>
<%@ page import = "java.io.*,java.util.*,com.ccavenue.security.*" %>
<html>
<head>
    <title>Sub-merchant checkout page</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
    <%
     String accessCode= "";     //Put in the Access Code in quotes provided by CCAVENUES.
     String workingKey = "";    //Put in the 32 Bit Working Key provided by CCAVENUES.  
     Enumeration enumeration=request.getParameterNames();
     String ccaRequest="", pname="", pvalue="";
     while(enumeration.hasMoreElements()) {
          pname = ""+enumeration.nextElement();
          pvalue = request.getParameter(pname);
          ccaRequest = ccaRequest + pname + "=" + URLEncoder.encode(pvalue,"UTF-8") + "&";
     }
     AesCryptUtil aesUtil=new AesCryptUtil(workingKey);
     String encRequest = aesUtil.encrypt(ccaRequest);
    %>

    <form id="nonseamless" method="post" name="redirect" action="https://secure.ccavenue.com/transaction.do?command=initiateTransaction"/> 
        <input type="hidden" id="encRequest" name="encRequest" value="<%= encRequest %>">
        <input type="hidden" name="access_code" id="access_code" value="<%= accessCode %>">
        <script language='javascript'>document.redirect.submit();</script>
    </form>

 </body> 
</html>
4

2 回答 2

2

对于 Maven 项目:

第 1 步:添加ccavutil.jar项目/lib目录

第二步:进入项目根目录,打开终端

第 3 步:运行以下命令:

mvn install:install-file -Dfile=lib\\ccavutil.jar -DgroupId=com.ccavenue.java -DartifactId=ccavenue-java -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true

第 4 步:在 pom.xml 中添加以下内容:

<!-- CCAvenue utils -->
<dependency>
    <groupId>com.ccavenue.java</groupId>
    <artifactId>ccavenue-java</artifactId>
    <version>2.0</version>
</dependency>

第 5 步:在您的 java 文件中添加 AesCryptUtil 的导入

import com.ccavenue.security.AesCryptUtil;
于 2020-10-19T13:40:57.550 回答
0

放入tomcat目录并重启ccavutil.jar服务器/lib

于 2020-10-15T09:51:34.553 回答