[mdr-users] NullPointerException

Cheng yong <[email protected]> Thu, 14 Jul 2005 16:53:43 -0700 (PDT)
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hello, everyone, 
 
I'm now making my own example according to the online document and try to figure out how the MDR works. Now I have got an NullPointerException Error. Can anyone help me? 
 
What I did is as following:
1. NetBeans IDE 3.5.1: imported Metadata UML 1.4 (01-02-15_Diff.xml) and generated the JMI Interfaces.
2. Eclipse 3.1: created a new project, added all .jar files which I can find in the installation folder, imported all generated files. 
3. Eclipse 3.1: created a new demo class, 
 
package demo;
import java.io.OutputStream;
import java.util.Iterator;
import org.netbeans.api.mdr.MDRManager;
import org.netbeans.api.mdr.MDRepository;
import org.netbeans.api.xmi.XMIWriterFactory;
import org.omg.uml.*;
import org.omg.uml.behavioralelements.activitygraphs.*;
public class Demo {
    
    public static void main(String[] args) {
        
        OutputStream out = null;

        MDRepository repository = MDRManager.getDefault().getDefaultRepository();

        UmlPackage extent = (UmlPackage) repository.getExtent("Projects metadata");
        try{
            XMIWriterFactory.getDefault().createXMIWriter().write(out,extent,"1.2");
            System.out.println(out.toString());
        } catch(Exception e){
            System.out.println("ERROR!");
        }
    }
}

4. Eclipse 3.1: runed the demo, got the error:
 
java.lang.NullPointerException
 at org.netbeans.modules.mdr.MDRManagerImpl.refreshChildren(MDRManagerImpl.java:61)
 at org.netbeans.modules.mdr.MDRManagerImpl.init(MDRManagerImpl.java:84)
 at org.netbeans.modules.mdr.MDRManagerImpl.getRepository(MDRManagerImpl.java:94)
 at org.netbeans.modules.mdr.MDRManagerImpl.getDefaultRepository(MDRManagerImpl.java:105)
 at demo.Demo.main(Demo.java:18)
Exception in thread "main" 
 
thanks
 
Lucia

		
---------------------------------
 Start your day with Yahoo! - make it your home page