The problem is, although the validation works, I cannot get ride of this exception:

0 ERROR LazyLinkingResource - resolution of uriFragment 'xtextLink_::0.0.0.1.0::0::/3' failed.
org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:346)
at org.eclipse.xtext.linking.lazy.LazyURIEncoder.resolveShortFragment(LazyURIEncoder.java:109)
at org.eclipse.xtext.linking.lazy.LazyURIEncoder.decode(LazyURIEncoder.java:89)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:166)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:223)
at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:197)
at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:257)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(BasicEObjectImpl.java:1473)
at org.xtext.example.mydsl1.myDsl1.impl.TestName2Impl.getName(TestName2Impl.java:73)
at org.xtext.example.mydsl1.myDsl1.impl.TestName2Impl.eGet(TestName2Impl.java:117)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1011)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:403)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryReferenceIsContained(EObjectValidator.java:782)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDefaultConstraint(EObjectValidator.java:355)
at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1420)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:333)
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:126)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:159)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:178)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:162)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:108)
at org.xtext.example.mydsl1.generator.Main.runGenerator(Main.java:80)
at org.xtext.example.mydsl1.generator.Main.main(Main.java:39)
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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

Does anybody encoutered this and have any suggestion to share?
Thanks a lot,
Nuno

why do you do the compositeResource.getContents().addAll(modelFromFile.getContents()); at all?

"the model" is the set off all resources aka resourceset.

if you add all required resources to the resourceset you wont get errors like that.
you may call compositeResource.getContents().addAll(modelFromFile.getContents());
to resolve all lazy cross refs after you added all resources to the resourceset