Hi,

I am very new to Struts 2 and really want to use it in a project at work. We
have Struts 2, Spring 2.5.6 working peacefully together and I wanted to add
Tiles 2.2 on to the stack to experiment with it.

I have added all the dependencies in the maven and they are all available. I
am following the instructions on the Apache Tiles website and created a
Listener and everything. But somehow the result type is not recognized by
Struts 2. I tried posting it on the Tiles user list and they advised me to
try here.

Did anyone have a similar problem? How did you get around it? Also, it was
suggested that Tiles 2.2 does not work with Struts 2. Is that true? Should I
use Tiles 2.0.7 instead?


Here's my configuration :

*Environment* :

Tomcat 6.0.29
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)



*My web.xml **:*
*
*
<filter>
        <filter-name>struts2</filter-name>

 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
   </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
*
*
* <listener>*
*        <listener-class>com.blablabla.MyTilesListener</listener-class>*
* </listener>*


*Here's my /WEB-INF/tiles.xml*
*
*
*   <definition name="doc.mainLayout"
template="/tiles/layout/classicLayout.jsp">*
*      <put-attribute name="title"  value="Electronic Submission of Medical
Documentation (esMD)" />*
*      <put-attribute name="header" value="/tiles/layout/tiles-header.jsp"
/>*
*      <put-attribute name="body"   value="/tiles/layout/tiles-body.jsp" />*
*      <put-attribute name="footer" value="/tiles/layout/tiles-footer.jsp"
/>*
*    </definition>*
*    *
*    <definition name="LoginPage" extends="doc.mainLayout">*
*        <put-attribute name="body" value="/tiles/LoginBody.jsp"/>*
*    </definition>*
*
*
*My struts.xml*
*
*
*
<package name="default" namespace="/" extends="struts-default"> <!--
"tiles-default" package cannot be found in tiles 2.2 so I changed it -->
      <action name="Login">
*
*
                 <result>LoginPage</result>
      </action>
</package>

*

*MyTilesListener*

public class MyTilesListener extends AbstractTilesListener {

    protected TilesInitializer createTilesInitializer() {
    return new MyCustomTilesInitializer();
}
}

*MyCustomTilesInitializer*

public class MyCustomTilesInitializer extends BasicTilesInitializer {

        /** {...@inheritdoc} */
        @Override
        protected AbstractTilesContainerFactory createContainerFactory(
                TilesApplicationContext context) {
            return new MyTilesContainerFactory();
        }
}

*MyTilesContainerFactory*

public class MyTilesContainerFactory extends BasicTilesContainerFactory{
@Override
protected List<URL> getSourceURLs(TilesApplicationContext
tilesApplicationContext,
TilesRequestContextFactory tilesRequestContextFactory) {

List<URL> urls = null;

try {
urls = new ArrayList<URL>();

urls.add(tilesApplicationContext.getResource("/WEB-INF/tiles.xml"));
} catch(Exception exception) {

}

return urls;
}

}

*This is the error we get: *
*
*
*
HTTP Status 404 - /LoginPage
------------------------------

type Status report

message /LoginPage

description The requested resource (/LoginPage) is not available.
------------------------------
Apache Tomcat/6.0.29
*

*ServerLog * :

388 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
org.apache.tiles.context.AbstractTilesApplicationContextFactory -
Initializing Tiles2 application context. . .
392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN
org.apache.tiles.context.ChainedTilesApplicationContextFactory - Cannot find
TilesContextFactory class
org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
org.apache.tiles.context.AbstractTilesApplicationContextFactory - Finished
initializing Tiles2 application context.
392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN
org.apache.tiles.context.ChainedTilesApplicationContextFactory - Cannot find
TilesContextFactory class
org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
449 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
org.apache.tiles.access.TilesAccess - Publishing TilesContext for context:
org.apache.tiles.servlet.context.ServletTilesApplicationContext


Can someone give me a direction to fix this please. Thanks!


-- 
Cheers,
John

P.S: I also attached my pom.xml dependencies to give you a complete picture.
<dependencies>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>3.8.1</version>
     <scope>test</scope>
   </dependency>
   <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.14</version>
   </dependency>
   <dependency>
       <groupId>freemarker</groupId>
       <artifactId>freemarker</artifactId>
       <version>2.3.15</version>
   </dependency>
     <dependency>
         <groupId>ognl</groupId>
         <artifactId>ognl</artifactId>
         <version>2.7.3</version>
     </dependency>
     <dependency>
           <groupId>xwork-core</groupId>
           <artifactId>xwork-core</artifactId>
           <version>2.1.6</version>
   </dependency>
       <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-core</artifactId>
         <!--<version>2.1.8.1</version>-->
         <version>${struts.version}</version>
       </dependency>
      <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-spring-plugin</artifactId>
         <!--<version>2.1.8.1</version>-->
         <version>${struts.version}</version>
       </dependency>

     <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring</artifactId>
           <version>${spring.version}</version>
       </dependency>
     <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-interpolation</artifactId>
         <version>1.7-SNAPSHOT</version>
     </dependency>

      <dependency>
           <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
             <version>1.0</version>
       </dependency>
     <dependency>
               <groupId>log4j</groupId>
               <artifactId>log4j</artifactId>
               <version>${log4j.version}</version>
           </dependency>
     <dependency>
               <groupId>org.apache.tiles</groupId>
               <artifactId>tiles-core</artifactId>
               <!--<version>2.1.8.1</version>-->
               <version>${tiles.version}</version>
     </dependency>
     <dependency>
                     <groupId>org.apache.tiles</groupId>
                     <artifactId>tiles-jsp</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${tiles.version}</version>
           </dependency>
     <dependency>
                     <groupId>org.apache.tiles</groupId>
                     <artifactId>tiles-api</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${tiles.version}</version>
           </dependency>
      <dependency>
                     <groupId>org.apache.tiles</groupId>
                     <artifactId>tiles-servlet</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${tiles.version}</version>
           </dependency>            
       <dependency>
                     <groupId>org.apache.tiles</groupId>
                     <artifactId>tiles-template</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${tiles.version}</version>
           </dependency>
     <dependency>
                     <groupId>commons-beanutils</groupId>
                     <artifactId>commons-beanutils</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${beanutils.version}</version>
           </dependency>
     <dependency>
                     <groupId>commons-digester</groupId>
                     <artifactId>commons-digester</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${digester.version}</version>
           </dependency>

     <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${slf4j.version}</version>
           </dependency>  
     <!--<dependency>-->
                     <!--<groupId>org.slf4j</groupId>-->
                     <!--<artifactId>jcl-over-slf4j</artifactId>-->
                     <!--&lt;!&ndash;<version>2.1.8.1</version>&ndash;&gt;-->
                     <!--<version>${slf4j.version}</version>-->
           <!--</dependency>-->
      <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-simple</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${slf4j.version}</version>
           </dependency>
      <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>log4j-over-slf4j</artifactId>
                     <!--<version>2.1.8.1</version>-->
                     <version>${slf4j.version}</version>
           </dependency>
     <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>servlet-api</artifactId>
                        <version>2.4</version>
                        <scope>provided</scope>
                    </dependency>
     
 </dependencies>

 <properties>
      <struts.version>2.2.1</struts.version>
      <spring.version>2.5.6</spring.version>
      <tiles.version>2.2.2</tiles.version>
      <beanutils.version>1.8.0</beanutils.version>
      <digester.version>2.0</digester.version>
      <slf4j.version>1.6.1</slf4j.version>
      <log4j.version>1.2.14</log4j.version>
  </properties>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to