avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hamilton Verissimo de Oliveira (Engenharia - SPO)" <hamilton.olive...@agenciaclick.com.br>
Subject RES: [Fortress] What can possibly be wrong
Date Thu, 08 Jan 2004 14:46:17 GMT
-----Mensagem original-----
De: Berin Loritsch [mailto:bloritsch@apache.org]

> What is happening in the logs?  What is the classpath?


I realized two different situations. If I debug using eclipse its won't file
the service.list. Ok, classloader issues...

Running standalone the fortress.log tells:

DEBUG   10735   [fortress] (): Reading meta info for
com.agenciaclick.business.impl.DefaultEntityPersistence
DEBUG   10735   [fortress] (): addComponent component:
type='com.agenciaclick.business.impl.DefaultEntityPersistence',
meta='{x-avalon.lifestyle=singleton, x-avalon.name=entitypersistence}',
role='com.agenciaclick.business.common.EntityPersistence', with
deps=[com.agenciaclick.data.Database]

<...>

The last entry is:

DEBUG   10735   [fortress] (): Component initialization order:

And my console tells:


java -jar agenciaclick.jar
DEBUG   2004-01-08 11:29:19.472 [fortress] (): Added new LogTargetFactory of
type file.
DEBUG   2004-01-08 11:29:19.542 [fortress] (): Added new LogTarget of id
root.
Exception in thread "main"
org.apache.avalon.framework.service.ServiceException:
 Unable to provide implementation for
com.agenciaclick.business.common.Entity
(Key='com.agenciaclick.business.common.Entity')
        at
org.apache.avalon.framework.service.DefaultServiceManager.lookup(DefaultServ
iceManager.java:117)
        at
org.apache.avalon.fortress.util.ContextManager$EAServiceManager.lookup(Conte
xtManager.java:1042)
        at
org.apache.avalon.fortress.impl.lookup.FortressServiceManager.lookup(Fortres
sServiceManager.java:106)
        at com.agenciaclick.main.Main.main(Main.java:40)


> How did you get the thing started in code?


Its pretty simple:


 public static final void main( String[] args )
        throws Exception
    {
        FortressConfig config = new FortressConfig();
        config.setContextClassLoader(
Thread.currentThread().getContextClassLoader() );
        config.setContainerClass( SimpleContainer.class );
        config.setContainerConfiguration(
"resource://com/agenciaclick/main/Container.xconf" );
        config.setLoggerManagerConfiguration(
"resource://com/agenciaclick/main/Container.xlog" );

        final ContainerManager cm = new DefaultContainerManager(
config.getContext() );
        ContainerUtil.initialize( cm );

		container = (SimpleContainer) cm.getContainer();
		
		// Exemplo de uso
		
		ServiceManager manager = container.getServiceManager();
		
		Entity entity = (Entity) manager.lookup( Entity.ROLE );
		
		entity.setName( "John doe" );
		entity.save();
		
		manager.release( entity );

        ContainerUtil.dispose( cm );
    }

And SimpleContainer source code follows:

public class SimpleContainer extends DefaultContainer
{
	public void initialize() throws CompositeException, Exception
	{
		super.initialize();
	}
}



Still a puzzle to me :-\


regards,
hammett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message