| Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE?
 Goto Forum:| 
| [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #100919] | Tue, 06 November 2007 20:10  |  | 
| Eclipse User  |  |  |  |  | Hi All, 
 I'm getting this exception running EMF Compare in a
 WebSphere SOAP service.  I can't just call save on the XML backed object
 because that will cause Hibernate to do an insert instead of an update.
 
 ================================
 Caused by: java.lang.Throwable: java.lang.NullPointerException
 at
 org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
 at
 org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
 at
 java.lang.J9VMInternals.initializeImpl(Native Method)
 ================================
 
 
 I've gotten one EObject graph out of Teneo and the other from
 deserializing a SOAP request.  Here's the code:
 
 =================================
 //--- get an updated EObject from XML
 consumerUpdateInput =
 (ConsumerUpdateRequest)soapUtil.
 getObjectFromSoap(consumerUpdateRequest);
 consumerXML = consumerUpdateInput.getConsumer();
 
 //--- get the real one from the DB
 int consumerKey = consumerXML.getConsumerSK();
 consumerSQL = (Consumer)session.load("Consumer",
 new Integer(consumerKey));
 
 
 //--- apply the changes to the DB backed object.
 Resource leftRes = new XMLResourceImpl();
 leftRes.setURI(URI.createURI("leftRes.xml"));
 leftRes.getContents().add((EObject)consumerSQL);
 
 Resource rightRes = new XMLResourceImpl();
 rightRes.setURI(URI.createURI("rightRes.xml"));
 rightRes.getContents().add((EObject)consumerXML);
 
 //!!! This line throws the exception
 final MatchModel match = new DifferencesServices().modelMatch(
 (EObject)consumerSQL,
 (EObject)consumerXML,
 new NullProgressMonitor(),
 Collections.<String, Object> emptyMap());
 
 final DiffModel diff = new DiffMaker().doDiff(match);
 EList<DiffElement> e = diff.getOwnedElements();
 ListIterator li = e.listIterator();
 while(li.hasNext()){
 DiffElement element = (DiffElement)li.next();
 AbstractMerger merger = MergeFactory.createMerger(element);
 merger.applyInOrigin();
 }
 
 //--- save the updated consumer.
 session.save(consumerSQL);
 session.getTransaction().commit();
 resultMessage.setCode("SUCCESS");
 ==============================
 
 Any help is very much appreciated,
 
 Jason Henriksen
 |  |  |  |  |  |  | 
| Re: [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #101160 is a reply to message #100979] | Wed, 07 November 2007 12:16   |  | 
| Eclipse User  |  |  |  |  | Here's the full stack trace: 
 Caused by: java.lang.NoClassDefFoundError:
 org.eclipse.emf.compare.diff.service.DiffService (initialization failure)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:123)
 org.eclipse.emf.compare.diff.generic.DiffMaker.doDiff(DiffMa ker.java:139)
 org.eclipse.emf.compare.diff.generic.DiffMaker.doDiff(DiffMa ker.java:91)
 com.vsp.ConsumerSearchSOAPImpl.update(ConsumerSearchSOAPImpl .java)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
 java.lang.reflect.Method.invoke(Method.java:615)
 com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatche r.invokeMethod(JavaDispatcher.java:178)
 com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatche r.invokeOperation(JavaDispatcher.java:141)
 com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.p rocessRequestResponse(SoapRPCProcessor.java:447)
 com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.p rocessMessage(SoapRPCProcessor.java:412)
 com.ibm.ws.webservices.engine.dispatchers.BasicDispatcher.pr ocessMessage(BasicDispatcher.java:134)
 com.ibm.ws.webservices.engine.dispatchers.java.SessionDispat cher.invoke(SessionDispatcher.java:204)
 ... 28 more
 Caused by: java.lang.Throwable: java.lang.NullPointerException
 org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
 org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
 at java.lang.J9VMInternals.initializeImpl(Native Method)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
 ... 41 more
 
 Basically, it's just getting the NPE during the static constructor and
 then being unable to initialize the class.  I'm using the
 emft-compare-SDK-incubation-I200710230727.jar.
 
 Do you think I'm better off to go directly against the code in CVS?
 
 This project is going to be a real life saver for me.  I'm excited to
 get it up and running.  If I'm able to come up with any solutions on my
 end, I'll be sure to let you know.
 
 Thanks,
 
 Jason
 
 laurent Goubet wrote:
 > Jason,
 >
 >  From the little bit of stack trace you've posted, I would think the
 > failing line is not the one you've highlighted (final MatchModel match =
 > new DifferencesServices().modelMatch(...)) but the one directly
 > following (final DiffModel diff = new DiffMaker().doDiff(match);). Are
 > you sure about the exact line?
 >
 > Other than that, could you give me the exact tag of the build you use
 > -on eclipse.org download page, something like "I200710230727"- (or if
 > you're using a CVS version, the date of your checkout)? I'd also like
 > you to post the full stack trace of the failure since I cannot pinpoint
 > the problem.
 >
 > And as a side note even if this is not relevant, calling
 > MergeService#merge(DiffElement) instead of creating the merger from the
 > factory yourself will probably prove easier. Keep in mind that we are in
 > the process of enabling merging for standalone use so you'll probably
 > have to use the nightly that should be made available today.
 >
 > Regards,
 > Laurent Goubet
 > Obeo
 >
 > jason henriksen a écrit :
 >>
 >> Hi All,
 >>
 >> I'm getting this exception running EMF Compare in a
 >> WebSphere SOAP service.  I can't just call save on the XML backed
 >> object because that will cause Hibernate to do an insert instead of an
 >> update.
 >>
 >> ================================
 >> Caused by: java.lang.Throwable: java.lang.NullPointerException
 >> at
 >>  org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
 >>
 >> at
 >> org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
 >>
 >> at
 >> java.lang.J9VMInternals.initializeImpl(Native Method)
 >> ================================
 >>
 >>
 >> I've gotten one EObject graph out of Teneo and the other from
 >> deserializing a SOAP request.  Here's the code:
 >>
 >> =================================
 >> //--- get an updated EObject from XML
 >> consumerUpdateInput =
 >>     (ConsumerUpdateRequest)soapUtil.
 >>         getObjectFromSoap(consumerUpdateRequest);
 >> consumerXML = consumerUpdateInput.getConsumer();
 >>
 >> //--- get the real one from the DB
 >> int consumerKey = consumerXML.getConsumerSK();
 >> consumerSQL = (Consumer)session.load("Consumer",
 >>             new Integer(consumerKey));
 >>
 >>     //--- apply the changes to the DB backed object.
 >> Resource leftRes = new XMLResourceImpl();
 >> leftRes.setURI(URI.createURI("leftRes.xml"));
 >> leftRes.getContents().add((EObject)consumerSQL);
 >>
 >> Resource rightRes = new XMLResourceImpl();
 >> rightRes.setURI(URI.createURI("rightRes.xml"));
 >> rightRes.getContents().add((EObject)consumerXML);
 >>
 >> //!!! This line throws the exception           final MatchModel match
 >> = new DifferencesServices().modelMatch(
 >>         (EObject)consumerSQL,
 >>         (EObject)consumerXML,
 >>         new NullProgressMonitor(),
 >>         Collections.<String, Object> emptyMap());
 >>
 >> final DiffModel diff = new DiffMaker().doDiff(match);
 >> EList<DiffElement> e = diff.getOwnedElements();
 >> ListIterator li = e.listIterator();
 >> while(li.hasNext()){
 >>     DiffElement element = (DiffElement)li.next();
 >>     AbstractMerger merger = MergeFactory.createMerger(element);
 >>     merger.applyInOrigin();
 >> }
 >>            //--- save the updated consumer.
 >> session.save(consumerSQL);
 >> session.getTransaction().commit();
 >> resultMessage.setCode("SUCCESS");
 >> ==============================
 >>
 >> Any help is very much appreciated,
 >>
 >>              Jason Henriksen
 >
 |  |  |  |  | 
| Re: [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #101942 is a reply to message #101160] | Thu, 08 November 2007 05:13  |  | 
| Eclipse User  |  |  |  |  | This is a multi-part message in MIME format. --------------060507090006000100070306
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 8bit
 
 Hi,
 
 We completed yesterday the process of fully enabling EMF Compare to be
 launched standalone, and made available a nightly presenting this
 functionnality.
 
 Could you try your use case with this last nightly and provide us with
 feedback against this particular failure?
 
 If this still fails with the last nightly, I'd need more information
 about your particular use case. Your stack trace indicates that you are
 running EMF Compare from within an eclipse, but your eclipse fails at
 retrieving the diff engine extension point, which strikes me as ... more
 than strange :).
 
 You told you're using EMF Compare in a websphere SOAP service, could you
 elaborate your usecase (eclipse version, java version, way you are
 calling EMF Compare and the such-like).
 
 Cheers,
 Laurent Goubet
 Obeo
 
 jason henriksen a
 |  |  |  |  | 
| Re: [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #610259 is a reply to message #100919] | Wed, 07 November 2007 03:51  |  | 
| Eclipse User  |  |  |  |  | This is a multi-part message in MIME format. --------------040204010808000801010900
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 8bit
 
 Jason,
 
 From the little bit of stack trace you've posted, I would think the
 failing line is not the one you've highlighted (final MatchModel match =
 new DifferencesServices().modelMatch(...)) but the one directly
 following (final DiffModel diff = new DiffMaker().doDiff(match);). Are
 you sure about the exact line?
 
 Other than that, could you give me the exact tag of the build you use
 -on eclipse.org download page, something like "I200710230727"- (or if
 you're using a CVS version, the date of your checkout)? I'd also like
 you to post the full stack trace of the failure since I cannot pinpoint
 the problem.
 
 And as a side note even if this is not relevant, calling
 MergeService#merge(DiffElement) instead of creating the merger from the
 factory yourself will probably prove easier. Keep in mind that we are in
 the process of enabling merging for standalone use so you'll probably
 have to use the nightly that should be made available today.
 
 Regards,
 Laurent Goubet
 Obeo
 
 jason henriksen a
 |  |  |  |  | 
| Re: [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #610287 is a reply to message #100979] | Wed, 07 November 2007 12:16  |  | 
| Eclipse User  |  |  |  |  | Here's the full stack trace: 
 Caused by: java.lang.NoClassDefFoundError:
 org.eclipse.emf.compare.diff.service.DiffService (initialization failure)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:123)
 org.eclipse.emf.compare.diff.generic.DiffMaker.doDiff(DiffMa ker.java:139)
 org.eclipse.emf.compare.diff.generic.DiffMaker.doDiff(DiffMa ker.java:91)
 com.vsp.ConsumerSearchSOAPImpl.update(ConsumerSearchSOAPImpl .java)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
 java.lang.reflect.Method.invoke(Method.java:615)
 com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatche r.invokeMethod(JavaDispatcher.java:178)
 com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatche r.invokeOperation(JavaDispatcher.java:141)
 com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.p rocessRequestResponse(SoapRPCProcessor.java:447)
 com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.p rocessMessage(SoapRPCProcessor.java:412)
 com.ibm.ws.webservices.engine.dispatchers.BasicDispatcher.pr ocessMessage(BasicDispatcher.java:134)
 com.ibm.ws.webservices.engine.dispatchers.java.SessionDispat cher.invoke(SessionDispatcher.java:204)
 ... 28 more
 Caused by: java.lang.Throwable: java.lang.NullPointerException
 org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
 org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
 at java.lang.J9VMInternals.initializeImpl(Native Method)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
 ... 41 more
 
 Basically, it's just getting the NPE during the static constructor and
 then being unable to initialize the class.  I'm using the
 emft-compare-SDK-incubation-I200710230727.jar.
 
 Do you think I'm better off to go directly against the code in CVS?
 
 This project is going to be a real life saver for me.  I'm excited to
 get it up and running.  If I'm able to come up with any solutions on my
 end, I'll be sure to let you know.
 
 Thanks,
 
 Jason
 
 laurent Goubet wrote:
 > Jason,
 >
 >  From the little bit of stack trace you've posted, I would think the
 > failing line is not the one you've highlighted (final MatchModel match =
 > new DifferencesServices().modelMatch(...)) but the one directly
 > following (final DiffModel diff = new DiffMaker().doDiff(match);). Are
 > you sure about the exact line?
 >
 > Other than that, could you give me the exact tag of the build you use
 > -on eclipse.org download page, something like "I200710230727"- (or if
 > you're using a CVS version, the date of your checkout)? I'd also like
 > you to post the full stack trace of the failure since I cannot pinpoint
 > the problem.
 >
 > And as a side note even if this is not relevant, calling
 > MergeService#merge(DiffElement) instead of creating the merger from the
 > factory yourself will probably prove easier. Keep in mind that we are in
 > the process of enabling merging for standalone use so you'll probably
 > have to use the nightly that should be made available today.
 >
 > Regards,
 > Laurent Goubet
 > Obeo
 >
 > jason henriksen a écrit :
 >>
 >> Hi All,
 >>
 >> I'm getting this exception running EMF Compare in a
 >> WebSphere SOAP service.  I can't just call save on the XML backed
 >> object because that will cause Hibernate to do an insert instead of an
 >> update.
 >>
 >> ================================
 >> Caused by: java.lang.Throwable: java.lang.NullPointerException
 >> at
 >>  org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
 >>
 >> at
 >> org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
 >>
 >> at
 >> java.lang.J9VMInternals.initializeImpl(Native Method)
 >> ================================
 >>
 >>
 >> I've gotten one EObject graph out of Teneo and the other from
 >> deserializing a SOAP request.  Here's the code:
 >>
 >> =================================
 >> //--- get an updated EObject from XML
 >> consumerUpdateInput =
 >>     (ConsumerUpdateRequest)soapUtil.
 >>         getObjectFromSoap(consumerUpdateRequest);
 >> consumerXML = consumerUpdateInput.getConsumer();
 >>
 >> //--- get the real one from the DB
 >> int consumerKey = consumerXML.getConsumerSK();
 >> consumerSQL = (Consumer)session.load("Consumer",
 >>             new Integer(consumerKey));
 >>
 >>     //--- apply the changes to the DB backed object.
 >> Resource leftRes = new XMLResourceImpl();
 >> leftRes.setURI(URI.createURI("leftRes.xml"));
 >> leftRes.getContents().add((EObject)consumerSQL);
 >>
 >> Resource rightRes = new XMLResourceImpl();
 >> rightRes.setURI(URI.createURI("rightRes.xml"));
 >> rightRes.getContents().add((EObject)consumerXML);
 >>
 >> //!!! This line throws the exception           final MatchModel match
 >> = new DifferencesServices().modelMatch(
 >>         (EObject)consumerSQL,
 >>         (EObject)consumerXML,
 >>         new NullProgressMonitor(),
 >>         Collections.<String, Object> emptyMap());
 >>
 >> final DiffModel diff = new DiffMaker().doDiff(match);
 >> EList<DiffElement> e = diff.getOwnedElements();
 >> ListIterator li = e.listIterator();
 >> while(li.hasNext()){
 >>     DiffElement element = (DiffElement)li.next();
 >>     AbstractMerger merger = MergeFactory.createMerger(element);
 >>     merger.applyInOrigin();
 >> }
 >>            //--- save the updated consumer.
 >> session.save(consumerSQL);
 >> session.getTransaction().commit();
 >> resultMessage.setCode("SUCCESS");
 >> ==============================
 >>
 >> Any help is very much appreciated,
 >>
 >>              Jason Henriksen
 >
 |  |  |  |  | 
| Re: [COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #610460 is a reply to message #101160] | Thu, 08 November 2007 05:13  |  | 
| Eclipse User  |  |  |  |  | This is a multi-part message in MIME format. --------------060507090006000100070306
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 8bit
 
 Hi,
 
 We completed yesterday the process of fully enabling EMF Compare to be
 launched standalone, and made available a nightly presenting this
 functionnality.
 
 Could you try your use case with this last nightly and provide us with
 feedback against this particular failure?
 
 If this still fails with the last nightly, I'd need more information
 about your particular use case. Your stack trace indicates that you are
 running EMF Compare from within an eclipse, but your eclipse fails at
 retrieving the diff engine extension point, which strikes me as ... more
 than strange :).
 
 You told you're using EMF Compare in a websphere SOAP service, could you
 elaborate your usecase (eclipse version, java version, way you are
 calling EMF Compare and the such-like).
 
 Cheers,
 Laurent Goubet
 Obeo
 
 jason henriksen a
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 15:03:48 EDT 2025 
 Powered by FUDForum . Page generated in 0.05404 seconds |