You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Bernd Fondermann <bf...@brainlounge.de> on 2006/05/19 18:07:43 UTC

Issue with 2.3 branch

Hi,

I discovered a potential issue today. I could not yet do an in-depth 
analysis of the problem, but maybe someone can reproduce.

I set up vanilla james config and in the users-store section replaced 
the default db-store with file.

After that I get the following errors every time I send a mail to an 
internal user account (and the mail is _not_ received):

19/05/06 17:50:21 INFO  James.Mailet: RemoteDelivery: Attempting 
delivery of Mail1148053815529-51 to host localhost at 127.0.0.1 for 
addresses [test_ext2@mail.sample.com]
19/05/06 17:50:21 INFO  James.Mailet: Error while storing mail.
java.lang.ClassCastException
         at 
org.apache.james.transport.mailets.UsersRepositoryAliasingForwarding.processMail(UsersRepositoryAliasingForwarding.java:193)
         at 
org.apache.james.transport.mailets.UsersRepositoryAliasingForwarding.service(UsersRepositoryAliasingForwarding.java:107)
         at 
org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:62)
         at 
org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:421)
         at 
org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:400)
         at 
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:306)
         at java.lang.Thread.run(Thread.java:534)
19/05/06 17:50:21 INFO  James.Mailet: RemoteDelivery: Mail 
(Mail1148053815529-51) sent successfully to localhost at 127.0.0.1 for 
[test_ext2@mail.sample.com]
19/05/06 17:50:21 INFO  James.Mailet: ToRepository: Storing mail 
Mail1148053821629-56 in file://var/mail/error


   Bernd

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


Re: Issue with 2.3 branch

Posted by Stefano Bagnara <ap...@bago.org>.
Noel J. Bergman wrote:
> Bernd Fondermann wrote:
> 
>> I set up vanilla james config and in the users-store section replaced
>> the default db-store with file.
> 
>> java.lang.ClassCastException
>> UsersRepositoryAliasingForwarding.java:193)
> 
> That is:  user = (JamesUser) usersRepository.getUserByName(username);
> 
> I'll check the code after lunch, but I seem to recall someone making some
> changes in that area.
> 
> 	--- Noel

Me, of course ;-)
I'll check this in the weekend.

Stefano


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


Re: Issue with 2.3 branch

Posted by Stefano Bagnara <ap...@bago.org>.
I need more information.

As far as I know aliasing and forwarding is available only when the user 
is a JamesUser.

The "UsersRepositoryAliasingForwarding" mailet is a mailet that compose 
the "old" LocalDelivery mailet. I introduced it during a refactoring a 
few months ago.

1) We should add a check: if the user is not a JamesUser we simply skip 
the aliasing/forwarding block, so we avoid the ClassCast.

But the problem is not so easy, and is not really there. The problem is 
probably in a refactoring I did 2 months ago to avoid the use of 
deprecated methods.

Before my refactoring, when adding users using RemoteManager the 
remoteManager called the MailServer.addUser method if you were on the 
localusers, otherwise it create new DefaultUser. the James.addUser was 
instead creating a DefaultJamesUser by default.

In fact this is not so correct: the best way would be to invoke the 
usersRepository.addUser method directly without using the DefaultUser 
object from RemoteManager.

This is easy but is not a solution again.

The UsersFileRepository.addUser(username, password) method, creates 
DefaultUsers and not DefaultJamesUsers by default.

One of the refactoring I planned for 2.4 was the 
UsersRepository/Authentication one, so this will be fixed for 2.4 
anyway, but we should also decide what to do for 2.3.

I would do at least:
a. Add a check to UsersRepositoryAliasingForwarding to skip non 
JamesUsers (easy bugfix)
b. Change the remotemanager to user the 
usersRepository.addUser(username, password) instead of creating a 
DefaultUser and use the usersRepository.addUser(user).

Then we have further options:
c1. do nothing else: we work differently from james 2.2 because newly 
created users for FileUsersRepository will not support aliasing/forwarding.
c2. we can change the FileUsersRepository.addUser method to create 
DefaultJamesUsers by default
c3. we can add a FileJamesUsersRepository identical to the 
FileUsersRepository but creating DefaultJamesUsers by default and put 
either put it as default in the config.xml or as an option.

My preference is for c2 or for c3 (adding it as the default).

I can do this tonight or tomorrow but I don't know if we should stop the 
a3 release or do it anyway letting users know it has critical bugs with 
file based users repository.

My preference is to release the a3 anyway: if we never release we'll 
always find similar bugs the day we vote for the following release :-(

Stefano

PS: I will open a JIRA issue to track this soon.

Noel J. Bergman wrote:
> Bernd Fondermann wrote:
> 
>> I set up vanilla james config and in the users-store section replaced
>> the default db-store with file.
> 
>> java.lang.ClassCastException
>> UsersRepositoryAliasingForwarding.java:193)
> 
> That is:  user = (JamesUser) usersRepository.getUserByName(username);
> 
> I'll check the code after lunch, but I seem to recall someone making some
> changes in that area.
> 
> 	--- Noel



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


