Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Copying one model with reference to another => ClassCastException
[ATL] Copying one model with reference to another => ClassCastException [message #80697] Mon, 05 May 2008 14:57 Go to next message
Eclipse UserFriend
Originally posted by: goetz.botterweck.lero.ie

This is a multi-part message in MIME format.
--------------050108050304020308090206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

WHAT I WANT TO DO

I have two model files My.amodel and My.bmodel
My.bmodel contains references to My.amodel

Now I want to use ATL to create a copy from My.bmodel to My_out.bmodel
Preserving the references to My.amodel


THE PROBLEM

This works as long as I just copy the elements in My.bmodel without the
refs to My.amodel.

As soon as I try to set the references to the corresponding elements in
My.amodel the transformation fails with a java.lang.ClassCastException.
See the problematic line at ##### in the ATL file below.

Thanks for any hints,
Goetz

See attachment with zip of project.

--------- ADDITIONAL INFOS ---------

I assume that the problem comes from the fact that ATL tries to handle
elements in My.amodel and for some reason it has wrong information about
the meta-model and the classes in it. Hence, it tries to do a cast.
Whereas I would expect it to leave My.amodel untouched.

Could something be wrong with the "registration" or identification of
EMF/Ecore meta models (with Namespace/URI) . Could I check something
about that? I noticed that, despite the launch configuration, the
transformation will only execute of the .ecore files are in certain
folders in the workspace.

--------- copyBModelWithRefs.atl ---------

module copyBModelWithoutRefs; -- Module Template
create bout : BMETA, aout : AMETA from bin : BMETA, ain : AMETA;

rule BModel {
from s : BMETA!BModel
to t : BMETA!BModel mapsTo s (
name <- s.name.debug('BModel'),
elements <- s.elements
)
}

rule BElement {
from s : BMETA!BElement
to t : BMETA!BElement mapsTo s (
name <- s.name.debug('BElement'),

-- ##### THIS IS THE PROBLEMATIC LINE #####
correspondingAElement <- s.correspondingAElement
)
}

--------- Stacktrace ---------

INFO: BModel: 'BModel1'
INFO: BElement: 'BElement1'
SCHWERWIEGEND: ****** BEGIN Stack Trace
SCHWERWIEGEND: exception:
SCHWERWIEGEND: The value of type 'class
org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
(instanceClassName: null) (abstract: false, interface: false)'
java.lang.ClassCastException: The value of type 'class
org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
(instanceClassName: null) (abstract: false, interface: false)'
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl .java:2301)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1017)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:147)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:301)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:326)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:426)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:398)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:42)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:759)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
SCHWERWIEGEND: A.main() : ??#24 null
SCHWERWIEGEND: local variables = {self=copyBModelWithoutRefs : ASMModule}
SCHWERWIEGEND: local stack = []
SCHWERWIEGEND: A.__exec__() : ??#18 null
SCHWERWIEGEND: local variables = {e=TransientLink {rule = 'BElement',
sourceElements = {s = bin!BElement1}, targetElements = {t =
bout!BElement1}, variables = {}}, self=copyBModelWithoutRefs : ASMModule}
SCHWERWIEGEND: local stack = []
SCHWERWIEGEND: A.__applyBElement(1 : NTransientLink;) : ??#20 18:28-18:51
SCHWERWIEGEND: local variables = {t=bout!BElement1, s=bin!BElement1,
link=TransientLink {rule = 'BElement', sourceElements = {s =
bin!BElement1}, targetElements = {t = bout!BElement1}, variables = {}},
self=copyBModelWithoutRefs : ASMModule}
SCHWERWIEGEND: local stack = [bout!BElement1, bout!BElement1,
copyBModelWithoutRefs : ASMModule]
SCHWERWIEGEND: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to
allow continuation after errors).
SCHWERWIEGEND: null
java.lang.RuntimeException
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:95)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:87)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:173)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:326)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:426)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:398)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:42)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:759)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ClassCastException: The value of type 'class
org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
(instanceClassName: null) (abstract: false, interface: false)'
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl .java:2301)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1017)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:147)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:301)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
... 22 more




--------------050108050304020308090206
Content-Type: application/x-zip-compressed;
name="ATLCookbook_filterWithRefs.zip"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="ATLCookbook_filterWithRefs.zip"

UEsDBBQACAAIABl+pTgAAAAAAAAAAAAAAAAjAAAAQVRMQ29va2Jvb2tfZmls dGVyV2l0aFJl
ZnMvLnByb2plY3SNkLsKAjEQRWsF/0G2N1Eri7jiAyux8IGlxOy4RvNYkqz4 +SYxKmtlMTDn
cmfmMmTykKJ7B2O5VuNsgPpZFxTTBVflONvvlr1RNsk7bVIZfQXmFmCZ4ZXz bq+2iKIS8ulu
Ndf6dvJ1PHPhwBy4u2zgbAmOhuBkWkpQLif43QU1rbURcINONRfFtgIWKOHc j1JVRCUd16ZE
wASvLCA5lIg6gWjhUPSDCTx7td8wfpaasg4pbGLcFAj+vZeUdyB/3NUGkvsF /2RZR2eIEifi
4u+qzwuaf34CUEsHCAv15IXWAAAApgEAAFBLAwQUAAgACAAZfqU4AAAAAAAA AAAAAAAAQwAA
AEFUTENvb2tib29rX2ZpbHRlcldpdGhSZWZzL2xhdW5jaC9BVExDb29rYm9v a19maWx0ZXJX
aXRoUmVmcy5sYXVuY2idlk1vm0AQhu+V+h8Qp/YQaHPqIU5kO1ixZOIoxu0x WmDA2yy7aD/i
8O87QEyxC9j0YFkM8z7vzDBauLl7z5j1BlJRwSf2d+ebbQGPREx5OrG3weLq h20pTXhMmOAw
sbmw724/f7phxPBoNxc8oamRRKPc0kWOGUKmDkSM5gqc7DpziGYOibVTK5Bb RgJJuEqEzCql
XRKVlnhzqvEvNBqsVygm9jRYWQvKwHokGdjWG2EGLVwMz4V4DfH3klCmQf6i evcMiXL1EVm5
kciLmS9iYIeU0t92By1/+o3XM6SGEYkh68seCVYMoUlTkF9rBtbAgPBTCGNi v+RYWGWNtiBx
rqAarpYGakJG8hP1kudG2x/3PK5lUccJ5Y1+6nvBtAG0ksJW0uxvktu26bZd 0VANNVW2Yt2X
7TcGCWGqt42qdesBl4eB7GinbuGA8vxFVzuz7qQL2qnsA9zJrkkKHPAB6q/v vdV6Gzxtg64K
jsssL84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AAACJ
AQAAKwAAAAAAAAAAAAAAAACMCAAAQVRMQ29va2Jvb2tfZmlsdGVyV2l0aFJl ZnMvbW9kZWxz
L015LmJtb2RlbFBLAQIUABQACAAIABl+pThcdk92YAAAAG4AAAAvAAAAAAAA AAAAAAAAAKMJ
AABBVExDb29rYm9va19maWx0ZXJXaXRoUmVmcy9tb2RlbHMvTXlfb3V0LmFt b2RlbFBLAQIU
ABQACAAIABl+pThPma3ElwAAAOcAAAAvAAAAAAAAAAAAAAAAAGAKAABBVExD b29rYm9va19m
aWx0ZXJXaXRoUmVmcy9tb2RlbHMvTXlfb3V0LmJtb2RlbFBLAQIUABQACAAI ABl+pThacphD
aQYAALItAABBAAAAAAAAAAAAAAAAAFQLAABBVExDb29rYm9va19maWx0ZXJX aXRoUmVmcy90
cmFuc2Zvcm1hdGlvbnMvY29weUJNb2RlbFdpdGhSZWZzLmFzbVBLAQIUABQA CAAIABl+pThw
l/5p8wAAANYBAABBAAAAAAAAAAAAAAAAACwSAABBVExDb29rYm9va19maWx0 ZXJXaXRoUmVm
cy90cmFuc2Zvcm1hdGlvbnMvY29weUJNb2RlbFdpdGhSZWZzLmF0bFBLBQYA AAAACgAKAM4D
AACOEwAAAAA=
--------------050108050304020308090206--
Re: [ATL] Copying one model with reference to another => ClassCastException [message #80795 is a reply to message #80697] Tue, 06 May 2008 10:06 Go to previous message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
Hello,

Goetz Botterweck a écrit :
> WHAT I WANT TO DO
>
> I have two model files My.amodel and My.bmodel
> My.bmodel contains references to My.amodel
>
> Now I want to use ATL to create a copy from My.bmodel to My_out.bmodel
> Preserving the references to My.amodel
>
>

So you don't want to recreate a My_out.amodel ? I ask because that's the
case in your transformation sample.

> THE PROBLEM
>
> This works as long as I just copy the elements in My.bmodel without the
> refs to My.amodel.
>
> As soon as I try to set the references to the corresponding elements in
> My.amodel the transformation fails with a java.lang.ClassCastException.
> See the problematic line at ##### in the ATL file below.
>
> Thanks for any hints,
> Goetz
>
> See attachment with zip of project.

I tried your sample but the metamodel B didn't validate because the
reference to AElements was incorrectly set.

Here is your file :
<eStructuralFeatures xsi:type="ecore:EReference"
name="correspondingAElement"
ordered="false" eType="ecore:EClass
.../../org.example.amodel/model/amodel.ecore#//AElement"/>

And the value I corrected :
<eStructuralFeatures xsi:type="ecore:EReference"
name="correspondingAElement"
ordered="false" eType="ecore:EClass amodel.ecore#//AElement"/>

>
> --------- ADDITIONAL INFOS ---------
>
> I assume that the problem comes from the fact that ATL tries to handle
> elements in My.amodel and for some reason it has wrong information about
> the meta-model and the classes in it. Hence, it tries to do a cast.
> Whereas I would expect it to leave My.amodel untouched.
>
> Could something be wrong with the "registration" or identification of
> EMF/Ecore meta models (with Namespace/URI) . Could I check something
> about that? I noticed that, despite the launch configuration, the
> transformation will only execute of the .ecore files are in certain
> folders in the workspace.
>
> --------- copyBModelWithRefs.atl ---------
>
> module copyBModelWithoutRefs; -- Module Template
> create bout : BMETA, aout : AMETA from bin : BMETA, ain : AMETA;
>

If you don't want to copy AMETA elements, you don't need to refer to the
ain/aout models.
Just do :
create bout : BMETA from bin : BMETA;

When there is a reference between two input models, the metamodel
reference is implicit, and the two models are loaded.

> rule BModel {
> from s : BMETA!BModel
> to t : BMETA!BModel mapsTo s (
> name <- s.name.debug('BModel'),
> elements <- s.elements
> )
> }
>

Notice that the mapsTo instruction belongs to ATL syntax but has no
effects for now.

> rule BElement {
> from s : BMETA!BElement
> to t : BMETA!BElement mapsTo s (
> name <- s.name.debug('BElement'),
>
> -- ##### THIS IS THE PROBLEMATIC LINE #####
> correspondingAElement <- s.correspondingAElement
> )
> }
>

Finally, you need to know that the loading of referenced metamodel has
been corrected recently. So check you use the last ATL version.

Best regards,

William

> --------- Stacktrace ---------
>
> INFO: BModel: 'BModel1'
> INFO: BElement: 'BElement1'
> SCHWERWIEGEND: ****** BEGIN Stack Trace
> SCHWERWIEGEND: exception:
> SCHWERWIEGEND: The value of type 'class
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
> 'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
> (instanceClassName: null) (abstract: false, interface: false)'
> java.lang.ClassCastException: The value of type 'class
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
> 'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
> (instanceClassName: null) (abstract: false, interface: false)'
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl .java:2301)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1017)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:147)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:301)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
>
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:326)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:426)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:398)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:42)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:759)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> SCHWERWIEGEND: A.main() : ??#24 null
> SCHWERWIEGEND: local variables = {self=copyBModelWithoutRefs :
> ASMModule}
> SCHWERWIEGEND: local stack = []
> SCHWERWIEGEND: A.__exec__() : ??#18 null
> SCHWERWIEGEND: local variables = {e=TransientLink {rule =
> 'BElement', sourceElements = {s = bin!BElement1}, targetElements = {t =
> bout!BElement1}, variables = {}}, self=copyBModelWithoutRefs : ASMModule}
> SCHWERWIEGEND: local stack = []
> SCHWERWIEGEND: A.__applyBElement(1 : NTransientLink;) : ??#20 18:28-18:51
> SCHWERWIEGEND: local variables = {t=bout!BElement1, s=bin!BElement1,
> link=TransientLink {rule = 'BElement', sourceElements = {s =
> bin!BElement1}, targetElements = {t = bout!BElement1}, variables = {}},
> self=copyBModelWithoutRefs : ASMModule}
> SCHWERWIEGEND: local stack = [bout!BElement1, bout!BElement1,
> copyBModelWithoutRefs : ASMModule]
> SCHWERWIEGEND: ****** END Stack Trace
> INFO: Execution terminated due to error (see launch configuration to
> allow continuation after errors).
> SCHWERWIEGEND: null
> java.lang.RuntimeException
> at
> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:95)
>
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:87)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:173)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
>
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:326)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:426)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:398)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:42)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:759)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> Caused by: java.lang.ClassCastException: The value of type 'class
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
> 'org.eclipse.emf.ecore.impl.EClassImpl@8558b7 (name: AElement)
> (instanceClassName: null) (abstract: false, interface: false)'
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl .java:2301)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1017)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.get(A SMEMFModelElement.java:147)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:301)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> ... 22 more
>
>
>
Previous Topic:error lauch atl transformation programmatic - could not find model UML
Next Topic:Problem with ATL transformation
Goto Forum:
  


Current Time: Tue May 21 14:38:18 GMT 2019

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

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

Back to the top