cancel
Showing results for 
Search instead for 
Did you mean: 

Error searching a node from a BaseDialogBean implementantion

lucagia
Champ in-the-making
Champ in-the-making
Hi people, I'm developing an amp, that has some action-executer and a class that extends BaseDialogBean, called SubsConsDialog. Both action-executer and SubsConsDialog call a static method for searching a file inside a subfolder of Company Home.

         
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
         ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home");
         NodeRef companyHomeNodeRef = null;
         try {
             if (rs.length() == 0)
                throw new AlfrescoRuntimeException("Didn't find Company Home");
            
             companyHomeNodeRef = rs.getNodeRef(0);
         } finally {
            if(rs!=null)
               rs.close();
         }
         if(fileFolderService == null || companyHomeNodeRef == null ) { System.out.println("FFS è null!"); return; }
         /* Create & Retrieve TsrStore & CertStore NodeRef*/
         NodeRef tsrStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.TsrStoreFolder"));
         if(tsrStore!=null && fileFolderService.getFileInfo(tsrStore).isFolder()) {
            tsrStoreNodeRef = tsrStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.TsrStoreFolder"), ContentModel.TYPE_FOLDER);   
            tsrStoreNodeRef = fi.getNodeRef();
         }
         
         /* Create & Retrieve CerStore NodeRef*/
         NodeRef certStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.CertStoreFolder"));
         if(certStore!=null && fileFolderService.getFileInfo(certStore).isFolder()) {
            certStoreNodeRef = certStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.CertStoreFolder"), ContentModel.TYPE_FOLDER);   
            certStoreNodeRef = fi.getNodeRef();
         }

At this line:
NodeRef tsrStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.TsrStoreFolder"));

it raises this exception
org.alfresco.error.AlfrescoRuntimeException: 03060002 Transaction must be active
and synchronization is required: Thread[http-8080-1,5,main]
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSync
hronizations(AlfrescoTransactionSupport.java:460)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchroni
zation(AlfrescoTransactionSupport.java:444)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(
AlfrescoTransactionSupport.java:237)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.getF
lushData(DirtySessionMethodInterceptor.java:214)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invo
ke(DirtySessionMethodInterceptor.java:392)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercept
or.invokeInternal(SingleEntryTransactionResourceInterceptor.java:154)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercept
or.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy9.getNodePair(Unknown Source)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNode
ServiceImpl.java:153)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getChildByName(DbNodeServ
iceImpl.java:1700)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNo
deServiceInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy11.getChildByName(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvoc
ationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy12.getChildByName(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterce
ptor.java:306)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterce
ptor.java:306)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRe
fPropertyMethodInterceptor.java:274)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRe
fPropertyMethodInterceptor.java:274)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy11.getChildByName(Unknown Source)
        at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.searchSimple
(FileFolderServiceImpl.java:342)
        at it.ktec.e130Amp.util.CerStoreManager.init(CerStoreManager.java:86)
        at it.ktec.e130Amp.SubsConsDialog.retrieveListCerts(SubsConsDialog.java:
339)
        at it.ktec.e130Amp.SubsConsDialog.setupAction(SubsConsDialog.java:151)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
:132)
        at javax.faces.component.UICommand.broadcast(UICommand.java:89)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:9
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invoke
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:110)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy191.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.jav
a:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy191.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:88)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Thread.java:619)

I get this error only when i execute that code from that SubsConsDialog, not when is executed by an action executer.

Thanks in advance for your help
5 REPLIES 5

derek
Star Contributor
Star Contributor
Hi,
If you do not wrap your code in transactions (you really should) then you need to use the "FileFolderService" and not the "fileFolderService" (the former is supplied by the "ServiceRegistry") in order to get proper transaction demarcation for calls going into the repository.
Regards

