问题
I'm developing AuthSample
example using chase-paymentech
Java SDK
named as 'PaymentechSDK.jar'
version 7.4.0
. When I tried to execute the sample code I faced the following error. I dont understand whats the issue. Could anyone can guide me ?
FYI - https://docs.oracle.com/cd/E69185_01/cwdirect/pdf/180/cwdirect_user_reference/SO04_16.htm
org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array
TransactionProcessor failed to initialize
null
com.paymentech.orbital.sdk.util.exceptions.InitializationException
at com.paymentech.orbital.sdk.configurator.Configurator.loadSecurityProviders(Configurator.java:349)
at com.paymentech.orbital.sdk.configurator.Configurator.load(Configurator.java:393)
at com.paymentech.orbital.sdk.configurator.Configurator.getInstance(Configurator.java:72)
at com.paymentech.orbital.sdk.transactionProcessor.TransactionProcessor.<init>(TransactionProcessor.java:43)
at com.chase.paymentech.AuthSample.main(AuthSample.java:20)
The code below for reference:
public class AuthSample {
//Global Constants
public final static int NORMAL_EXIT = 1;
public final static int ERROR_EXIT = -1;
public static void main(String[] args) {
TransactionProcessorIF tp = null;
try {
tp = new TransactionProcessor();
} catch (InitializationException iex) {
System.err.println("TransactionProcessor failed to initialize");
System.err.println(iex.getMessage());
iex.printStackTrace();
System.exit(ERROR_EXIT);
}
RequestIF request = null;
try {
//Tell the request object which template to use (see RequestIF.java)
request = new Request(RequestIF.NEW_ORDER_TRANSACTION);
//Basic Auth Fields
request.setFieldValue("IndustryType", "EC");
request.setFieldValue("MessageType", "A");
request.setFieldValue("MerchantID", "700000000413");
request.setFieldValue("BIN", "000002");
request.setFieldValue("OrderID", "122003SA");
request.setFieldValue("AccountNum", "4055011111111111");
request.setFieldValue("Amount", "100");
request.setFieldValue("Exp", "1209");
// AVS Information
request.setFieldValue("AVSname", "Jon Smith");
request.setFieldValue("AVSaddress1", "4200 W Cypress St");
request.setFieldValue("AVScity", "Tampa");
request.setFieldValue("AVSstate", "FL");
request.setFieldValue("AVSzip", "11111");
// Additional Information
request.setFieldValue("Comments", "This is Java SDK");
request.setFieldValue("ShippingRef", "FEDEX WB12345678 Pri 1");
//Uncomment the line below and modify to add a card security value (CVV2, CVC2 or CID)
request.setFieldValue("CardSecVal", "111");
request.setFieldValue("CardSecValInd", "1");
//Display the request
System.out.println("\nAuth Request:\n" + request.getXML());
} catch (InitializationException ie) {
System.err.println("Unable to initialize request object");
System.err.println(ie.getMessage());
ie.printStackTrace();
System.exit(ERROR_EXIT);
} catch (FieldNotFoundException fnfe) {
System.err.println("Unable to find XML field in template");
System.err.println(fnfe.getMessage());
fnfe.printStackTrace();
System.exit(ERROR_EXIT);
} catch (Exception e) {
e.printStackTrace();
System.exit(ERROR_EXIT);
}
//Process the transaction
ResponseIF response = null;
try {
response = tp.process(request);
} catch (TransactionException tex) {
System.err.println("Transaction failed, including retries and failover");
System.err.println(tex.getMessage());
tex.printStackTrace();
System.exit(ERROR_EXIT);
}
//Display the response
//This line displays the entire xml response on the java system console.
System.out.println("--------------------------------------------------");
System.out.println("\nResponse:\n" + response.toXmlString() + "\n");
System.out.println("Response Attributes:");
System.out.println("isGood=" + response.isGood());
System.out.println("isError=" + response.isError());
System.out.println("isQuickResponse=" + response.isQuickResponse());
System.out.println("isApproved=" + response.isApproved());
System.out.println("isDeclined=" + response.isDeclined());
System.out.println("AuthCode=" + response.getAuthCode());
System.out.println("TxRefNum=" + response.getTxRefNum());
System.out.println("ResponseCode=" + response.getResponseCode());
System.out.println("Status=" + response.getStatus());
System.out.println("Message=" + response.getMessage());
System.out.println("AVSCode=" + response.getAVSResponseCode());
System.out.println("CVV2ResponseCode=" + response.getCVV2RespCode());
System.out.println("--------------------------------------------------");
}
}
log4j-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="eCommerce" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${PAYMENTECH_LOGDIR}/eCommerce.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p,%d,[%c] - %m%n"/>
</layout>
</appender>
<appender name="engine" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${PAYMENTECH_LOGDIR}/engine.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p,%d,[%c] - %m%n"/>
</layout>
</appender>
<category name="eCommerceLogger" additivity="false">
<priority value="INFO" />
<appender-ref ref="eCommerce"/>
</category>
<category name="engineLogger" additivity="false">
<priority value="INFO" />
<appender-ref ref="engine"/>
</category>
<category additivity="false" name="org.apache.commons.httpclient">
<appender-ref ref="engine"/>
</category>
<category additivity="false" name="com.paymentech.orbital.sdk.util.ssl.StrictSSLProtocolSocketFactory">
<appender-ref ref="engine"/>
</category>
<category additivity="false" name="httpclient">
<appender-ref ref="engine"/>
</category>
</log4j:configuration>
linehandler.properties
##########################################################################
# PaymentechSDK_7.4.0
# Build Date: 11/14/2014
# Build Time: 10:06:20
##########################################################################
##########################################################################
# General Properties
##########################################################################
DTDVersion=PTI62
##########################################################################
# Transaction Processor Properties
##########################################################################
TransactionProcessor.poolSize=10
TransactionProcessor.retries=2
##########################################################################
# Response code configuration ('gateway' or 'host')
##########################################################################
Response.response_type=gateway
##########################################################################
# Java Security Providers
##########################################################################
security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.rsajca.Provider
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
##########################################################################
# IBM Security Providers
#For IBM JDK Websphere merchants
#comment out or remove the above sun security provider list
#uncomment the following IBM security provider list
#No need to have any sun related jar files in CLASSPATH for Orbital SDK
##########################################################################
#security.provider.1=com.ibm.crypto.provider.IBMJCE
#security.provider.2=com.ibm.security.jgss.IBMJGSSProvider
##########################################################################
# Engine Properties
##########################################################################
engine.class=com.paymentech.orbital.sdk.engine.https.HttpsEngine
engine.hostname=orbitalvar1.paymentech.net
engine.port=443
engine.hostname.failover=orbitalvar2.paymentech.net
engine.port.failover=443
engine.connection_timeout_seconds=90
engine.read_timeout_seconds=90
engine.authorizationURI=/authorize
engine.sdk_version=PaymentechSDK_7.4.0
#########################################################################
# Proxy Information
#########################################################################
#engine.proxyname=myproxyname
#engine.proxyport=myproxyport
# Type of SSL SocketFactory implementation to use
# The values for this property are as follows:
# default
# strict
engine.ssl.socketfactory=default
# To specify a non-default location for your truststore (cacerts) file,
# uncomment and edit these two lines
#engine.ssl.trustore.filename=C:/jdk1.3.1_03/jre/lib/security/cacerts
#engine.ssl.trustore.passphrase=changeit
##########################################################################
# XML Templates Configuration
##########################################################################
# Templates
XMLTemplates.Request.NewOrder=%PAYMENTECH_HOME%/xml/NewOrder.xml
XMLTemplates.Request.EOD=%PAYMENTECH_HOME%/xml/EOD.xml
XMLTemplates.Request.FlexCache=%PAYMENTECH_HOME%/xml/FlexCache.xml
XMLTemplates.Request.MFC=%PAYMENTECH_HOME%/xml/MFC.xml
XMLTemplates.Request.Profile=%PAYMENTECH_HOME%/xml/Profile.xml
XMLTemplates.Request.Reverse=%PAYMENTECH_HOME%/xml/Reverse.xml
XMLTemplates.Request.Inquiry=%PAYMENTECH_HOME%/xml/Inquiry.xml
XMLTemplates.Request.AccountUpdater=%PAYMENTECH_HOME%/xml/AccountUpdater.xml
XMLTemplates.Request.SafetechFraudAnalysis=%PAYMENTECH_HOME%/xml/SafetechFraudAnalysis.xml
# Complex Type Mappings
XMLTemplates.Request.ComplexRoot.PC3Core=%PAYMENTECH_HOME%/xml/templates/PC3Core.inc
XMLTemplates.Request.ComplexRoot.PC3Core.RecursiveElement1=PC3LineItems
XMLTemplates.Request.ComplexRoot.PC3Core.RecursiveElement1.CountElement=PC3LineItemCount
XMLTemplates.Request.ComplexRoot.PC3Core.RecursiveElement1.EnforceGreaterThanZero=yes
XMLTemplates.Request.ComplexRoot.PC3Core.RecursiveElement1.MaxCount=98
XMLTemplates.Request.ComplexRoot.PC3LineItems=%PAYMENTECH_HOME%/xml/templates/PC3LineItems.inc
XMLTemplates.Request.ComplexRoot.PC3LineItems.ChildIndexElement=PC3DtlIndex
XMLTemplates.Request.ComplexRoot.SettleRejectBin=%PAYMENTECH_HOME%/xml/templates/SettleRejectBin.inc
XMLTemplates.Request.ComplexRoot.PriorAuthID=%PAYMENTECH_HOME%/xml/templates/PriorAuthID.inc
XMLTemplates.Request.ComplexRoot.FraudAnalysis=%PAYMENTECH_HOME%/xml/templates/FraudAnalysis.inc
XMLTemplates.Request.ComplexRoot.SoftMerchantDescriptors=%PAYMENTECH_HOME%/xml/templates/SoftMerchantDescriptors.inc
I think this info is more than sufficient to understand the issue. Please help.
回答1:
Looks like you are trying to retrieve value from NULL here
RequestIF request = null;
request = new Request(RequestIF.NEW_ORDER_TRANSACTION);
Please check and update it with proper object.
来源:https://stackoverflow.com/questions/39550128/org-eclipse-debug-core-debugexception-com-sun-jdi-classnotloadedexception-type