Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Exception when using transformer on a accessor(Moxy pojo to XML mapping)
Exception when using transformer on a accessor [message #957686] Thu, 25 October 2012 12:10
Boris Hamanov is currently offline Boris HamanovFriend
Messages: 7
Registered: July 2009
Junior Member
This is my code, I am trying to use a custom transformer to create kind of aggregate for this SupplierOrderCharge object where I sum up all values in the list.

The exeption listed below dissapears if I remove the transformer annotatations.
Is this a valid config? Can I put a transformer for a getter method like this?

@XmlElement
@XmlTransformation
@XmlReadTransformer(transformerClass = GeneralAttributeMarkerTransformer.class)
@XmlWriteTransformers({ @XmlWriteTransformer(xmlPath = "ORDER_HEADER/SHIPPING_INFO/SHIPMENT_CODE/text()", transformerClass = ShippingInfoTransformer.class),
@XmlWriteTransformer(xmlPath = "ORDER_HEADER/SHIPPING_INFO/SHIPPING_COST_EX_VAT/text()", transformerClass = ShippingInfoTransformer.class),
@XmlWriteTransformer(xmlPath = "ORDER_HEADER/SHIPPING_INFO/SHIPPING_COST_VAT/text()", transformerClass = ShippingInfoTransformer.class),
@XmlWriteTransformer(xmlPath = "ORDER_HEADER/SHIPPING_INFO/SHIPPING_COST_INC_VAT/text()", transformerClass = ShippingInfoTransformer.class), })
@Transient
protected SupplierOrderCharge getShippingInfo()
{
for (final SupplierOrderCharge soCharge : getOrderCharges())
{
if (EntryType.SHIPPING.equals(soCharge.getEntryType()))
{
return soCharge;
}
}
return null;
}


I get an exception:
javax.xml.bind.JAXBException:
Descriptor Exceptions:
---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [] or [getShippingInfo] is not defined in the object [com.debijenkorf.data.model.supplier.SupplierOrder].
Internal Exception: java.lang.NoSuchMethodException: com.debijenkorf.data.model.supplier.SupplierOrder.(com.debijenkorf.data.model.supplier.SupplierOrderCharge)
Mapping: org.eclipse.persistence.oxm.mappings.XMLTransformationMapping[shippingInfo]
Descriptor: XMLDescriptor(com.debijenkorf.data.model.supplier.SupplierOrder --> [DatabaseTable(SALES_ORDER)])

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

- with linked exception:
[Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [] or [getShippingInfo] is not defined in the object [com.debijenkorf.data.model.supplier.SupplierOrder].
Internal Exception: java.lang.NoSuchMethodException: com.debijenkorf.data.model.supplier.SupplierOrder.(com.debijenkorf.data.model.supplier.SupplierOrderCharge)
Mapping: org.eclipse.persistence.oxm.mappings.XMLTransformationMapping[shippingInfo]
Descriptor: XMLDescriptor(com.debijenkorf.data.model.supplier.SupplierOrder --> [DatabaseTable(SALES_ORDER)])

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException
]
at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:771)
at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:711)
at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:157)
at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:249)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
at com.debijenkorf.services.core.JaxbMoxyMarUn.marshal(JaxbMoxyMarUn.java:48)
at com.debijenkorf.services.fc4.JaxbMarUnFC1Test.testMarshal(JaxbMarUnFC1Test.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [] or [getShippingInfo] is not defined in the object [com.debijenkorf.data.model.supplier.SupplierOrder].
Internal Exception: java.lang.NoSuchMethodException: com.debijenkorf.data.model.supplier.SupplierOrder.(com.debijenkorf.data.model.supplier.SupplierOrderCharge)
Mapping: org.eclipse.persistence.oxm.mappings.XMLTransformationMapping[shippingInfo]
Descriptor: XMLDescriptor(com.debijenkorf.data.model.supplier.SupplierOrder --> [DatabaseTable(SALES_ORDER)])

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:638)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:574)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:533)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:777)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:735)
at org.eclipse.persistence.oxm.XMLContext$XMLContextState.<init>(XMLContext.java:857)
at org.eclipse.persistence.oxm.XMLContext$XMLContextState.<init>(XMLContext.java:832)
at org.eclipse.persistence.oxm.XMLContext.<init>(XMLContext.java:193)
at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:797)
at org.eclipse.persistence.jaxb.JAXBContext$ContextPathInput.createContextState(JAXBContext.java:769)
... 37 more
Previous Topic:PersistenceException upon flush() - constraint violation
Next Topic:[SOLVED] integrity constraint violation after mergin list of unmanaged entities
Goto Forum:
  


Current Time: Fri Apr 19 20:16:35 GMT 2024

Powered by FUDForum. Page generated in 0.02375 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top