lucagia
Champ in-the-making
Champ in-the-making
Thanks for you answer.
I've changed my code to this ..

         ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
         Repository repository = (Repository)context.getBean("JCR.Repository");
         
         Session session = repository.login(new SimpleCredentials("admin",   "admin".toCharArray()));
         
           ServiceRegistry registry = (ServiceRegistry)context.getBean(ServiceRegistry.SERVICE_REGISTRY);
         

           fileFolderService = registry.getFileFolderService();
           nodeService = registry.getNodeService();
           contentService = registry.getContentService();
           searchService = registry.getSearchService();

         StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
         ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, "/app:company_home");
         NodeRef companyHomeNodeRef = null;
         try {
             if (rs.length() == 0)
                throw new AlfrescoRuntimeException("Didn't find Company Home");
            
             companyHomeNodeRef = rs.getNodeRef(0);
         } finally {
            if(rs!=null)
               rs.close();
         }
         
         UserTransaction trx = registry.getTransactionService().getUserTransaction();
         trx.begin();

      /* Create & Retrieve TsrStore & CertStore NodeRef*/      
         NodeRef tsrStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.TsrStoreFolder"));
         if(tsrStore!=null && fileFolderService.getFileInfo(tsrStore).isFolder()) {
            tsrStoreNodeRef = tsrStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.TsrStoreFolder"), ContentModel.TYPE_FOLDER);   
            tsrStoreNodeRef = fi.getNodeRef();
         }
         session.save();

         /* Create & Retrieve CerStore NodeRef*/
         NodeRef certStore = fileFolderService.searchSimple(companyHomeNodeRef ,Messages.getString("ExtStrings.CertStoreFolder"));
         if(certStore!=null && fileFolderService.getFileInfo(certStore).isFolder()) {
            certStoreNodeRef = certStore; // certStore folder already exists
         } else {
            FileInfo fi = fileFolderService.create(companyHomeNodeRef, Messages.getString("ExtStrings.CertStoreFolder"), ContentModel.TYPE_FOLDER);   
            certStoreNodeRef = fi.getNodeRef();
         }
         session.save();

         trx.commit();

but now I get this exception

Cannot create JDBC driver of class '' for connect URL 'null'
java.lang.NullPointerException
        at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
        at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
        at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
        at java.sql.DriverManager.getDriver(DriverManager.java:253)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDat
aSource.java:1143)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSo
urce.java:880)
        at org.alfresco.config.JndiObjectFactoryBean.lookup(JndiObjectFactoryBea
n.java:44)
        at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(Jnd
iObjectFactoryBean.java:201)
        at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(Jnd
iObjectFactoryBean.java:187)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver
.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:557)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:842)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:416)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:261)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:192)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(Context
LoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3843)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
342)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

        at or

And alfresco hangs for some minutes and then
org.alfresco.error.AlfrescoRuntimeException: 03210000 Error start VtiServer, cau
se:
        at org.alfresco.module.vti.VtiServer.onBootstrap(VtiServer.java:129)
        at org.springframework.extensions.surf.util.AbstractLifecycleBean.onAppl
icationEvent(AbstractLifecycleBean.java:56)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.m
ulticastEvent(SimpleApplicationEventMulticaster.java:97)
        at org.springframework.context.support.AbstractApplicationContext.publis
hEvent(AbstractApplicationContext.java:294)
        at org.springframework.context.support.AbstractApplicationContext.finish
Refresh(AbstractApplicationContext.java:858)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:419)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:83)
        at it.ktec.e130Amp.util.CerStoreManager.init(CerStoreManager.java:51)
        at it.ktec.e130Amp.SubsConsDialog.retrieveListCerts(SubsConsDialog.java:
348)
        at it.ktec.e130Amp.SubsConsDialog.setupAction(SubsConsDialog.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
:132)
        at javax.faces.component.UICommand.broadcast(UICommand.java:89)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:9
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invoke
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:104)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:116)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at $Proxy200.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:82)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.jav
a:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory
$1.invoke(ChainingSubsystemProxyFactory.java:116)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:202)
        at $Proxy200.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxy
Filter.java:82)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.BindException: Address already in use: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at java.net.ServerSocket.<init>(ServerSocket.java:141)
        at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector
.java:80)
        at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
        at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:28
3)
        at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:14
7)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.Server.doStart(Server.java:233)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.alfresco.module.vti.VtiServer.onBootstrap(VtiServer.java:122)
        … 58 more

So as it seems error is generated by
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");

:?:  :?:

derek
Star Contributor
Star Contributor
Hi,

Your datasource exceptions are not relevant here, unless you have configured Spring to use a JNDI-based DataSource.

If you are running in the Alfresco web app then you need to get the existing context and not create a new one - look how the existing Explorer JSF client code does it - otherwise it'll try to start Alfresco twice; ApplicationContextHelper doesn't detect the context started as a web app.  You don't need do the JCR Session stuff since you're going direct to the foundation services.  Also, use the RetryingTransactionHelper that you can get from the TransactionService.

If you need, you inject the 'ServiceRegistry' directly into a bean in your AMP or make any of your AMP beans 'ApplicationContextAware'.

Regards

lucagia
Champ in-the-making
Champ in-the-making
Wow it worked like a charm Smiley Very Happy

I've created a bean implementing ApplicationContextAware and used that for getting ServiceRegistry and so all service beans (filefolderservice, ecc) i needed.

Thank you very much … without your help I'd have solved this in my next life  :lol:

derek
Star Contributor
Star Contributor
Anything for a Forum Point  😎
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.