Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.access$000(LoginComponent.java:48)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:181)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent$1.run(LoginComponent.java:176)

2008-11-19 04:44:15,048 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.loginAs(LoginComponent.java:174)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.login(LoginComponent.java:168)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.runtime.api.Framework.login(Framework.java:153)

2008-11-19 04:44:15,048 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:40)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:44:15,048 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:44:15,064 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:28

Re: scheduler and event listener


2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

The scheduler is using quartz outside nuxeo so the current CL is not the nuxeo one. Set the current CL to the nuxeo CL (using code like Thread.currentThread.setClassLoader(Framework.class.getClassLoader())
alex

_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Alexandre Russel | 19 Nov 08:52

Re: scheduler and event listener

Here is the first line to add to you listener:
 
Thread.currentThread().setContextClassLoader(Framework.class.getClassLoader());
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
Michaël Olla | 19 Nov 06:15

scheduler and event listener

Hi all,

 

I have implemented the following event listener for the nuxeo scheduler:

 

public class MyEventListener extends AbstractEventListener implements

                   AsynchronousEventListener, DocumentModelEventListener {

 

         private static final Log log = LogFactory.getLog(MyEventListener.class);

 

         public void notifyEvent(CoreEvent event) {

                   log.debug("Received event!");

                   if (event.getEventId().equals("myEvent")) {

                            log.debug("Received my event!");

                            try {

                                      // Framework.login();

                                      CoreSession documentManager = new DocumentManagerBusinessDelegate()

                                                        .getDocumentManager(new RepositoryLocation("default"));

 

                                      EntityManagerFactory emf = Persistence

                                                        .createEntityManagerFactory("test");

                                      EntityManager em = emf.createEntityManager();

 

                                      // do some work here

 

                            } catch (Exception e) {

                                      e.printStackTrace();

                            }

                   }

         }

}

 

I keep getting classloader exceptions, you can find the exception traces below. The same code works correctly when I’m not using the scheduler. Has anyone had the same problem or does anyone know how to resolve it?

 

Thanks,

 

Michael

 

 

 

I get the following trace when I try to fetch the documentManager:

 

2008-11-19 04:47:40,017 ERROR [STDERR] org.nuxeo.ecm.core.api.ClientException: Error opening session for repository default

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:117)

2008-11-19 04:47:40,033 ERROR [STDERR]        at com.astek.test.MyEventListener.notifyEvent(MyEventListener.java:38)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.AbstractEventListener.handleEvent(AbstractEventListener.java:104)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.fireEvent(DefaultEventService.java:103)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.core.listener.impl.DefaultEventService.notifyEventListeners(DefaultEventService.java:92)

2008-11-19 04:47:40,033 ERROR [STDERR]        at org.nuxeo.ecm.platform.scheduler.core.EventJob.execute(EventJob.java:68)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

2008-11-19 04:47:40,048 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.ejb.EJBAccessException. message: Authentication failure

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)

2008-11-19 04:47:40,048 ERROR [STDERR]        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)

2008-11-19 04:47:40,064 ERROR [STDERR]        at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)

2008-11-19 04:47:40,080 ERROR [STDERR]        at $Proxy287.connect(Unknown Source)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:144)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.core.api.repository.Repository.open(Repository.java:125)

2008-11-19 04:47:40,080 ERROR [STDERR]        at org.nuxeo.ecm.webapp.delegate.DocumentManagerBusinessDelegate.getDocumentManager(DocumentManagerBusinessDelegate.java:114)

2008-11-19 04:47:40,080 ERROR [STDERR]        ... 7 more

2008-11-19 04:47:40,080 ERROR [STDERR] Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: javax.security.auth.login.LoginException. message: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.ecm.platform.login.NuxeoLoginModule

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:47:40,095 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:47:40,095 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:47:40,095 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)

2008-11-19 04:47:40,111 ERROR [STDERR]        at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)

2008-11-19 04:47:40,111 ERROR [STDERR]        ... 19 more

 

 

I also tried to call Framework.login() and got the following exception trace:

 

2008-11-19 04:44:15,017 ERROR [STDERR] javax.security.auth.login.LoginException: unable to find LoginModule class: No ClassLoaders found for: org.nuxeo.runtime.api.login.SystemLoginModule

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)

2008-11-19 04:44:15,017 ERROR [STDERR]        at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)

2008-11-19 04:44:15,033 ERROR [STDERR]        at java.security.AccessController.doPrivileged(Native Method)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

2008-11-19 04:44:15,033 ERROR [STDERR]        at javax.security.auth.login.LoginContext.login(LoginContext.java:579)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.SecurityDomain.login(SecurityDomain.java:121)

2008-11-19 04:44:15,033 ERROR [STDERR]        at org.nuxeo.runtime.api.login.LoginComponent.systemLogin(LoginComponent.java:161)