Classpath error when embedding merlin into a commandline application

Rajamani Saravanan <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
Hi,

I'm trying to embed merlin into a simple main() method. This is the
code I'm using :

      File fBase = new File(System.getProperty("merlin.home"));
      InitialContextFactory initial = new
DefaultInitialContextFactory("merlin", fBase);
      
      File fHome = initial.getHomeDirectory();
      initial.setCacheDirectory(new File(fHome, "system"));
      
      InitialContext context = initial.createInitialContext();

      Artifact artifact = DefaultBuilder.createImplementationArtifact( 
          Main.class.getClassLoader(), null, fBase, MERLIN_PROPERTIES,
IMPLEMENTATION_KEY);

      Builder builder = context.newBuilder(artifact);
      Factory factory = builder.getFactory();
      
      KernelCriteria m_criteria = (KernelCriteria)
factory.createDefaultCriteria();
        m_criteria.put("merlin.server", "false");
        m_criteria.put("merlin.info", "true");
        m_criteria.put("merlin.debug", "false");
      

When I try running the sample, I get the following error :

org.apache.avalon.repository.RepositoryException: Unable to establish
a factory for the supplied artifact:
 artifact: artifact:merlin/merlin-impl#3.3.0
 build: 20040519.080020
 factory: org.apache.avalon.merlin.impl.DefaultFactory

Caused by: java.lang.NoClassDefFoundError:
org/apache/avalon/composition/provider/SystemContextFactory
        at java.lang.Class.getDeclaredConstructors0(Native Method)

- Whatever is listed in project.xml as dependencies is there in the
classpath when I run the script... Can someone let me know what set of
jar files am I supposed to be including in the classpath when I run
the application?

Thanks, and Brgds,


R. Saravanan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.