You need to logout in the thread that performed the initial login to clear the association.
I've tried logging out in the client by calling lc.logout() and while that appears to log me out within the client, it doesn't appear to log me out in the server.
After the log out, I can run the program again without logging in and as long as I get the same thread in the server, the same user is logged in and I can perform the requested function.
I don't know how to logout on the server as I don't think I can guarantee that I get the same thread from the client to call a logout method. And I don't want to have every session bean method logout before exiting because, besides being a huge amount of coding, it would cause many problems when I call bean to bean within the server.
I'm sure there is something simple I am missing or doing wrong, but I can't quite see what it is.
Actually we traced the jboss source and found the bug and put it on JIRA and it has since been fixed. Jira ID is EJBTHREE-384