javax.persistence.EntityNotFoundException:无法找到id为253104的org.broadleafcommerce.profile.core.domain.CustomerImpl

时间:2014-01-08 09:35:17

标签: java hibernate jpa paypal broadleaf-commerce

当我尝试注册客户并将其重定向到PayPal支付网关服务时,我收到了EntityNotFoundException。客户注册成功,记录保存在数据库中。当重定向到paypal沙盒网址时,我收到此错误。

根本原因例外:

  

javax.persistence.EntityNotFoundException:无法找到   org.broadleafcommerce.profile.core.domain.CustomerImpl,ID为253104

堆栈跟踪:

仅发布重要的堆栈跟踪以提高可读性:

[artifact:mvn] org.broadleafcommerce.core.payment.service.exception.PaymentException: CompositePaymentServiceImpl - Unable to execute payment for order -- id: null
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:77)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:82)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePaymentForGateway(CompositePaymentServiceImpl.java:105)
[artifact:mvn]  at org.broadleafcommerce.vendor.paypal.service.payment.PayPalCheckoutServiceImpl.initiateExpressCheckout(PayPalCheckoutServiceImpl.java:89)
[artifact:mvn]  at com.siggitt.controller.checkout.UpdateBroadleafPayPalController.paypalCheckout(UpdateBroadleafPayPalController.java:117)
[artifact:mvn]  at com.siggitt.controller.checkout.PayPalController.paypalCheckout(PayPalController.java:21)
[artifact:mvn]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[artifact:mvn]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[artifact:mvn]  at java.lang.reflect.Method.invoke(Method.java:601)
[artifact:mvn]  at java.lang.Thread.run(Thread.java:722)
[artifact:mvn] Caused by: org.broadleafcommerce.core.workflow.WorkflowException: org.broadleafcommerce.core.workflow.WorkflowException: javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.profile.core.domain.CustomerImpl with id 253104
[artifact:mvn]  at org.broadleafcommerce.core.workflow.DefaultErrorHandler.handleError(DefaultErrorHandler.java:57)
[artifact:mvn]  at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:88)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.CompositePaymentServiceImpl.executePayment(CompositePaymentServiceImpl.java:62)
[artifact:mvn]  ... 102 more
[artifact:mvn] Caused by: org.broadleafcommerce.core.workflow.WorkflowException: javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.profile.core.domain.CustomerImpl with id 253104
[artifact:mvn]  at org.broadleafcommerce.core.workflow.DefaultErrorHandler.handleError(DefaultErrorHandler.java:57)
[artifact:mvn]  at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:88)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.workflow.CompositeActivity.execute(CompositeActivity.java:36)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.workflow.CompositeActivity.execute(CompositeActivity.java:23)
[artifact:mvn]  at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:79)
[artifact:mvn]  ... 103 more
[artifact:mvn] Caused by: javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.profile.core.domain.CustomerImpl with id 253104
[artifact:mvn]  at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:155)
[artifact:mvn]  at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:210)
[artifact:mvn]  at org.hibernate.event.internal.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:409)
[artifact:mvn]  at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:214)
[artifact:mvn]  at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:154)
[artifact:mvn]  at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:76)
[artifact:mvn]  at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:903)
[artifact:mvn]  at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:887)
[artifact:mvn]  at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:891)
[artifact:mvn]  at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)
[artifact:mvn]  at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:366)
[artifact:mvn]  at $Proxy104.merge(Unknown Source)
[artifact:mvn]  at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
[artifact:mvn]  at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241)
[artifact:mvn]  at $Proxy104.merge(Unknown Source)
[artifact:mvn]  at org.broadleafcommerce.core.payment.dao.PaymentInfoDaoImpl.save(PaymentInfoDaoImpl.java:47)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.PaymentInfoServiceImpl.save(PaymentInfoServiceImpl.java:41)
[artifact:mvn]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn]  at $Proxy145.save(Unknown Source)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.PaymentServiceImpl.logResponseItem(PaymentServiceImpl.java:232)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.PaymentServiceImpl.authorizeAndDebit(PaymentServiceImpl.java:82)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.workflow.PaymentActivity.execute(PaymentActivity.java:83)
[artifact:mvn]  at org.broadleafcommerce.core.payment.service.workflow.PaymentActivity.execute(PaymentActivity.java:1)
[artifact:mvn]  at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:79)
[artifact:mvn]  ... 106 more
[artifact:mvn] 2014-01-08 12:40:08.971:WARN:oejs.ServletHandler:/siggitt/paypal/checkout
[artifact:mvn] java.lang.NullPointerException
[artifact:mvn]  at com.siggitt.controller.checkout.UpdateBroadleafPayPalController.paypalCheckout(UpdateBroadleafPayPalController.java:120)
[artifact:mvn]  at com.siggitt.controller.checkout.PayPalController.paypalCheckout(PayPalController.java:21)
[artifact:mvn]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[artifact:mvn]  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
[artifact:mvn]  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
[artifact:mvn]  at java.lang.Thread.run(Thread.java:722)
[artifact:mvn]  Errr***org.broadleafcommerce.core.workflow.WorkflowException: javax.persistence.EntityNotFoundException: Unable to find org.broadleafcommerce.profile.core.domain.CustomerImpl with id 253104

