Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [TENEO] EMF and Serializable
[TENEO] EMF and Serializable [message #635277] Tue, 26 October 2010 09:12 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hi,

how can i serializable a EClassImpl ? I have problems with the remoting because the EClassImpl is not serializable.

Caused by: java.io.NotSerializableException: org.eclipse.emf.ecore.impl.EClassImpl
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeArray(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
	at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.doWriteRemoteInvocation(AbstractHttpInvokerRequestExecutor.java:199)
	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.writeRemoteInvocation(AbstractHttpInvokerRequestExecutor.java:167)
	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.getByteArrayOutputStream(AbstractHttpInvokerRequestExecutor.java:147)
	at org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:131)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:192)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:174)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:142)
	... 30 more


Thanks

[Updated on: Wed, 27 October 2010 11:26]

Report message to a moderator

Re: EMF and Serializable [message #635381 is a reply to message #635277] Tue, 26 October 2010 15:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060103020303030001090805
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

You'll need to rely on EMF Resources to serialize your model instances.
We worked on this, but that doesn't help for Ecore itself. 245014
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=245014>


SirWayne wrote:
> Hi,
>
> how can i serializable a EClassImpl ? I have problems with the
> remoting because the EClassImpl is not serializable.
>
>
> Caused by: java.io.NotSerializableException:
> org.eclipse.emf.ecore.impl.EClassImpl
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.writeArray(Unknown Source)
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
> at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
> at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
> at java.io.ObjectOutputStream.writeObject0(Unknown Source)
> at java.io.ObjectOutputStream.writeObject(Unknown Source)
> at
> org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.doWriteRemoteInvocation(AbstractHttpInvokerR equestExecutor.java:199)
>
> at
> org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.writeRemoteInvocation(AbstractHttpInvokerReq uestExecutor.java:167)
>
> at
> org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.getByteArrayOutputStream(AbstractHttpInvoker RequestExecutor.java:147)
>
> at
> org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.executeRequest(AbstractHttpInvokerRequestExe cutor.java:131)
>
> at
> org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.executeRequest(HttpInvokerClientInterceptor.java:1 92)
>
> at
> org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.executeRequest(HttpInvokerClientInterceptor.java:1 74)
>
> at
> org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.invoke(HttpInvokerClientInterceptor.java:142)
>
> ... 30 more
>
>
> Thanks

--------------060103020303030001090805
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You'll need to rely on EMF Resources to serialize your model
instances.  We worked on this, but that doesn't help for Ecore itself. <a
name="b245014"
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=245014">245014</a><br>
<br>
<br>
SirWayne wrote:
<blockquote cite="mid:ia65ru$2ra$1@news.eclipse.org" type="cite">Hi,
<br>
<br>
how can i serializable a EClassImpl ? I have problems with the remoting
because the EClassImpl is not serializable.
<br>
<br>
<br>
Caused by: java.io.NotSerializableException:
org.eclipse.emf.ecore.impl.EClassImpl
<br>
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeArray(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
<br>
    at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeObject0(Unknown Source)
<br>
    at java.io.ObjectOutputStream.writeObject(Unknown Source)
<br>
    at
org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.doWriteRemoteInvocation(AbstractHttpInvokerR equestExecutor.java:199)
<br>
    at
org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.writeRemoteInvocation(AbstractHttpInvokerReq uestExecutor.java:167)
<br>
    at
org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.getByteArrayOutputStream(AbstractHttpInvoker RequestExecutor.java:147)
<br>
    at
org.springframework.remoting.httpinvoker.AbstractHttpInvoker RequestExecutor.executeRequest(AbstractHttpInvokerRequestExe cutor.java:131)
<br>
    at
org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.executeRequest(HttpInvokerClientInterceptor.java:1 92)
<br>
    at
org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.executeRequest(HttpInvokerClientInterceptor.java:1 74)
<br>
    at
org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.invoke(HttpInvokerClientInterceptor.java:142)
<br>
    ... 30 more
<br>
<br>
<br>
Thanks
<br>
</blockquote>
</body>
</html>

--------------060103020303030001090805--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and Serializable [message #635508 is a reply to message #635381] Wed, 27 October 2010 07:22 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Thanks for the answer:

But I don't understand the solution:

The model
public abstract class DBObjectImpl extends EObjectImpl implements DBObject, java.io.Serializable {


The code on the Server side

	public <T extends DBObject> List<T> findAll(EClass entityClass, Class<T> returnClass){
                // create query...

		List<T> list = query.getResultList();
		logger.info(list.toString());
		return list;
	}
	
	public <T extends DBObject> T saveOrUpdate(T entity) {
		logger.info("Save Entity" + entity);
		return entityManager.merge(entity);
		
	}


The saveOrUpdate methode works fine. But the findAll throws the Exception and how can I solve it with Resources?

My second Problem and my second try was to change the findAll methode:

	
	public <T extends DBObject> List<T> findAll(DBObject entityClass, Class<T> returnClass){
                // create query...

		List<T> list = query.getResultList();
		return new ArrayList(list);
	}


Exception on client side
org.springframework.remoting.RemoteAccessException: Could not deserialize result from HTTP invoker remote service [http://localhost:8080/web/remoting/BaseService]; nested exception is java.lang.ClassNotFoundException: org.eclipse.emf.teneo.eclipselink.elist.IndirectEList not found from bundle [emf-rcp]
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:208)
	at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:145)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy5.findAll(Unknown Source)
	at handler.View$4.widgetSelected(View.java:151)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at emfrcp.Application.start(Application.java:20)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


Is this a spring problem? Don't understand why the ArrayList will mapped to a org.eclipse.emf.teneo.eclipselink.elist.IndirectEList?

On the client Side I want wo work with a ArrayList not with a teneo List...

Do anybody find a mistake?

Thank

[Updated on: Wed, 27 October 2010 07:45]

Report message to a moderator

Re: EMF and Serializable [message #635526 is a reply to message #635508] Wed, 27 October 2010 08:22 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 27.10.2010 09:22, schrieb SirWayne:
> Thanks for the answer:
>
> But I don't understand the solution:
>
> The model
>
> public abstract class DBObjectImpl extends EObjectImpl implements DBObject, java.io.Serializable {
>
>
> The code on the Server side
>
>
> public <T extends DBObject> List<T> findAll(EClass entityClass, Class<T> returnClass){
> // create query...
>
> List<T> list = query.getResultList();
> logger.info(list.toString());
> return list;
> }
>
> public <T extends DBObject> T saveOrUpdate(T entity) {
> logger.info("Save Entity" + entity);
> return entityManager.merge(entity);
>
> }
>
>
> The saveOrUpdate methode works fine. But the findAll throws the Exception and how can I solve it with Resources?
>
> My second Problem and my second try was to change the findAll methode:
>
>
>
> public <T extends DBObject> List<T> findAll(EClass entityClass, Class<T> returnClass){
> // create query...
>
> List<T> list = query.getResultList();
> return new ArrayList(list);
> }
>
>
> Exception on client side
>
> org.springframework.remoting.RemoteAccessException: Could not deserialize result from HTTP invoker remote service [http://localhost:8080/web/remoting/BaseService]; nested exception is java.lang.ClassNotFoundException: org.eclipse.emf.teneo.eclipselink.elist.IndirectEList not found from bundle [emf-rcp]
Teneo seems related. You may want to post this as a separate question and prefix it with [Teneo] to draw Martin's attention to it ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> at org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.convertHttpInvokerAccessException(HttpInvokerClien tInterceptor.java:208)
> at org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.invoke(HttpInvokerClientInterceptor.java:145)
> at org.springframework.aop.framework.ReflectiveMethodInvocation .proceed(ReflectiveMethodInvocation.java:172)
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke( JdkDynamicAopProxy.java:202)
> at $Proxy5.findAll(Unknown Source)
> at handler.View$4.widgetSelected(View.java:151)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:234)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at emfrcp.Application.start(Application.java:20)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
> Is this a spring problem? Don't understand why the ArrayList will mapped to a org.eclipse.emf.teneo.eclipselink.elist.IndirectEList?
>
> On the client Side I want wo work with a ArrayList not with a teneo List...
>
> Do anybody find a mistake?
>
> Thank


Re: EMF and Serializable [message #635575 is a reply to message #635526] Wed, 27 October 2010 11:44 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Perhaps a important information. I think the lazy loading modus is off.
<property name="eclipselink.weaving" value="false"/>
            <property name="eclipselink.weaving.eager" value="true"/>
            <property name="eclipselink.cache.shared.default" value="false"/>
Re: EMF and Serializable [message #635664 is a reply to message #635508] Wed, 27 October 2010 16:26 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
I don't know much of your setup but it seems that the exception is thrown on the client when de-serializing correct?
Teneo replaces standard EMF ELists to give them extra persistence behavior, it seems that the Teneo EclipseLink classes
are not present on the client somehow. (but maybe I don't understand the exception or setup....).

gr. Martrin

On 10/27/2010 09:22 AM, SirWayne wrote:
> Thanks for the answer:
>
> But I don't understand the solution:
>
> The model
>
> public abstract class DBObjectImpl extends EObjectImpl implements
> DBObject, java.io.Serializable {
>
>
> The code on the Server side
>
>
> public <T extends DBObject> List<T> findAll(EClass entityClass, Class<T>
> returnClass){
> // create query...
>
> List<T> list = query.getResultList();
> logger.info(list.toString());
> return list;
> }
>
> public <T extends DBObject> T saveOrUpdate(T entity) {
> logger.info("Save Entity" + entity);
> return entityManager.merge(entity);
>
> }
>
>
> The saveOrUpdate methode works fine. But the findAll throws the
> Exception and how can I solve it with Resources?
>
> My second Problem and my second try was to change the findAll methode:
>
>
>
> public <T extends DBObject> List<T> findAll(EClass entityClass, Class<T>
> returnClass){
> // create query...
>
> List<T> list = query.getResultList();
> return new ArrayList(list);
> }
>
>
> Exception on client side
>
> org.springframework.remoting.RemoteAccessException: Could not
> deserialize result from HTTP invoker remote service
> [http://localhost:8080/web/remoting/BaseService]; nested exception is
> java.lang.ClassNotFoundException:
> org.eclipse.emf.teneo.eclipselink.elist.IndirectEList not found from
> bundle [emf-rcp]
> at
> org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.convertHttpInvokerAccessException(HttpInvokerClien tInterceptor.java:208)
>
> at
> org.springframework.remoting.httpinvoker.HttpInvokerClientIn terceptor.invoke(HttpInvokerClientInterceptor.java:145)
>
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation .proceed(ReflectiveMethodInvocation.java:172)
>
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke( JdkDynamicAopProxy.java:202)
>
> at $Proxy5.findAll(Unknown Source)
> at handler.View$4.widgetSelected(View.java:151)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:234)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at emfrcp.Application.start(Application.java:20)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
> Is this a spring problem? Don't understand why the ArrayList will mapped
> to a org.eclipse.emf.teneo.eclipselink.elist.IndirectEList?
>
> On the client Side I want wo work with a ArrayList not with a teneo List...
>
> Do anybody find a mistake?
>
> Thank


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Importing an XMI file
Next Topic:Define Containment Childrens in second Ecore Model
Goto Forum:
  


Current Time: Fri Mar 29 02:08:20 GMT 2024

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

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

Back to the top