Announcement Announcement Module
Collapse
No announcement yet.
Error during initialisation Portlet Spring 3.0.2 and Tiles 2.1.4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error during initialisation Portlet Spring 3.0.2 and Tiles 2.1.4

    Hi

    I am using Spring Portlet 3.0.2 in Pluto Portal 2.0.1.
    It works nice however I want now to include tiles2 support and the portlet initialisation is broken with the error below :

    Code:
    GRAVE: Error creating bean with name 'tilesConfigurer' defined in PortletContext resource [/WEB-INF/bookCatalog-portlet.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in PortletContext resource [/WEB-INF/bookCatalog-portlet.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
    	at org.springframework.web.portlet.FrameworkPortlet.createPortletApplicationContext(FrameworkPortlet.java:356)
    	at org.springframework.web.portlet.FrameworkPortlet.initPortletApplicationContext(FrameworkPortlet.java:294)
    	at org.springframework.web.portlet.FrameworkPortlet.initPortletBean(FrameworkPortlet.java:268)
    	at org.springframework.web.portlet.GenericPortletBean.init(GenericPortletBean.java:116)
    	at javax.portlet.GenericPortlet.init(GenericPortlet.java:127)
    	at org.apache.pluto.container.driver.PortletServlet.attemptRegistration(PortletServlet.java:211)
    	at org.apache.pluto.container.driver.PortletServlet$1.run(PortletServlet.java:166)
    	at java.util.TimerThread.mainLoop(Timer.java:512)
    	at java.util.TimerThread.run(Timer.java:462)
    Caused by: java.lang.NullPointerException
    	at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext.<init>(SpringTilesApplicationContextFactory.java:72)
    	at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory.createApplicationContext(SpringTilesApplicationContextFactory.java:55)
    	at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:315)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
    	... 18 more

    I have the dependencies in my pom.xml :
    Code:
    		<dependency>
    			<groupId>javax.portlet</groupId>
    			<artifactId>portlet-api</artifactId>
    			<version>2.0</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>jstl</artifactId>
    			<version>1.1.2</version>
    		</dependency>
    		<dependency>
    			<groupId>log4j</groupId>
    			<artifactId>log4j</artifactId>
    			<version>1.2.14</version>
    		</dependency>
    		<dependency>
    			<groupId>taglibs</groupId>
    			<artifactId>standard</artifactId>
    			<version>1.1.2</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-logging</groupId>
    			<artifactId>commons-logging</artifactId>
    			<version>1.1.1</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-asm</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-beans</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-expression</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc-portlet</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    			<version>3.0.2.RELEASE</version>
    		</dependency>
    		
    		<!-- Apache Tiles -->
    		<dependency>
    			<groupId>org.apache.tiles</groupId>
    			<artifactId>tiles-jsp</artifactId>
    			<version>2.1.4</version>		
    		</dependency>
    My app structure :
    /WEB-INF/layout/baseLayout.jsp : Tiles template
    /WEB-INF/jsp/home.jsp : JSP include in tiles
    /WEB-INF/jsp/tiles.xml : tiles def

    I have the tiles.xml definition :
    Code:
    <?xml  version="1.0" encoding="UTF-8" ?>
     
    <!DOCTYPE tiles-definitions PUBLIC
          "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
           "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
    
    <tiles-definitions>
    
    	<definition name="baseLayout" template="/WEB-INF/layout/baseLayout.jsp"/>
    	
    	<definition name="home" extends="baseLayout">
    		<put-attribute name="title" value="Spring3 Portlet Ajax Prototype" type="string" />
    		<put-attribute name="content" value="/WEB-INF/jsp/home.jsp" type="template" />
    	</definition>
    	
    	
    </tiles-definitions>
    I have the bookCatalog-portlet.xml that contains :
    Code:
    	<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    		<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
    	</bean>
    		
    	<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    		<property name="definitions">
    		    <list>
    		      <value>/WEB-INF/**/tiles.xml</value>
    		    </list>
    		</property>
    	</bean>
    Can we help me please ? I can give you any further information to help you debug this case.

    Fabrice

  • #2
    Did anyone have any luck with this? We are facing the same issue with Spring DM Server 2.0.2.

    - Paul

    Comment


    • #3
      you could attach the source and see whats happening here

      Code:
      	at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext.<init>(SpringTilesApplicationContextFactory.java:72)

      Comment


      • #4
        This is the exception that I'm getting:
        Code:
        [2010-06-18 15:52:16.230] start-signalling-3           <DE0006E> Start failed for bundle 'com.company.my-webapp' version '0.0.1.SNAPSHOT'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in URL [bundleentry://90.fwk8815209/META-INF/spring/mvc-config.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
        	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
        	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
        	at com.springsource.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:106)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        	at java.lang.Thread.run(Thread.java:619)
        Caused by: java.lang.NullPointerException: null
        	at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext.<init>(SpringTilesApplicationContextFactory.java:72)
        	at org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory.createApplicationContext(SpringTilesApplicationContextFactory.java:55)
        	at org.springframework.web.servlet.view.tiles2.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:315)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        	... 17 common frames omitted
        Here is my configuration:

        Code:
        <bean id="tilesConfigurer"
            	  class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
            	<property name="definitions">
            		<list>
            			<value>/WEB-INF/tiles-defs/templates.xml</value>
            		</list>
            	</property>
            </bean>
            
            <bean id="tilesViewResolver"
            	  class="org.springframework.web.servlet.view.UrlBasedViewResolver"
                  p:order="2"
            	  p:viewClass="org.springframework.web.servlet.view.tiles2.TilesView" />
        and it is failing because at that line as it is trying to get the servletContext.getInitParameterNames(); servletContext is null.

        Comment


        • #5
          We suspect that in our case the problem may be related to the OSGi setup:

          Code:
          <context-param>
          		<param-name>contextClass</param-name>
          		<param-value>com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
          	</context-param>
          Did anyone have luck setting tiles2 up with spring dm server or is able to shine some light on this?

          Comment


          • #6
            We did get little movement on this issue. We moved the spring configs from META-INF/spring/*.xml to WEB-INF/spring/*.xml and that caused the ContextListener to be seen.

            However, we still don't have tiles working as we now get an exception that it cannot find a factory to create the application context.

            Comment


            • #7
              Thanks pdurcek. Moving to WEB=INf/spring/*.xml worked for me.
              This is what i did
              upgraded my tiles to 2.2.2. This is the exact dependency list I have in my pom.xml (tiles in maven repo is bundle since version 2.0.7 https://issues.apache.org/jira/browse/TILES-282)
              Code:
                     <dependency>
              		<groupId>org.apache.tiles</groupId>
              		<artifactId>tiles-core</artifactId>
              		<version>2.2.2</version>
              	</dependency>
              	<dependency>
              		<groupId>org.apache.tiles</groupId>
              		<artifactId>tiles-jsp</artifactId>
              		<version>2.2.2</version>
              	</dependency>
              Then, as suggested by pdurcek moved tiles from META-INF/spring/*.xml to WEB-INF/spring/*.xml
              Now seeing this message in log
              [2012-07-31 13:05:29.924] INFO start-signalling-1 org.apache.tiles.context.AbstractTilesApplicationC ontextFactory Finished initializing Tiles2 application context.

              Comment

              Working...
              X