Interesting error when adding log JAR

"David Leangen" <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
I noticed something interesting.

I am dynamically instantiating a component with a call like this:

  Factory factory = builder.getFactory();
  Map criteria = factory.createDefaultCriteria();
  criteria.put("merlin.deployment",
"artifact:block:components/my-component-0.0.1");
  criteria.put("merlin.deployment.timeout", "0");
  factory.create( criteria );

My component works fine.

Then I add the jars from avalon/logging to my classpath and I get the error
below. Took me a long time to figure out that there was a relationship with
logging, since nothing of the sort is mentioned in the error messages. Also,
because the error is misleading, I'm not able to figure out how to proceed.


It's no big deal, but I thought I'd mention it anyway.




org.apache.avalon.merlin.KernelException: Install failure:
artifact:block:components/my-component-xml-0.0.1
	at org.apache.avalon.merlin.impl.DefaultFactory.create(Unknown Source)
	at my.component.Test.testComponent(Test.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:421)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:305)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:186)
Caused by: org.apache.avalon.composition.model.ModelException: Unresolvable
artifact reference [artifact:block:components/my-component-0.0.1].
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(Unknown Source)
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addContainm
entModel(Unknown Source)
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addContainm
entModel(Unknown Source)
	... 17 more
Caused by: org.apache.avalon.composition.model.ModelException: Could not
create classloader.
	at
org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.<init>(Unkn
own Source)
	at
org.apache.avalon.composition.model.impl.DefaultClassLoaderModel.createClass
LoaderModel(Unknown Source)
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(Unknown Source)
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(Unknown Source)
	at
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(Unknown Source)
	... 20 more
Caused by: org.apache.avalon.composition.model.ModelException: Unexpected
error while scanning jar file:
file:/Z:/apps/avalon/.magic/repository/components/jars/my-component-0.0.1.ja
r
	at org.apache.avalon.composition.model.impl.Scanner.scanJarFileURL(Unknown
Source)
	at org.apache.avalon.composition.model.impl.Scanner.scanURL(Unknown Source)
	at org.apache.avalon.composition.model.impl.Scanner.scan(Unknown Source)
	... 25 more
Caused by: java.lang.Exception: Unable to locate resource from which to load
info for component implemented by class "com.company.component.Component".
	at
org.apache.avalon.meta.info.builder.TypeBuilder.buildFromXMLDescriptor(Unkno
wn Source)
	at org.apache.avalon.meta.info.builder.TypeBuilder.buildType(Unknown
Source)
	at org.apache.avalon.composition.model.impl.Scanner.addType(Unknown Source)
	at org.apache.avalon.composition.model.impl.Scanner.scanJarFile(Unknown
Source)
	... 28 more
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.