Re: Issue with 2.3 branch

Posted by Bernd Fondermann <bf...@brainlounge.de>.
Norman Maurer wrote:
>>I can do this tonight or tomorrow but I don't know if we should stop the 
>>a3 release or do it anyway letting users know it has critical bugs with 
>>file based users repository.
>>
>>My preference is to release the a3 anyway: if we never release we'll 
>>always find similar bugs the day we vote for the following release :-(
>>
> 
> I agree here too.. its a alpha so we can release it with this bug..
> Maybe if we release this people will find other bugs too.

+1. that's why I voted to release it. but with a known bug the release 
is 'tainted' and some people will refrain from even testing it.

lets have an a4 as soon as this is fixed.

   Bernd

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


Re: Issue with 2.3 branch

Posted by Norman Maurer <nm...@byteaction.de>.
Am Freitag, den 19.05.2006, 20:01 +0200 schrieb Stefano Bagnara:
> I need more information.
> 
> As far as I know aliasing and forwarding is available only when the user 
> is a JamesUser.
> 
> The "UsersRepositoryAliasingForwarding" mailet is a mailet that compose 
> the "old" LocalDelivery mailet. I introduced it during a refactoring a 
> few months ago.
> 
> 1) We should add a check: if the user is not a JamesUser we simply skip 
> the aliasing/forwarding block, so we avoid the ClassCast.
> 
> But the problem is not so easy, and is not really there. The problem is 
> probably in a refactoring I did 2 months ago to avoid the use of 
> deprecated methods.
> 
> Before my refactoring, when adding users using RemoteManager the 
> remoteManager called the MailServer.addUser method if you were on the 
> localusers, otherwise it create new DefaultUser. the James.addUser was 
> instead creating a DefaultJamesUser by default.
> 
> In fact this is not so correct: the best way would be to invoke the 
> usersRepository.addUser method directly without using the DefaultUser 
> object from RemoteManager.
> 
> This is easy but is not a solution again.
> 
> The UsersFileRepository.addUser(username, password) method, creates 
> DefaultUsers and not DefaultJamesUsers by default.
> 
> One of the refactoring I planned for 2.4 was the 
> UsersRepository/Authentication one, so this will be fixed for 2.4 
> anyway, but we should also decide what to do for 2.3.
> 
> I would do at least:
> a. Add a check to UsersRepositoryAliasingForwarding to skip non 
> JamesUsers (easy bugfix)
> b. Change the remotemanager to user the 
> usersRepository.addUser(username, password) instead of creating a 
> DefaultUser and use the usersRepository.addUser(user).
> 
> Then we have further options:
> c1. do nothing else: we work differently from james 2.2 because newly 
> created users for FileUsersRepository will not support aliasing/forwarding.
> c2. we can change the FileUsersRepository.addUser method to create 
> DefaultJamesUsers by default
> c3. we can add a FileJamesUsersRepository identical to the 
> FileUsersRepository but creating DefaultJamesUsers by default and put 
> either put it as default in the config.xml or as an option.
> 
> My preference is for c2 or for c3 (adding it as the default).
> 
I agree.

> I can do this tonight or tomorrow but I don't know if we should stop the 
> a3 release or do it anyway letting users know it has critical bugs with 
> file based users repository.
> 
> My preference is to release the a3 anyway: if we never release we'll 
> always find similar bugs the day we vote for the following release :-(
> 
I agree here too.. its a alpha so we can release it with this bug..
Maybe if we release this people will find other bugs too.

> Stefano
> 
> PS: I will open a JIRA issue to track this soon.
> 
> Noel J. Bergman wrote:
> > Bernd Fondermann wrote:
> > 
> >> I set up vanilla james config and in the users-store section replaced
> >> the default db-store with file.
> > 
> >> java.lang.ClassCastException
> >> UsersRepositoryAliasingForwarding.java:193)
> > 
> > That is:  user = (JamesUser) usersRepository.getUserByName(username);
> > 
> > I'll check the code after lunch, but I seem to recall someone making some
> > changes in that area.
> > 
> > 	--- Noel
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
> !EXCUBATOR:1,446e09fd37021317318436!

bye
Norman


RE: Issue with 2.3 branch

Posted by "Noel J. Bergman" <no...@devtech.com>.
Bernd Fondermann wrote:

> I set up vanilla james config and in the users-store section replaced
> the default db-store with file.

> java.lang.ClassCastException
> UsersRepositoryAliasingForwarding.java:193)

That is:  user = (JamesUser) usersRepository.getUserByName(username);

I'll check the code after lunch, but I seem to recall someone making some
changes in that area.

	--- Noel


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