CompositePaymentServiceImpl

public CompositePaymentResponse executePayment(Order order, Map<PaymentInfo, Referenced> payments, PaymentResponse response) throws PaymentException {
        /*
         * TODO add validation that checks the order and payment information for
         * validity.
         */
        try {
            System.out.print("\n\n order<>>>>!!"+order);
            System.out.println("\n\npayments<<>>!!"+payments);
            System.out.println("\n\nresponse<<>>!!"+response);

            PaymentSeed seed = new PaymentSeed(order, payments, response);
            System.out.print("\n\n seed<>>>>!!"+seed.getPaymentResponse());
            paymentWorkflow.doActivities(seed);//exception thrown here
            System.out.println("done payment workflow activities");
            return seed;
        } catch (WorkflowException e) {
            Throwable cause = null;
            while (e.getCause() != null) {
                if (cause != null && cause.equals(e.getCause())) {
                    break;
                }
                cause = e.getCause();
            }
            if (cause != null && PaymentException.class.isAssignableFrom(cause.getClass())) {
                throw (PaymentException) cause;
            }
            System.out.print("\n Errr***"+e.getMessage());
            throw new PaymentException("CompositePaymentServiceImpl75 - Unable to execute payment for order -- id: " + order.getId(), e);
        }
    }

doActivities():

@Override
    public ProcessContext doActivities(Object seedData) throws WorkflowException {
        if (LOG.isDebugEnabled()) {
            LOG.debug(getBeanName() + " processor is running..");
        }
        ActivityStateManager activityStateManager = ((ActivityStateManager) getBeanFactory().getBean("blActivityStateManager"));
        if (activityStateManager == null) {
            throw new IllegalStateException("Unable to find an instance of ActivityStateManager registered under bean id blActivityStateManager");
        }
        ProcessContext context = null;
        RollbackStateLocal rollbackStateLocal = RollbackStateLocal.getRollbackStateLocal();
        if (rollbackStateLocal == null) {
            rollbackStateLocal = new RollbackStateLocal();
            rollbackStateLocal.setThreadId(String.valueOf(Thread.currentThread().getId()));
            rollbackStateLocal.setWorkflowId(getBeanName());
            RollbackStateLocal.setRollbackStateLocal(rollbackStateLocal);
        }
        try {
            //retrieve injected by Spring
            List<Activity<ProcessContext>> activities = getActivities();

            //retrieve a new instance of the Workflow ProcessContext
            context = createContext(seedData);

            for (Activity<ProcessContext> activity : activities) {
                if (activity.shouldExecute(context)) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("running activity:" + activity.getBeanName() + " using arguments:" + context);
                    }

                    try {
                        context = activity.execute(context);
                    } catch (Throwable th) {
                        if (getAutoRollbackOnError()) {
                            LOG.info("Automatically rolling back state for any previously registered RollbackHandlers. RollbackHandlers may be registered for workflow activities in appContext.");
                            ActivityStateManagerImpl.getStateManager().rollbackAllState();
                        }
                        ErrorHandler errorHandler = activity.getErrorHandler();
                        if (errorHandler == null) {
                            LOG.info("no error handler for this action, run default error" + "handler and abort processing ");
                            getDefaultErrorHandler().handleError(context, th);
                            break;
                        } else {
                            LOG.info("run error handler and continue");
                            errorHandler.handleError(context, th);
                        }
                    }

                    //ensure its ok to continue the process
                    if (processShouldStop(context, activity)) {
                        break;
                    }

                    //register the RollbackHandler
                    if (activity.getRollbackHandler() != null && activity.getAutomaticallyRegisterRollbackHandler()) {
                        ActivityStateManagerImpl.getStateManager().registerState(activity, context, activity.getRollbackRegion(), activity.getRollbackHandler(), activity.getStateConfiguration());
                    }
                } else {
                    LOG.debug("Not executing activity: " + activity.getBeanName() + " based on the context: " + context);
                }
            }
        } finally {
            rollbackStateLocal = RollbackStateLocal.getRollbackStateLocal();
            if (rollbackStateLocal != null && rollbackStateLocal.getWorkflowId().equals(getBeanName())) {
                activityStateManager.clearAllState();
                RollbackStateLocal.setRollbackStateLocal(null);
            }
        }
        LOG.debug(getBeanName() + " processor is done.");

        return context;
    }

我有一个solution from this answer在@ManytoOne映射中将获取类型添加到延迟。 但它对我有用。我怎么解决这个问题?。有没有人遇到过这个问题的解决方案?

0 个答案:

没有答案