Hey everyone,
I have a production server that has been operating for months
processing ~70 credit card transactions on a daily basis through
Authorize.net. There hasn't been any code changes or upgrade, nor any
configuration changes (at least not knowingly). Starting a few days
ago, we started seeing some orders on the ecommerce application being
left in created status (usually, they are either approved or
rejected). This morning, the problem got worse: It no longer is a few
orders, but all of them. All credit card transactions are failing
because of a NullPointerException. The deployment is running 10.04.
Here is an example of the error log:
2011-04-07 18:39:27,211 (TP-Processor54)
[PaymentGatewayServices.java:563:ERROR]
---- exception report ----------------------------------------------------------
Error occurred on: aimCCAuth => {customerIpAddress=99.34.XX.XXX,
userLogin=[GenericEntity:UserLogin][createdStamp,2010-10-13....
(The error goes on for quite some lenght, but I am removing the
information because it contains particulars of the customer creating
the transaction. I also XXX some of the info)
It then proceeds to:
39:25.061(java.sql.Timestamp)][lastUpdatedTxStamp,2011-04-07
18:39:24.991(java.sql.Timestamp)], processAmount=XX.XX}
Exception: org.ofbiz.service.GenericServiceException
Message: Service [aimCCAuth] target threw an unexpected exception (null)
---- cause ---------------------------------------------------------------------
Exception: java.lang.NullPointerException
Message: null
---- stack trace ---------------------------------------------------------------
java.lang.NullPointerException
org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices.processAuthTransResult(AIMPaymentServices.java:549)
org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices.ccAuth(AIMPaymentServices.java:96)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100)
org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57)
org.ofbiz.service.ModelServiceReader$GenericInvokerImpl.runSync(ModelServiceReader.java:761)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:399)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:226)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:179)
org.ofbiz.accounting.payment.PaymentGatewayServices.authPayment(PaymentGatewayServices.java:523)
org.ofbiz.accounting.payment.PaymentGatewayServices.authOrderPaymentPreference(PaymentGatewayServices.java:172)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100)
org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57)
org.ofbiz.service.ModelServiceReader$GenericInvokerImpl.runSync(ModelServiceReader.java:761)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:399)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:226)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:165)
org.ofbiz.accounting.payment.PaymentGatewayServices.authOrderPayments(PaymentGatewayServices.java:374)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100)
org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57)
org.ofbiz.service.ModelServiceReader$GenericInvokerImpl.runSync(ModelServiceReader.java:761)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:399)
org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:226)
org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:179)
org.ofbiz.order.shoppingcart.CheckOutHelper.processPayment(CheckOutHelper.java:995)
org.ofbiz.order.shoppingcart.CheckOutHelper.processPayment(CheckOutHelper.java:894)
org.ofbiz.order.shoppingcart.CheckOutEvents.processPayment(CheckOutEvents.java:551)
org.ofbiz.order.shoppingcart.CheckOutEvents.processPayment(CheckOutEvents.java:515)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java:92)
org.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java:78)
org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:636)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:382)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:523)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:523)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:523)
org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:523)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227)
org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:269)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
java.lang.Thread.run(Thread.java:619)
Here is were I got stuck. As far as I can tell the exception is being
generated from AIMPaymentServices.java:549, which has the following
content (the offending line has a <-----):
private static void processAuthTransResult(Map<String, Object>
reply, Map<String, Object> results) {
AuthorizeResponse ar = (AuthorizeResponse)
reply.get("authorizeResponse");
Boolean authResult = (Boolean) reply.get("authResult");
results.put("authResult", new
Boolean(authResult.booleanValue())); // <-------- THIS IS THE
OFFENDING LINE
results.put("authFlag", ar.getReasonCode());
results.put("authMessage", ar.getReasonText());
if (authResult.booleanValue()) { //passed
results.put("authCode",
ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
results.put("authRefNum",
ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
results.put("cvCode",
ar.getResponseField(AuthorizeResponse.CID_RESPONSE_CODE));
results.put("avsCode",
ar.getResponseField(AuthorizeResponse.AVS_RESULT_CODE));
results.put("processAmount", new
BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT)));
} else {
results.put("authCode", ar.getResponseCode());
results.put("processAmount", BigDecimal.ZERO);
results.put("authRefNum", AuthorizeResponse.ERROR);
}
Debug.logInfo("processAuthTransResult: " + results.toString(),module);
}
As far as I can tell, the only way that line can throw a
NullPointerException is if results.put throws it (which is very
unlikely, since it is initialized earlier) or
authResult.booleanValue() is the culprit, which I guess it can happen
if the previous line reply.get("authResult") returns null. I don't
have any idea on how that happens.
I should also say that non of the requests are making their way to
authorize.net: They are not showing on their side at all. Usually, all
transaction (either authorized, captured, declined, etc) show up on
their side, but non are showing now.
Has anyone seen something like this before? Any ideas to point me in
right direction to solve this problem are greatly appreciated.
Regards,
Josh Jacobson.