Announcement Announcement Module
Collapse
No announcement yet.
java.lang.IllegalStateException: LifecycleProcessor not initialized Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.IllegalStateException: LifecycleProcessor not initialized

    Hi,

    I'm trying to integrate aspectJ into my project, but I'm getting the following exception when tomcat starts:


    PHP Code:
    2012-10-29 21:32:58,842 ERROR - [org.springframework.web.context.ContextLoader] - Context initialization failed
    org
    .springframework.beans.factory.BeanDefinitionStoreExceptionUnexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NullPointerException
        at org
    .springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
        
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
        
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
        
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
        
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
        
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
        
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
        
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
        
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:527)
        
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:441)
        
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
        
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
        
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
        
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
        
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        
    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:516)
        
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
        
    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:288)
        
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused byjava.lang.NullPointerException
        at sun
    .net.www.ParseUtil.toURI(ParseUtil.java:261)
        
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:905)
        
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
        
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
        
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:675)
        
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1313)
        
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:1265)
        
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:280)
        
    at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:409)
        
    at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:491)
        
    at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:510)
        
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1802)
        
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:531)
        
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
        
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2443)
        
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1788)
        
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:711)
        
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
        
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
        
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
        
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
        
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
        
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
        
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
        ... 
    28 more 
    ApplicationContext.xml

    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:task="http://www.springframework.org/schema/task"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/tx 
            http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/task 
            http://www.springframework.org/schema/task/spring-task-3.0.xsd
            http://www.springframework.org/schema/aop        
            http:/www.springframework.org/schema/aop/spring-aop-3.0.xsd">

        <context:component-scan base-package="com.stockdomain">
            <context:exclude-filter type="annotation"
                expression="org.springframework.stereotype.Controller" />
        </context:component-scan>

        <bean id="contextApplicationContextProvider" class="com.stockdomain.util.ApplicationContextProvider"></bean>

        <!-- dataSource -->
        <bean id="dataSource"
            class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="org.postgresql.Driver" />
            <property name="url" value="jdbc:postgresql://localhost/db_finance" />
            <property name="username" value="xxxxx" />
            <property name="password" value="xxxxx" />
        </bean>

        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
            <property name="entityManagerFactory" ref="entityManagerFactory" />
        </bean>

        <bean id="entityManagerFactory"
            class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            <property name="persistenceUnitName" value="mypersistenceunit" />
            <property name="dataSource" ref="dataSource" />
            <property name="jpaVendorAdapter">
                <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                    <!-- <property name="showSql" value="true" /> -->
                    <property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect" />
                </bean>
            </property>
            <property name="jpaPropertyMap">
                <map>
                    <entry key="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
                </map>
            </property>
        </bean>

        <tx:annotation-driven transaction-manager="transactionManager" />


        <aop:config>
            <aop:advisor pointcut="com.stockdomain.retrieval"
                advice-ref="tx-advice" />
        </aop:config>


        <tx:advice id="tx-advice">
            <tx:attributes>
                <tx:method name="*" propagation="REQUIRED" />
            </tx:attributes>
        </tx:advice>

        <bean id="logAspect" class="com.stockdomain.util.LoggingAspect" />

    </beans>
    Part of pom.xml

    PHP Code:
        <dependency>
            <
    groupId>org.aspectj</groupId>
            <
    artifactId>aspectjrt</artifactId>
            <
    version>1.6.2</version>
        </
    dependency>
        <
    dependency>
            <
    groupId>org.aspectj</groupId>
            <
    artifactId>aspectjweaver</artifactId>
            <
    version>1.6.2</version>
        </
    dependency>
        <
    dependency>
            <
    groupId>org.aspectj</groupId>
            <
    artifactId>aspectjlib</artifactId>
            <
    version>1.6.2</version>
        </
    dependency
    Many thanks in advance for help,

    Frank

  • #2
    The exception I see in the stack trace is not the one stated in the thread title. It is a NullPointerException which is common when you try to convert a String in an URI but the string does not represent a valid URI. In this case the string is '/WEB-INF/applicationContext.xml' which obviously is NOT a valid URI so nothing strange here; the strange thing is that you have a web application but you don't use listener to load applicationContext.xml; instead you probably rely on a custom-made class, com.stockdomain.util.ApplicationContextProvider. Don't do that: don't go against the framework, use its facilities they are there to make your life easier!

    Comment

    Working...
    X