Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring 3.2.1 along with Tiles 3.0.1 doesn't work?

Tags:

spring

tiles

I am using a Tiles 3.0.1 along with Spring 3.2.1 , but it doesn't work, works fine with tiles 2.2.2. I found it as a common problem ,want to know if there is any to make it working.

I get the following error while I changed tiles to 3.0.1

 java.lang.NoClassDefFoundError: org/apache/tiles/startup/BasicTilesInitializer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getDeclaredConstructors(Unknown Source)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:230)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:976)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:949)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.tiles.startup.BasicTilesInitializer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 36 more
Mar 11, 2013 1:49:32 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Mar 11, 2013 1:49:32 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/gzl-client-web] startup failed due to previous errors
Mar 11, 2013 1:49:32 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Mar 11, 2013 1:49:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 11, 2013 1:49:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]

Please suggest if its possible or not ?

like image 862
Ruby Avatar asked Mar 11 '13 08:03

Ruby


2 Answers

I made it working with tiles 3 ..

Following are the jars required :

  1. tiles-api 3.0.1 jar
  2. tiles-core 3.0.1 jar
  3. tiles-jsp 3.0.1 jar
  4. tiles-request-api 1.0.1 jar
  5. commons-digester 2.0 jar
  6. commons-beanutils 1.8.0 jar

and add the follwing bean into your dispatcher class:

<bean id="tilesviewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
  <property name="definitions">
   <list>
    <value>/WEB-INF/views/**/tiles.xml</value>
      <value>/WEB-INF/layouts/tiles.xml</value>
   </list>
  </property>
 </bean>
    </beans>

it works for me , I am able to read the tiles definition and showing the view ..try this

like image 179
Ruby Avatar answered Sep 28 '22 15:09

Ruby


It worked for me with only tiles-api, tiles-core, tiles-jsp dependencies. Make sure you refer to the TilesConfigurer from tiles3 package instead of tiles2. I was not able to figure out until I realized I was using tiles3 version.

like image 22
Abubacker Siddik Avatar answered Sep 28 '22 16:09

Abubacker Siddik