You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alistair Cairns <ac...@companieshouse.gov.uk> on 2002/10/09 21:55:18 UTC

NEWBIE: Getting Tiles to work with web logic 7

Hi 

I am new to using struts and have been getting up to speed on it over the last few days. 

I have a number of actions, action forms, and the validator up and running fine in a simple web app. 

I then tried to plug in tiles. 

my struts-config.xml has the following: 

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
  		 <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
         <set-property property="definitions-debug" value="2" />
         <set-property property="definitions-parser-details" value="2" />
         <set-property property="definitions-parser-validate" value="true" />
 </plug-in>

My tiles-defs.xml has the following

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

<tiles-definitions>
	<definition name="logon" path="/layouts/layout.jsp">
		<put name="header" value="/common/header.jsp"/>
       	<put name="header" value="/common/footer.jsp"/>
       	<put name="header" value="/security/logon1.jsp"/>
    </definition>
</tiles-definitions>

And my layout.jsp look like: 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>

<html>
<body>

<tiles:insert attribute="header"/>

<tiles:insert attribute="body"/>

<tiles:insert attribute="footer"/>

</body>
</html>


The header, footer, login1.jsp's referred to in the logon definition are trivial


When i deploy my web app and start web logic running I get the following exception: 

[INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.actio
n.ActionResources', returnNull=true
[INFO] PropertyMessageResources - -Initializing, config='uk.gov.ch.chips.web.res
ources.ApplicationResources', returnNull=true
[INFO] ValidatorPlugIn - -Loading validation rules file from '/WEB-INF/validator
-rules.xml'
[INFO] ValidatorPlugIn - -Loading validation rules file from '/WEB-INF/validatio
n.xml'
<09-Oct-02 20:44:49 BST> <Error> <HTTP> <101216> <Servlet: "mycorp" failed to pre
load on startup in webapp: "mycorp"
javax.servlet.ServletException: uk.mycorp.web.common.MyCorpRequestProcessor

        at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPl
ugin.java:281)
        at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:130)
        at org.apache.struts.action.ActionServlet.initApplicationPlugIns(ActionS
ervlet.java:991)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:458)
        at javax.servlet.GenericServlet.init(GenericServlet.java:258)
        at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:792)...............................

MyCorpRequestProcessor is our own request processor which extends the struts request processor. It is just a placeholder
and does not overide any methods. 

What is puzzling me is that when I remove the tiles plug in, my app works fine. As soon as I put the tiles plug in 
back into struts-config.xml, weblogic tthrows this exception when it starts up my web app. Am I missing something simple? 
(e.g. as far as I understand the documentation trail, I don't have to use TilesRequestProcessor anymore). 

It was all going so smoothly as well till this point :)

Thanks in advance for anyone's help. 

Alistair




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: NEWBIE: Getting Tiles to work with web logic 7

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

   Tiles use its own RequestProcessor extending the Struts one. You 
don't have to declare it, but the Tiles plugin install it for you. As 
you also use your own processor, your application fail. The solution is 
to let your RequestProcessor extends the Tiles one, and install your 
processor as before.
  Tiles plugin checks if your RequestProcessor is compatible. Normally 
an error message should have been provided somewhere ...

        Cedric

Alistair Cairns wrote:

>Hi 
>
>I am new to using struts and have been getting up to speed on it over the last few days. 
>
>I have a number of actions, action forms, and the validator up and running fine in a simple web app. 
>
>I then tried to plug in tiles. 
>
>my struts-config.xml has the following: 
>
><plug-in className="org.apache.struts.tiles.TilesPlugin" >
>  		 <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
>         <set-property property="definitions-debug" value="2" />
>         <set-property property="definitions-parser-details" value="2" />
>         <set-property property="definitions-parser-validate" value="true" />
> </plug-in>
>
>My tiles-defs.xml has the following
>
><?xml version="1.0" encoding="UTF-8"?>
>
><!DOCTYPE struts-config PUBLIC
>          "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
>          "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
>
><tiles-definitions>
>	<definition name="logon" path="/layouts/layout.jsp">
>		<put name="header" value="/common/header.jsp"/>
>       	<put name="header" value="/common/footer.jsp"/>
>       	<put name="header" value="/security/logon1.jsp"/>
>    </definition>
></tiles-definitions>
>
>And my layout.jsp look like: 
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
><%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
>
><html>
><body>
>
><tiles:insert attribute="header"/>
>
><tiles:insert attribute="body"/>
>
><tiles:insert attribute="footer"/>
>
></body>
></html>
>
>
>The header, footer, login1.jsp's referred to in the logon definition are trivial
>
>
>When i deploy my web app and start web logic running I get the following exception: 
>
>[INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.actio
>n.ActionResources', returnNull=true
>[INFO] PropertyMessageResources - -Initializing, config='uk.gov.ch.chips.web.res
>ources.ApplicationResources', returnNull=true
>[INFO] ValidatorPlugIn - -Loading validation rules file from '/WEB-INF/validator
>-rules.xml'
>[INFO] ValidatorPlugIn - -Loading validation rules file from '/WEB-INF/validatio
>n.xml'
><09-Oct-02 20:44:49 BST> <Error> <HTTP> <101216> <Servlet: "mycorp" failed to pre
>load on startup in webapp: "mycorp"
>javax.servlet.ServletException: uk.mycorp.web.common.MyCorpRequestProcessor
>
>        at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPl
>ugin.java:281)
>        at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:130)
>        at org.apache.struts.action.ActionServlet.initApplicationPlugIns(ActionS
>ervlet.java:991)
>        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:458)
>        at javax.servlet.GenericServlet.init(GenericServlet.java:258)
>        at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
>pl.java:792)...............................
>
>MyCorpRequestProcessor is our own request processor which extends the struts request processor. It is just a placeholder
>and does not overide any methods. 
>
>What is puzzling me is that when I remove the tiles plug in, my app works fine. As soon as I put the tiles plug in 
>back into struts-config.xml, weblogic tthrows this exception when it starts up my web app. Am I missing something simple? 
>(e.g. as far as I understand the documentation trail, I don't have to use TilesRequestProcessor anymore). 
>
>It was all going so smoothly as well till this point :)
>
>Thanks in advance for anyone's help. 
>
>Alistair
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: NEWBIE: Getting Tiles to work with web logic 7

Posted by Eddie Bush <ek...@swbell.net>.
I believe your RequestProcessor should extend the Tiles RequestProcessor 
- that's probably the problem.

  protected void initRequestProcessorClass( ApplicationConfig config )
    throws ServletException
  {
    <snip/>

    // Check if specified request processor is compatible with Tiles.
  try
    {
    Class tilesProcessorClass = TilesRequestProcessor.class;
    Class configProcessorClass = Class.forName( configProcessorClassname );
    if( !tilesProcessorClass.isAssignableFrom( configProcessorClass))
      {  // Not compatible
      String msg = "TilesPlugin : Specified RequestProcessor not 
compatible with
 TilesRequestProcessor";
      System.out.println( msg );
      throw new ServletException( msg );
      } // end if
    }
   catch( java.lang.ClassNotFoundException ex )
    {
    throw new ServletException( ex );
    }
  }

Does that look familiar?  Extend the tiles' request processor if you 
need to extend one ;-)

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>