没有带有@XmlElementDecl [ApacheCXF]的ObjectFactory

时间:2018-09-12 10:06:52

标签: java xml spring cxf objectfactory

我正在使用生成的xml文件,但无法正常工作。 抛出错误没有@XmlElementDecl的ObjectFactory。 我在这里为RestAPI使用ApacheCXF。 我是ApacheCXF的新手,现在完全困惑为什么会出现此错误。

日志:

15:14:55.605 ERROR [http-nio-8080-exec-1][[dispatcherServlet]] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Could not instantiate JAXBContext for class [class com.ail.xstore.xsdtypes.nrf.XstorePoslogOut]: 7 counts of IllegalAnnotationExceptions; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 7 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}OrderType.
    this problem is related to the following location:
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
        at com.ail.xstore.xsdtypes.nrf.Layaway
        at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
        at com.ail.xstore.xsdtypes.nrf.LineItem
        at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
        at com.ail.xstore.xsdtypes.dtv.TenderExchange
        at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
        at com.ail.xstore.xsdtypes.nrf.Transaction
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
        at com.ail.xstore.xsdtypes.nrf.POSLog
        at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
        at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}OrderType.
    this problem is related to the following location:
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.PreviousLayaway.accountNumberOrItemIDOrDescription
        at com.ail.xstore.xsdtypes.nrf.PreviousLayaway
        at public com.ail.xstore.xsdtypes.nrf.PreviousLayaway com.ail.xstore.xsdtypes.nrf.ObjectFactory.createPreviousLayaway()
        at com.ail.xstore.xsdtypes.nrf.ObjectFactory
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
        at com.ail.xstore.xsdtypes.nrf.Layaway
        at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
        at com.ail.xstore.xsdtypes.nrf.LineItem
        at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
        at com.ail.xstore.xsdtypes.dtv.TenderExchange
        at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
        at com.ail.xstore.xsdtypes.nrf.Transaction
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
        at com.ail.xstore.xsdtypes.nrf.POSLog
        at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
        at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut
There's no ObjectFactory with an @XmlElementDecl for the element {http://www.datavantagecorp.com/xstore/}UnitOfMeasureCode.
    this problem is related to the following location:
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Sale.actualSalesUnitPriceOrAssociateOrDescription
        at com.ail.xstore.xsdtypes.nrf.Sale
        at protected com.ail.xstore.xsdtypes.nrf.Sale com.ail.xstore.xsdtypes.nrf.Member.sale
        at com.ail.xstore.xsdtypes.nrf.Member
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Kit.member
        at com.ail.xstore.xsdtypes.nrf.Kit
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Return.actualSalesUnitPriceOrAssociateOrDescription
        at com.ail.xstore.xsdtypes.nrf.Return
        at public com.ail.xstore.xsdtypes.nrf.Return com.ail.xstore.xsdtypes.nrf.ObjectFactory.createReturn()
        at com.ail.xstore.xsdtypes.nrf.ObjectFactory
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.Layaway.accountNumberOrItemIDOrDescription
        at com.ail.xstore.xsdtypes.nrf.Layaway
        at protected com.ail.xstore.xsdtypes.nrf.Layaway com.ail.xstore.xsdtypes.nrf.LineItem.layaway
        at com.ail.xstore.xsdtypes.nrf.LineItem
        at protected java.util.List com.ail.xstore.xsdtypes.dtv.TenderExchange.lineItem
        at com.ail.xstore.xsdtypes.dtv.TenderExchange
        at protected com.ail.xstore.xsdtypes.dtv.TenderExchange com.ail.xstore.xsdtypes.nrf.Transaction.tenderExchange
        at com.ail.xstore.xsdtypes.nrf.Transaction
        at protected java.util.List com.ail.xstore.xsdtypes.nrf.POSLog.transaction
        at com.ail.xstore.xsdtypes.nrf.POSLog
        at protected com.ail.xstore.xsdtypes.nrf.POSLog com.ail.xstore.xsdtypes.nrf.XstorePoslogOut.posLog
        at com.ail.xstore.xsdtypes.nrf.XstorePoslogOut

控制器端点:

@RequestMapping(value = "/pos", method = RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@ExceptionMetered
public Acknowledgement processPos(@RequestBody XstorePoslogOut xstorePoslogOut) {
    POSLog posLog = xstorePoslogOut.getPOSLog();
    String messageId = "1";
    log.info("posLogOut Recieved call for " + posLog.getTransaction().size()+" transactions");

    List<DeltaTransaction> deltaTransactionList =  new ArrayList<DeltaTransaction>();
    Acknowledgement f = new Acknowledgement();
    String transactionId = messageId;
    f.setTransactionId(transactionId);

    for(Transaction transaction : posLog.getTransaction()){
        try {
            if("RETAIL_SALE".equalsIgnoreCase(transaction.getTransactionType()) && !transaction.isCancelFlag()){
                FcIdResponse fcIdResponse = fcDetailsCache.getFcDetail(transaction.getRetailStoreID().toString());
                String fcId = fcIdResponse.getFcId();
                log.info("retailStoreId: " + transaction.getRetailStoreID().toString() + " fcId: " + fcId);
                List<LineItem> lineItems = transaction.getRetailTransaction().getLineItem();
                for (LineItem lineItem : lineItems){
                    DeltaTransaction deltaTransaction = new DeltaTransaction();
                    deltaTransaction.setFcId(fcId);
                    List<Object> objects;
                    try {
                        objects = lineItem.getSale().getActualSalesUnitPriceOrAssociateOrDescription();
                    } catch (NullPointerException n){
                        continue;
                    }
                    setTheDeltaTransaction(objects, deltaTransaction);

                    deltaTransaction.setTransactionType(CommonConstants.TRANSACTION_TYPE.OVERWRITE.getStockStatus());
                    deltaTransaction.setSource(CommonConstants.SOURCEANDDESTINATION.OVERWRITE.getSource());
                    deltaTransaction.setDestination(CommonConstants.SOURCEANDDESTINATION.OVERWRITE.getDestination());
                    deltaTransaction.setTransaction(transaction.getTransactionType());
                    deltaTransactionList.add(deltaTransaction);
                }
                imsClient.processDeltaTransactions(deltaTransactionList, transactionId);

            }
        }catch (Exception ex){
            log.error("XStoreDeltInventoryService.processPosLog Exception: ", ex);
            f.setTransactionId("Failed to consume the SOAP request. Error message is : "+ ex.getMessage());
            return f;
        }
    }
    log.info("posLogOut ackn id:  " + transactionId);
    log.info("Request processed successfully and sent to IMS: " + transactionId);
    return f;
}

如果您需要更多详细信息,我可以提供。

0 个答案:

没有答案