When you launch merlin use the -info command line switch to get a list of the respective repository settings. This will show you the details of the system cache, the application cache, the remote repositories, etc. If that does not identify the problem could you post the -info trace to the list.
Cheers, Steve.
Olaf Bergner wrote:
In order to get a grip on Merlin I am currently writing a little app embedding it. I would like to have a local installation where merlin will look for dependencies in a local cache first and will then fall back to the usual suspects maven.repo.local, http://dpml.net/, http://www.ibiblio.org/maven/:
app.home - bin | - lib | _ cache (1)
maven.repo.local (2)
http://dpml.net (3)
http://www.ibiblio.org/maven/ (4)
Following a fairly recent thread on this list I started out by adapting org.apache.avalon.merlin.unit.AbstractMerlinTestCase and customizing kernel.xml (see below). When running my main class, however, I get
---- cause --------------------------------------------------------------------- Exception: java.io.FileNotFoundException Message: file:\C:\Data\OBergner\Maven\repository\avalon-framework\jars\avalon-framewo rk-impl-4.1.5.jar (Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr�gerbezeichnung ist falsch)
in factory.create(criteria). I am very likely making a really stupid mistake, but right now I am stuck and would be thankful if someone could point me to a solution.
Ultimately, I would like to embed Merlin into a servlet. Any best practices or, even better, code samples?
Thanks, Olaf Bergner
(1) Main class:
<snip> public static void main(final String[] args) throws Exception { final File cache = new File(getBaseDirectory(), "cache"); final File repo = new File(getMavenLocalHome(), "repository");
Artifact artifact = DefaultBuilder.createImplementationArtifact( bootstrap, getBaseDirectory(), getBaseDirectory(), MERLIN_PROPERTIES, IMPLEMENTATION_KEY);
final String repository = repo.toURL().toString(); final String[] hosts = { repository, "http://dpml.net", "http://www.ibiblio.org/maven/" };
InitialContext context = new DefaultInitialContext(cache, hosts);
Builder builder = new DefaultBuilder(context, artifact); final ClassLoader classloader = builder.getClassLoader(); Factory factory = builder.getFactory(); Map criteria = factory.createDefaultCriteria();
...
final Object kernel = factory.create(criteria); ... } </snip>
(2) kernel.xml:
<snip> <kernel> ... <cache>C:/Projekte/OBergner/EclipseWorkspace/merlin-aspects/cache</cache> <repository> <hosts> <host path="file:/C:/Data/OBergner/Maven/repository/"/> <host path="http://dpml.net/"/> <host path="http://www.ibiblio.org/maven/"/> </hosts> </repository> </kernel> </snip>
(3) Full stacktrace:
[INFO ] (kernel): installing: file:/${user.dir}/samples/conf/sample.block ---- exception report ---------------------------------------------------------- Exception: org.apache.avalon.merlin.KernelException Message: Install failure: file:/C:/Projekte/OBergner/EclipseWorkspace/merlin-aspects/samples/conf/samp le.block ---- cause --------------------------------------------------------------------- Exception: org.apache.avalon.composition.model.ModelException Message: Could not create classloader. ---- cause --------------------------------------------------------------------- Exception: org.apache.avalon.repository.RepositoryException Message: Failed to download artifact to local cache file C:\Projekte\OBergner\EclipseWorkspace\merlin-aspects\file:\C:\Data\OBergner\ Maven\repository\avalon-framework\jars\avalon-framework-impl-4.1.5.jar from hosts: file:///C:/Data/OBergner/Maven/repository/ http://dpml.net/ http://www.ibiblio.org/maven/ ---- cause --------------------------------------------------------------------- Exception: java.io.FileNotFoundException Message: file:\C:\Data\OBergner\Maven\repository\avalon-framework\jars\avalon-framewo rk-impl-4.1.5.jar (Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr�gerbezeichnung ist falsch) ---- stack trace --------------------------------------------------------------- java.io.FileNotFoundException: file:\C:\Data\OBergner\Maven\repository\avalon-framework\jars\avalon-framewo rk-impl-4.1.5.jar (Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr�gerbezeichnung ist falsch) java.io.FileOutputStream.open(Native Method) java.io.FileOutputStream.<init>(Unknown Source) java.io.FileOutputStream.<init>(Unknown Source) org.apache.avalon.repository.util.LOADER.getResource(LOADER.java:353) org.apache.avalon.repository.util.LOADER.getResource(LOADER.java:112) org.apache.avalon.repository.impl.DefaultRepository.getResource(DefaultRepos itory.java:170) org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.createClass Path(DefaultClassLoaderModel.java:467) org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.<init>(Defa ultClassLoaderModel.java:212) org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.createClass LoaderModel(DefaultClassLoaderModel.java:129) org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta inmentModel(DefaultContainmentModel.java:464) org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta inmentModel(DefaultContainmentModel.java:427) org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta inmentModel(DefaultContainmentModel.java:663) org.apache.avalon.composition.model.impl.DefaultContainmentModel.addContainm entModel(DefaultContainmentModel.java:288) org.apache.avalon.composition.model.impl.DefaultContainmentModel.addModel(De faultContainmentModel.java:282) org.apache.avalon.merlin.impl.DefaultFactory.create(DefaultFactory.java:488) org.merlinaop.main.Main.main(Main.java:131) ---------------------------------------------------------------------------- ----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
