javamodelemfmetamodelecore

java.lang.SecurityException: class "org.eclipse.emf.ecore.resource.URIConverter$Loadable"'s


Someone help me why I am getting this error?

 java.lang.SecurityException: class "org.eclipse.emf.ecore.resource.URIConverter$Loadable"'s signer information does not match signer information of other classes in the same package  at java.lang.ClassLoader.checkCerts(ClassLoader.java:898)

I want to load a metamodel (dart.ecore) file and a model file (dartlang.dart).

ResourceSet resourceSet = new ResourceSetImpl(); 
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new  XMIResourceFactoryImpl());
Resource myMetaModel= resourceSet.getResource(URI.createFileURI("./metamodel/dart.ecore"), true);
EPackage univEPackage = (EPackage) myMetaModel.getContents().get(0);
resourceSet.getPackageRegistry().put("http://gholizadeh.org", univEPackage);
Resource myModel = resourceSet.getResource( URI.createURI( "./model/dartlang.dartspec"), true);

import :

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;

Thank you !


Solution

  • This is commonly caused by having the same class loaded multiple times from different jars. The answers here explain in detail and provide some nice solutions: java-securityexception-signer-information-does-not-match

    The easiest two solutions are to either remove the duplicate jar file, or sometimes changing the order of the jars in your eclipse build can work.

    If that isn't enough to help, we will need more information about your project setup; such as how are you managing dependencies and is it an eclipse plugin project.