Thanks for the reply. Do you think using the JBoss methods
was causing the exception on login posted in the original
post in this thread?

I tried not using the JBoss methods (this was written before
I got here)... The problem is getting the CoreSession object
to pass to the UnrestrictedSessionRunner. If I try to get a
CoreSession without logging in using the JBoss method, or
the new way I do it below below, I always get an EJB
permission exception.

I'm doing this now instead of using the JBoss methods, and
we haven't seen the issue yet:


                RepositoryManager repositoryMgr =
Framework.getService(RepositoryManager.class);
                Repository repo = null;
                
                while (repo == null)
                {
                        repo = repositoryMgr.getDefaultRepository();
                        
                        if (repo == null)
                        {
                                logger.error("Nuxeo's repo is not available, 
sleeping
for 5 seconds and trying again!");
                                
                                // wait for nuxeo's repo to become available
                                Thread.sleep(5000);
                        }
                }

                // the default version of the login methods logs us in as
the 'system' user
                // this invocation allows this single thread permission on
the ejb remote stack
                LoginContext loginContext = Framework.login();
                
                CoreSession session = null;
                
                try
                {
                        session = repo.open();
                        
                        // only push to the map if its a delete
                        // add the session key to the map so the producer 
doesn't
fire off the delete event
                        if (!isInsertUpdate)
                        {
                                sessionMap.put(session.getSessionId(),
session.getSessionId());
                        }
        
                        RmsUnrestrictedSessionRunner runner = new
RmsUnrestrictedSessionRunner(isInsertUpdate, session, this,
cadObject);
                        runner.runUnrestricted();
                }
                catch (Exception ex)
                {
                        // re-throw to be caught inside of CadChangeConsumer,
then properly cleanup in the finally block
                        throw new Exception(ex);
                }
                finally
                {
                        if (session != null)
                        {
                                Repository.close(session);
                        }
                        
                        if (loginContext != null)
                        {
                                loginContext.logout();
                        }
                }

---
Mailing list: [email protected]
Forum: http://forum.nuxeo.org/f/1/

Reply via email to