cancel
Showing results for 
Search instead for 
Did you mean: 

I'm Trying To Bootstrap new class With Null Pointer Result

mohammed_amr
Champ in-the-making
Champ in-the-making
Dear Gurus,

I have set of folders and nodes that must be bootstrapped once the alfresco server start up, the bootstrap aimed to create Folders & Nodes under Dictionary Folder and it is tested via other scenario but using bootstrap an exception has been thrown.

First of all Look at the class.


public class SecurityRequirementBootstrap {

   

   public void init() throws Exception{
      AuthenticationUtil.runAs(new RunAsWork<String>() {
         public String doWork() throws Exception {
             transaction = transactionService.getUserTransaction();
             transaction.begin();
             if(!authenticationService.authenticationExists("admin")){
                authenticationService.createAuthentication("admin", new char [] {'a','d','m','i','n'});
             }
             if(!personService.personExists("admin")){
                personService.createPerson(createDefaultProperties("admin", "admin", "admin", "admin@localhost", "admin"));
             }
             authenticationService.authenticate("admin", new char [] {'a','d','m','i','n'});
            NodeUtil.checkSecurityPreRequesite(searchService,nodeService);
            transaction.commit();
            return "";
         }
      }, "admin");
   }

    private Map<QName, Serializable> createDefaultProperties(String userName, String firstName, String lastName,
            String email, String password) {
        HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
        properties.put(ContentModel.PROP_USERNAME, userName);
        properties.put(ContentModel.PROP_FIRSTNAME, firstName);
        properties.put(ContentModel.PROP_LASTNAME, lastName);
        properties.put(ContentModel.PROP_EMAIL, email);
        properties.put(ContentModel.PROP_PASSWORD, password);
        return properties;
    }   


    private NodeService nodeService;
    private SearchService searchService;
    private UserTransaction transaction;
    private TransactionService transactionService;
    private MutableAuthenticationService authenticationService;
    private PersonService personService;
   
    public PersonService getPersonService() {
      return personService;
   }
   public void setPersonService(PersonService personService) {
      this.personService = personService;
   }
   public MutableAuthenticationService getAuthenticationService() {
      return authenticationService;
   }
   public void setAuthenticationService(
         MutableAuthenticationService authenticationService) {
      this.authenticationService = authenticationService;
   }
   public TransactionService getTransactionService() {
      return transactionService;
   }
   public void setTransactionService(TransactionService transactionService) {
      this.transactionService = transactionService;
   }   
   public NodeService getNodeService() {
      return nodeService;
   }
   public void setNodeService(NodeService nodeService) {
      this.nodeService = nodeService;
   }
   public SearchService getSearchService() {
      return searchService;
   }
   public void setSearchService(SearchService searchService) {
      this.searchService = searchService;
   }
}
  

This class has been pointed by the xml file named bootstrap-context.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <bean id="com.ds.module.extensions.Core.workflowBootstrap" parent="workflowDeployer">
      <property name="workflowDefinitions">
         <list>
            <props>
               <prop key="engineId">jbpm</prop>
               <prop key="location">alfresco/module/com.ds.module.extensions.Core/workflows/IssuePublishProcessDefinition/processdefinition.xml</prop>
               <prop key="mimetype">text/xml</prop>
               <prop key="redeploy">true</prop>
            </props>
         </list>
      </property>
      <property name="models">
         <list>
            <value>alfresco/module/com.ds.module.extensions.Core/workflows/IssuePublishProcessDefinition/IssuePublishWorkflowModel.xml</value>
         </list>
      </property>
   </bean>
   <bean id="com.ds.module.extensions.Core.securityRequirementBootstrap"
         class="com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap"
         init-method="init">
      <property name="searchService">
         <ref bean="searchService"/>
      </property>
      <property name="nodeService">
         <ref bean="nodeService"/>
      </property>
      <property name="transactionService">
         <ref bean="transactionService"/>
      </property>
      <property name="authenticationService">
            <ref bean="authenticationService" />
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>      
   </bean>
</beans>

& FYI i have use an AMP file to change the alfresco.war and the module-context.xml contains


<beans>
   <import resource="classpath:alfresco/module/com.ds.module.extensions.Core/context/bootstrap-context.xml" />
    <bean id="com.ds.module.extensions.Core.configBootstrap" class="org.alfresco.web.config.WebClientConfigBootstrap" init-method="init">
       <property name="configs">
         <list>
            <value>classpath:alfresco/module/com.ds.module.extensions.Core/ui/web-client-config-custom.xml</value>
         </list>
       </property>
    </bean>
    <bean id="com.ds.module.extensions.Core.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/com.ds.module.extensions.Core/model/CS-Security-Model.xml</value>
            </list>
        </property>
    </bean>   
</beans>

But without any progress cause i have the exception


