Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Can't upgrade from Spring 2.0 to Spring 2.0.3

  1. #1

    Default Can't upgrade from Spring 2.0 to Spring 2.0.3

    I can't upgrade from Spring 2.0 to Spring 2.0.3
    my error:
    Code:
    org.springframework.web.context.ContextLoader  Context initialization failed
    
     java.lang.NullPointerException 
         at java.lang.StringBuffer.<init>(StringBuffer.java:103) 
         at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270) 
         at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401) 
         at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143) 
         at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitIndexedArgumentValues(BeanDefinitionVisitor.java:100) 
         at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:61) 
         at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246) 
         at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) 
         at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422) 
         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) 
         at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:241) 
         at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) 
         at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) 
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4476) 
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:5140) 
         at com.sun.enterprise.web.WebModule.start(WebModule.java:304) 
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:960) 
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:944) 
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:662) 
         at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1562) 
         at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1205) 
         at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:172) 
         at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:276) 
         at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:951) 
         at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:938) 
         at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448) 
         at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160) 
         at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:295) 
         at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:208) 
         at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285) 
         at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119) 
         at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95) 
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:892) 
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:263) 
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:281) 
         at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:542) 
         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 com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353) 
         at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336) 
         at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448) 
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) 
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) 
         at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) 
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
         at java.lang.reflect.Method.invoke(Method.java:597) 
         at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77) 
         at $Proxy1.invoke(Unknown Source) 
         at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297) 
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeployer.java:508) 
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployJavaEEArchive(AutoDeployer.java:489) 
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:436) 
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:253) 
         at com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(AutoDeployControllerImpl.java:361) 
         at java.util.TimerThread.mainLoop(Timer.java:512) 
         at java.util.TimerThread.run(Timer.java:462)
    With Spring 2.0 all working good.
    Anybody can help me?

  2. #2
    Join Date
    Sep 2004
    Location
    Copenhagen, Denmark
    Posts
    113

    Default

    Try digging in the spring source PropertyPlaceholderConfigurer where it causes the NPE.

    Looks like something with property placeholders. Maybe posting your application context .xml file and your .properties file could enlighten us.
    /Claus

  3. #3

    Default

    Quote Originally Posted by davsclaus View Post
    Try digging in the spring source PropertyPlaceholderConfigurer where it causes the NPE.

    Looks like something with property placeholders. Maybe posting your application context .xml file and your .properties file could enlighten us.
    Thanks for reply.

    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"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
        <bean id="viewResolver" class="org.springframework.web.servlet.view.XmlViewResolver">
            <property name="order" value="0"/>
            <property name="location" value="/WEB-INF/views.xml"/>
        </bean>
    
        <bean id="freemarkerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
            <property name="order" value="1"/>
            <property name="cache" value="true"/>
            <property name="prefix">
                <value></value>
            </property>
            <property name="suffix">
                <value>.ftl</value>
            </property>
            <property name="exposeRequestAttributes">
                <value>true</value>
            </property>
            <property name="exposeSessionAttributes">
                <value>true</value>
            </property>
            <property name="exposeSpringMacroHelpers">
                <value>true</value>
            </property>
            <property name="contentType">
                <value>text/html; charset=UTF-8</value>
            </property>
            <property name="requestContextAttribute">
                <value>rc</value>
            </property>
        </bean>
    
        <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
            <property name="templateLoaderPath">
                <value>/WEB-INF/ftl/</value>
            </property>
            <property name="freemarkerSettings">
                <props>
                    <prop key="template_update_delay">5</prop>
                    <prop key="tag_syntax">auto_detect</prop>
                    <prop key="auto_import">/spring.ftl as spring, /util/pageUtils.ftl as util, util/htmlUtils.ftl as hutil</prop>
                    <prop key="auto_include">/util/include.ftl</prop>
                </props>
            </property>
            <property name="defaultEncoding">
                <value>UTF-8</value>
            </property>
            <property name="freemarkerVariables">
                <map>
                    <entry key="xml_escape" value-ref="fmXmlEscape"/>
                    <entry key="normalize_newlines" value-ref="NormalizeNewlines"/>
                    <entry key="htmlEscape">
                        <bean id="booleanTrue" class="java.lang.Boolean">
                            <constructor-arg>
                                <value>true</value>
                            </constructor-arg>
                        </bean>
                    </entry>
                    <entry key="apputil">
                        <ref bean="utilFacade"/>
                    </entry>
                </map>
            </property>
        </bean>
        <bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape"/>
        <bean id="NormalizeNewlines" class="freemarker.template.utility.NormalizeNewlines"/>
    
        <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="order" value="2"/>
            <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
            <property name="prefix" value="/WEB-INF/jsp/"/>
            <property name="suffix" value=".jsp"/>
        </bean>
    
        <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
            <property name="cookieName">
                <value>clientlanguage</value>
            </property>
            <!-- in seconds. If set to -1, the cookie is not persisted (deleted when browser shuts down) -->
            <property name="cookieMaxAge">
                <value>1209600</value>
            </property>
            <property name="defaultLocale">
                <value>Ru_ru</value>
            </property>
        </bean>
    
        <!-- Interceptors -->
        <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName">
                <value>lang</value>
            </property>
        </bean>
    
        <!-- Defining the resource bundles to use -->
        <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basenames">
                <list>
                    <value>WEB-INF/messages/messages</value>
                    <value>WEB-INF/messages/validate-messages</value>
                    <value>WEB-INF/messages/acegi-messages</value>
                </list>
            </property>
            <property name="cacheSeconds">
                <value>10</value>
            </property>
        </bean>
    
    </beans>
    mail.properties
    Code:
    mail.default.from=Admin <lexius@something.com>
    mail.debug=true
    mail.transport.protocol=smtp
    mail.host=127.0.0.1
    mail.username=
    mail.password=
    I can't understand why it working with Spring 2.0.0 and not working with Spring 2.0.3
    Last edited by lexius; Mar 11th, 2007 at 08:49 AM.

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I can't see PropertyPlaceholderConfigurer in your configuration. Is this the same one that's causing the exception?

  5. #5

    Default

    Quote Originally Posted by karldmoore View Post
    I can't see PropertyPlaceholderConfigurer in your configuration. Is this the same one that's causing the exception?
    Sorry, I forget one file.

    applicationContext-data.xml
    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:jee="http://www.springframework.org/schema/jee"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"
           default-lazy-init="false">
    
        <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:hibernate.properties</value>
                    <value>classpath:mail.properties</value>
                </list>
            </property>
        </bean>
    
        <!-- ======================== HIBERNATE, TX, DATASOURCE ======================= -->
    
        <jee:jndi-lookup id="dataSource" jndi-name="jdbc/__postgresAcula"/>
    
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
            <property name="configLocation" value="/WEB-INF/hibernate.cfg.xml"/>
            <property name="dataSource" ref="dataSource"/>
        </bean>
    
        <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
            <property name="allowCustomIsolationLevels" value="true"/>
        </bean>
    
        <bean id="txTemplate" class="org.springframework.transaction.support.TransactionTemplate">
            <property name="transactionManager">
                <ref bean="txManager"/>
            </property>
        </bean>
    
    
        <aop:config>
            <aop:pointcut id="fooServiceMethods" expression="execution(* com.acula.service.impl.*.*(..))"/>
            <aop:advisor advice-ref="aculaSecurityInterceptor" pointcut-ref="fooServiceMethods"/>
        </aop:config>
    
        <aop:config>
            <aop:pointcut id="fooSecureMethod1"
                          expression="execution(* com.acula.service.impl.UserManagerImpl.saveUser(..))"/>
            <aop:pointcut id="fooSecureMethod2"
                          expression="execution(* com.acula.service.impl.UserManagerImpl.updateUser(..))"/>
            <aop:advisor advice-ref="userSecurityAdvice" pointcut-ref="fooSecureMethod1"/>
            <aop:advisor advice-ref="userSecurityAdvice" pointcut-ref="fooSecureMethod2"/>
        </aop:config>
    
        <!-- enable the configuration of transactional behavior based on annotations -->
        <tx:annotation-driven transaction-manager="txManager"/>
    
        <bean id="hibernateTemplate"
              class="org.springframework.orm.hibernate3.HibernateTemplate">
            <property name="sessionFactory">
                <ref bean="sessionFactory"/>
            </property>
        </bean>
    
        <!-- =========================== DAO ========================= -->
    
        <bean id="userDao" class="com.acula.dao.hibernate.UserDaoHibernate">
            <property name="hibernateTemplate">
                <ref bean="hibernateTemplate"/>
            </property>
        </bean>
    
        <bean id="tempRequestDaoHibernate" class="com.acula.dao.hibernate.TempRequestDaoHibernate">
            <property name="hibernateTemplate">
                <ref bean="hibernateTemplate"/>
            </property>
        </bean>
    
        <!-- ======================== SERVICES ======================= -->
    
        <bean id="userManager" class="com.acula.service.impl.UserManagerImpl">
            <dwr:remote javascript="loginAutoComplete">
                <dwr:include method="getAutoComplete"/>
            </dwr:remote>
            <property name="dao">
                <ref bean="userDao"/>
            </property>
            <property name="sessionRegistry">
                <ref bean="sessionRegistry"/>
            </property>
        </bean>
    
        <bean id="tempRequestManager" class="com.acula.service.impl.TempRequestManagerImpl">
            <property name="dao">
                <ref bean="tempRequestDaoHibernate"/>
            </property>
        </bean>
    
        <bean id="aculaPropertiesManager" class="com.acula.service.impl.AculaPropertiesManagerImpl">
            <property name="txTemplate">
                <ref bean="txTemplate"/>
            </property>
        </bean>
    
    </beans>
    hibernate.properties
    Code:
    hibernate.connection.url=jdbc:postgresql://localhost:5432/acula
    hibernate.connection.driver_class=org.postgresql.Driver
    hibernate.connection.username=111
    hibernate.connection.password=111
    hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    hibernate.search.default.directory_provider=org.hibernate.search.store.FSDirectoryProvider
    hibernate.search.default.indexBase=/home/lexius/Documents/acula_data/indexes/
    hibernate.search.analyzer=org.apache.lucene.analysis.ru.RussianAnalyzer
    hibernate.bytecode.provider=javassist
    hibernate.cache.use_query_cache=true
    hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
    hibernate.cache.use_second_level_cache=true
    hibernate.jdbc.use_scrollable_resultset=true
    hibernate.jdbc.batch_size=20
    hibernate.show_sql=true
    hibernate.format_sql=true

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Again, I'm slightly confused. The PropertyPlaceholderConfigurer bean doesn't actually seem to be used at all. That doesn't explain the exception, but I just wonder why you need it.

  7. #7

    Default

    Quote Originally Posted by karldmoore View Post
    Again, I'm slightly confused. The PropertyPlaceholderConfigurer bean doesn't actually seem to be used at all. That doesn't explain the exception, but I just wonder why you need it.
    In this code I don't really need it (I comment some code fragments), but problem exist.

  8. #8
    Join Date
    Sep 2004
    Location
    Copenhagen, Denmark
    Posts
    113

    Default

    Maybe thats the problem. You dont use ${xxx} holders in your spring .xml file.

    Try inserting just one and only use one .properties file (eg only the mail one).

    Try reducing your configuration and trying nailed down on the problem.

    If we can prove a easy to test concrete situation that fails like yours we could easier get it fixed in a bug report.
    /Claus

  9. #9
    Join Date
    Sep 2004
    Location
    Copenhagen, Denmark
    Posts
    113

    Default

    Looks like others have similar problem.

    Se jira: SPR-3249
    /Claus

  10. #10

    Default

    Quote Originally Posted by davsclaus View Post
    Looks like others have similar problem.

    Se jira: SPR-3249

    Thanks davsclaus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •