[mdr-users] NullPointer Exception with MDR StandAlone
[email protected] Fri, 27 Jan 2006 16:49:47 -0200 (BRST)
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Martin,
The other problem with the classes I solved. Now, my jar file with my
project it´s correct, but I´m with problems in the mdr files location. I´m
with a NullPointerException. Is it necessary to create or extend any class
to run standalone like standalonemanager and others? I read something
about this but. My method with problems it´s below:
public void initRepository() {
Map properties = new HashMap();
properties.put("storage","org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeFactory");
properties.put(BtreeFactory.STORAGE_FILE_NAME, pathMDR);
MDRepository repository = new NBMDRepositoryImpl(properties);
ModelPackage modelPackage = (ModelPackage)
repository.getExtent("Projects model");
if(modelPackage == null) {
try {
modelPackage = (ModelPackage)
repository.createExtent("Projects model");
} catch (CreationFailedException e) {
};
}
XmiReader xmiReader = (XmiReader)
Lookup.getDefault().lookup(XmiReader.class);
URL url = this.getClass().getResource("Projects.xml");
try {
xmiReader.read(url.toExternalForm(), modelPackage);
} catch (IOException a) {
} catch (MalformedXMIException b) {
System.out.println(b.getMessage());
}
}