14:47:01,790  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.ds.module.extensions.Core.securityRequirementBootstrap' defined in class path resource [alfresco/module/com.ds.module.extensions.Core/context/bootstrap-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:519)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
   at org.alfresco.web.ui.common.Utils.addErrorMessage(Utils.java:825)
   at com.ds.ui.bean.dialog.util.NodeUtil.createSequencesFolder(NodeUtil.java:457)
   at com.ds.ui.bean.dialog.util.NodeUtil.checkSecurityPreRequesite(NodeUtil.java:509)
   at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:36)
   at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:1)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
   at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap.init(SecurityRequirementBootstrap.java:25)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1529)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
   … 37 more

Can anyone help me and guide to me know exactly where is the problem.
5 REPLIES 5

mrogers
Star Contributor
Star Contributor
You have not shown the line numbers for your class so I can't say which line is causing the NPE.   But it should be stright-forward for you to look at  SecurityRequirementBootstrap line 25.    I suspect you have not injected the transaction service.

While mentioning the use of transactions you should be using the RetryingTransactionHelper.    If you want to continue to "do it yourself" you must have a finally block that ends the transaction (either roll-back or commit) .

mohammed_amr
Champ in-the-making
Champ in-the-making
You have not shown the line numbers for your class so I can't say which line is causing the NPE. But it should be stright-forward for you to look at SecurityRequirementBootstrap line 25. I suspect you have not injected the transaction service.

While mentioning the use of transactions you should be using the RetryingTransactionHelper. If you want to continue to "do it yourself" you must have a finally block that ends the transaction (either roll-back or commit) .

First of all, the code was attached in this post, so can you refer to it before the answering, also i would like to inform you that i use the spring framework injection as bean referenced inside public-services-context and other .xml files such as core-services-context and the bean properties displayed in this post.

Seondly, RetryingTransactionHelper require a faces context which is does not exist in a "Bootstrap" phase so i will use trasnactionService.getUserTransaction(); to begin & end my transaction.

After all things still an exception has been thrown and unfortunately neither alfresco team support and alfresco books can give a solid explanation for the problem because i follow alfresco steps without any help.  

Yes it is a NPE but why the bean services are null while i use the spring injection as explained in the bootstrap-context.xml and i return back to the previous alfresco xml files to take the services exactly.

Thanks.
Mohammed Amr | Digital Series | Senior System Developer

mrogers
Star Contributor
Star Contributor
The Retrying Transaction Helper does not need a faces context.

Please run the debugger or look at the line of code, please don't argue, I'm trying to help.   

A NPE in your code is easy to diagnose, however its difficult to do it without the required information.

mohammed_amr
Champ in-the-making
Champ in-the-making
Thanks for your reply,

But i need to indicate that we are in a bootstrap phase.

java.lang.NullPointerException
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:368)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
   at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap.init(SecurityRequirementBootstrap.java:55)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1529)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:519)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

You can refer to that link to see more details about problem http://stackoverflow.com/questions/7145577/how-to-create-nodes-in-the-repository-in-the-bootstrap-ph... but look at this exception also

org.alfresco.repo.audit.model.AuditModelException: 07220000 No registered audit data extractor exists for 'org_alfresco_module_dod5015_userRolesExtractor'.
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState.cacheAuditElements(AuditModelRegistryImpl.java:524)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState.access$500(AuditModelRegistryImpl.java:240)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState$1.execute(AuditModelRegistryImpl.java:389)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState$1.execute(AuditModelRegistryImpl.java:375)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState$2.doWork(AuditModelRegistryImpl.java:416)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState$2.doWork(AuditModelRegistryImpl.java:413)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl$AuditModelRegistryState.start(AuditModelRegistryImpl.java:412)
at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.start(AbstractPropertyBackedBean.java:458)
at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.start(AbstractPropertyBackedBean.java:440)
at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.getState(AbstractPropertyBackedBean.java:221)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl.getState(AuditModelRegistryImpl.java:165)
at org.alfresco.repo.audit.model.AuditModelRegistryImpl.getAuditPathMapper(AuditModelRegistryImpl.java:201)
at org.alfresco.repo.audit.AuditComponentImpl.areAuditValuesRequired(AuditComponentImpl.java:232)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:129)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy56.authenticationExists(Unknown Source)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:29)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap.init(SecurityRequirementBootstrap.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1529)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

mikemars
Champ in-the-making
Champ in-the-making
It may be worth having your class extend AbstractLifecycleBean.

Yon can then override the methods:

@Override
protected void onBootstrap(ApplicationEvent event) {
}

@Override
protected void onShutdown(ApplicationEvent event) {
}

You configure this bean in a context file as you would any other standard bean e.g.

<bean id="myBootstrapClass" class="my.com.MyBootstrapClass">
        <property name="dictionaryService">
            <ref bean="dictionaryService" />
        </property>
         <property name="transactionService">
            <ref bean="TransactionService" />
        </property>
    </bean>