[prev in list] [next in list] [prev in thread] [next in thread] 

List:       james-user
Subject:    Could not create enough Components to service your request - POP3
From:       "Marcello Marangio" <m.marangio () tno ! it>
Date:       2007-03-28 15:20:00
Message-ID: 008a01c7714c$90222b00$3352428a () csata ! tno ! it
[Download RAW message or body]

Hi all
I am trying to create a distributed locking mechanism for POP3 in james.
What I am trying to do is a very simple table-based mechanism, to lock some
resource in POP3Handler.doPASS and release it in POP3Handler.doQUIT.
At the moment the problem is how to get a valid db connection using Avalon
framework.

What I did is create a default  POP3Handler constructor like this:

 public POP3Handler(){
	try{
1		DefaultComponentManager ss = new DefaultComponentManager();
2		DataSourceSelector ds =(DataSourceSelector)
ss.lookup(DataSourceSelector.ROLE);
3	DataSourceComponent dc = (DataSourceComponent) ds.select("maildb");
4	conn = dc.getConnection();
	}
	catch(Exception e){
.....
	}
}

I get an exception:
	Could not create enough Components to service your request.
Apart from the deprecated object/methods, it doesn't work, because, I guess,
I tried to instantiate the DefaultComponentManager directly.
I copied this code from what I did  while ago, to get a valid db connection
into a mailet, where the line 1 originally was:

DefaultComponentManager cm =
DefaultComponentManager)getMailetContext().getAttribute(Constants.AVALON_COM
PONENT_MANAGER);
 
And it worked.

I am pretty newbie of Avalon, but how can I get a proper instance of the
DefaultComponentManager?

Any help is really appreciated.

Thanks

-------------------------------
Marcello


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic