tt0686
tt0686

Reputation: 1849

Use Apache Tiles

Good afternoon in my timezone.

I am working on a project that is in production for over one year, the application server is running the J2EE 1.3 version.Now i am trying to use the apache tiles framework to separate the content from the layout.The project has in the WEB-INF/lib the following libraries that implement the STRUTS framework -struts1.2.6 -struts-core-1.3.10 -struts-extras-1.3.10.jar -struts-taglib-1.3.10.jar

After this introduction my nightmare begun: 1) To configure the Tiles i added the following code to my struts-config.xml:

<action path="/tilesTest"  
        parameter="aDef" 
        type="org.apache.struts.actions.ForwardAction" />

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />

   <plug-in className="org.apache.struts.tiles.TilesPlugin" >
    <set-property property="definitions-config" value="/WEB-INF/tilesdefs.xml" />
     <set-property property="moduleAware" value="true" />
   </plug-in>

The 'aDef' parameter is defined in the tilesdefs.xml. When i call the action in the browser, it throws me the following exception:

java.lang.NoSuchMethodError: org.apache.struts.config.ForwardConfig.getContextRelative()Z org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:289)

After investigation i found a post saying the following :

Checked the application lib folder to find struts-core-1.3.8.jar as well as struts.jar. It is because of this that the exception was thrown. struts.jar has the forwardConfig class and getContextRelative() method. struts-core-1.3.8.jar has the forwardConfig class , but not the getContextRelative() method. This was causing the issue. Therefore remove struts.jar so that 1.3.8 version is used. -- Additionally add struts-extras-1.3.8.jar to the application lib

Like i told in the begging i have the same two libs, the only problem is, it is the struts.jar lib that have the tiles package, the struts-core-1.3.8 do not have that package. So what i am suppose to do , to run tiles in this application ?

Sorry for the question extension but i have to explain the all situation. Best regards THANKS IN ADVANCE to anyone that tries to help me

Upvotes: 1

Views: 1640

Answers (1)

JB Nizet
JB Nizet

Reputation: 692081

Fix your classpath. It doesn't make much sense to have two different versions of Struts in the classpath. The tiles classes for Struts 1.3.10 are in struts-tiles-1.3.10.jar bundled with struts-1.3.10.

Upvotes: 3

Related Questions