Hello!!!
I have just started using AbstractMerlinTestCase and I have problem with
setting classpath from ant.
My build.xml contains following target:
<target name="unittest">
<junit showoutput="true" fork="true" printsummary="yes">
<batchtest>
<formatter type="plain"/>
<fileset dir="${build.classes.dir}">
<include name="**/tests/**"/>
</fileset>
</batchtest>
</junit>
</target>
block.xml contains followin classloader definition:
<classloader>
<classpath>
<fileset dir="libs">
<include name="hibernate-2.1.2.jar"/>
<include name="commons-lang-2.0.jar"/>
<include name="dom4j-1.3.jar"/>
<include name="commons-logging-1.0.3.jar"/>
<include name="commons-collections-2.1.jar"/>
<include name="cglib-2.0-rc2.jar"/>
<include name="hsqldb-1.7.1.jar"/>
<include name="jta.jar"/>
<include name="ehcache-0.6.jar"/>
<include name="commons-beanutils-1.6.jar"/>
<include name="odmg.jar"/>
<include name="protomatter-1.1.8.jar"/>
<include name="avalon-scratchpad-4.1.jar"/>
</fileset>
</classpath>
</classloader>
When I run this target I get NoClassDefFoundException.
Exception: org.apache.avalon.merlin.KernelException
Message: Kernel startup failure.
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Application deployment failure.
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.activation.appliance.DeploymentException
Message: Composite deployment failure in block: [block:/mrt-vend-client]
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.activation.lifecycle.LifecycleException
Message: Unable to create a new component instance in appliance
[/mrt-vend-client/hibernate-service] due to a component deployment failure.
----
cause ---------------------------------------------------------------------
Exception: java.lang.NoClassDefFoundError
Message: org/apache/commons/collections/SequencedHashMap
---- stack
trace ---------------------------------------------------------------
java.lang.NoClassDefFoundError:
org/apache/commons/collections/SequencedHashMap
net.sf.hibernate.mapping.PersistentClass.<init>(PersistentClass.java:30)
net.sf.hibernate.mapping.RootClass.<init>(RootClass.java:16)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1228)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:285)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:315)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:973)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:856)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:842)
com.mrt.service.hibernate.HibernateServiceImpl.loadConfigurationDefault(Hibe
rnateServiceImpl.java:308)
com.mrt.service.hibernate.HibernateServiceImpl.loadConfiguration(HibernateSe
rviceImpl.java:217)
com.mrt.service.hibernate.HibernateServiceImpl.parameterize(HibernateService
Impl.java:97)
com.mrt.service.hibernate.HibernateServiceImpl.configure(HibernateServiceImp
l.java:114)
org.apache.avalon.activation.appliance.impl.DefaultAppliance.applyConfigurat
ion(DefaultAppliance.java:781)
org.apache.avalon.activation.appliance.impl.DefaultAppliance.access$1000(Def
aultAppliance.java:109)
org.apache.avalon.activation.appliance.impl.DefaultAppliance$StandardFactory
.newInstance(DefaultAppliance.java:1323)
org.apache.avalon.activation.lifestyle.impl.SingletonLifestyleHandler.refres
hReference(SingletonLifestyleHandler.java:138)
org.apache.avalon.activation.lifestyle.impl.SingletonLifestyleHandler.resolv
e(SingletonLifestyleHandler.java:88)
org.apache.avalon.activation.appliance.impl.DefaultAppliance.resolve(Default
Appliance.java:583)
org.apache.avalon.activation.appliance.impl.DefaultAppliance.deploy(DefaultA
ppliance.java:519)
org.apache.avalon.activation.appliance.impl.AbstractBlock.deploy(AbstractBlo
ck.java:712)
org.apache.avalon.activation.appliance.impl.BlockThread.run(BlockThread.java
:111)
----------------------------------------------------------------------------
----
at
org.apache.avalon.merlin.unit.AbstractMerlinTestCase.setUp(AbstractMerlinTes
tCase.java:210)
This class is located in commons-collections jar included in block.xml, when
I add this jar to classpath declaration in my build.xml everything
works.Where is a problem?
Second question is about container classloader.I would like to have
different block.xml's for every test case (stored for example in src/conf
directory) and use classes and .xinfo files located in build/classes
directory.Because when I set merlin.deployment property to
src/conf/block-location-test.xml and add build/classes to classpath merlin
can't start because it cannot find component type descriptor.
---- exception
report ----------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Install failure:
file:/C:/projekty/mrt-vend2/src/conf/block-client.xml
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.ModelException
Message: Unable to create a nested deployment model: hibernate-service in
the containment model /.
----
cause ---------------------------------------------------------------------
Exception: org.apache.avalon.composition.model.TypeUnknownException
Message: Unable to locate a component type descriptor for the component
class [com.mrt.service.hibernate.HibernateServiceImpl] in the classloader.
Please verify that the component classname is correct and that a component
type descriptor is included in a jar file available within the container
classloader.
---- stack
trace ---------------------------------------------------------------
org.apache.avalon.composition.model.TypeUnknownException: Unable to locate a
component type descriptor for the component class
[com.mrt.service.hibernate.HibernateServiceImpl] in the classloader. Please
verify that the component classname is correct and that a component type
descriptor is included in a jar file available within the container
classloader.
org.apache.avalon.composition.model.impl.DefaultTypeRepository.getType(Defau
ltTypeRepository.java:277)
org.apache.avalon.composition.model.impl.DefaultTypeRepository.getType(Defau
ltTypeRepository.java:242)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createDeplo
ymentModel(DefaultContainmentModel.java:544)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addModel(De
faultContainmentModel.java:397)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.<init>(Defa
ultContainmentModel.java:221)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:651)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:597)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.createConta
inmentModel(DefaultContainmentModel.java:844)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addContainm
entModel(DefaultContainmentModel.java:376)
org.apache.avalon.composition.model.impl.DefaultContainmentModel.addModel(De
faultContainmentModel.java:370)
org.apache.avalon.merlin.impl.DefaultFactory.create(DefaultFactory.java:488)
org.apache.avalon.merlin.unit.AbstractMerlinTestCase.setUp(AbstractMerlinTes
tCase.java:198)
junit.framework.TestCase.runBare(TestCase.java:125)
junit.framework.TestResult$1.protect(TestResult.java:106)
junit.framework.TestResult.runProtected(TestResult.java:124)
junit.framework.TestResult.run(TestResult.java:109)
junit.framework.TestCase.run(TestCase.java:118)
junit.framework.TestSuite.runTest(TestSuite.java:208)
junit.framework.TestSuite.run(TestSuite.java:203)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:392)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:276)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:167)
----------------------------------------------------------------------------
----
Could you help me?
Jaroslaw Palka
MRT System
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]