You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephen Gissendaner <sg...@eplinc.com> on 2001/09/27 20:31:46 UTC

tiles definition not found error with JDeveloper but rest of tile s works

Hello Fellow Travelers,

DISCLAIMER: ( I had e-mailed Cedric this basic question when I was searching
the mail-archives site. I apologize for my breach of etiquette. This e-mail
is a much better asking of the question and will hopefully help other
persons new to struts and tiles)

-------------------BACKGROUND:-----------------------
We are using struts 1.0 successfully in our project but the page maintenance
is a pain. I want us to begin using struts1.1 and the tiles.tld functions.
It seems like a great piece of technology. I envision being able to define
all of our pages (states) in the tiles.xml file and have all of our Actions
(transitions) refer only to items in the tiles.xml file. I anticipate that
it will make maintenance much easier.

------------------ENVIRONMENT:---------------------------
Oracle 9i JDeveloper 5.0.0.5.65 (beta)
M$2k machine P3 (512k)
JAVA_HOME=I:\java\jdk1.3.1
struts: the 20010927 nightly build
WEB-INF has all of the tld's from the build, plus the web.xml, tiles.xml,
and struts-config.xml files
WEB-INF/lib has all of the .jar files from the build
My project library settings include the tiles.jar and struts.jar files.

My web.xml file has:
	<web-app>
   <description>Collections Plus Next Generation</description>
   <servlet>
      <servlet-name>action</servlet-name>
 
<servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class
>
      <init-param>
         <param-name>definitions-config</param-name>
         <param-value>/WEB-INF/tiles.xml</param-value>
      </init-param>


My tiles.xml file has:
<?xml version = '1.0' encoding = 'UTF-8'?>
<component-definitions>
  <definition name="page.basic" path="/common/MainLayout.jsp">
          <put name="title"  value="Basic Page" direct="true"/>
          <put name="header" value="/common/header.jsp" />
          <put name="footer" value="/common/footer.jsp" />
          <put name="menu"   value="/common/MainMenu.jsp" />
  </definition>
  <definition name="swgpage" extends="page.basic">
    <put name="title" value="The Main Page" />
    <pub name="body"  value="/content/MainPage.jsp" />
  </definition>
//Alll of the referenced files exist in the proper directories (see WHAT
WORKS below)



-----------------THE PROBLEM:---------------------------------
When I try to run this .jsp file:
	<%@ taglib uri='/WEB-INF/tiles.tld' prefix="tiles" %>
	<tiles:insert definition="swgpage" flush="true" />

I get this error:
Tag Insert : Can't get component definition 'swgpage'. Check if this name
exist in component definitions


----------------------WHAT I HAVE
TRIED:---------------------------------------
I have searched the archives of this list and found notes similar to this
problem but the answers all seem to be guided towards either:
1)getting struts to work at all due to xml parser issues
2) handling the Can't get definitions factory from context error which is
solved by having the real name of your tiles.xml file in the web.xml's
<definitions-config> parameter!


----------------WHAT WORKS:-----------------------
Plain struts works fine!. My foo.do's get called. I can forward to any .jsp
page I want. My Action and form classes behave as expected.
Using tiles in a .jsp file: specifically, the following file works as
expected (notice how similar to the <definition> it is.)
	<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
	<tiles:insert template="/common/MainLayout.jsp" flush="true" >
	   <tiles:put name="titlestring" value="Basic Page" />
	   <tiles:put name="header"      value="/common/header.jsp" />
	   <tiles:put name="footer"      value="/common/footer.jsp" />
	   <tiles:put name="menu"        value="/common/MainMenu.jsp" />
	   <tiles:put name="body"        value="/content/MainPage.jsp" />
	</tiles:insert>

-----------------MY THOUGHTS:----------------------------
1) Because struts works I believe that I am instantiating the servlet
mentioned in my web.xml
2) Because <tiles:insert template=....> works, I believe that I have the tag
libraries set up correctly and the correct JAXP xml parser installed.
3 )Because I can get struts, tiles and .jsp's to work as well as break
things in predictable ways, I think that my development environment is
basically sound.

---------------------MY QUESTION:--------------------------
	Can someone point me in the right direction to get the <definition>
feature of tiles to work? I am assuming that I am doing something very
obviously stupid but I am blinded by a "somebody else's problem field".
	I downloaded the 20010927_src files and noticed that the
DefinitionsUtil class did not have any of its methods implemented. Is this
the file that was actually used for the build? If so, then which class does
the actual definition parsing? I assume that this is the portion of code
that is throwing my error.
		/**
		 * Process tag attribute "definition"
     * First, search definition in the factory, then create handler from
this definition.
		 * @param name Name of the definition.
		 * @return Appropriate TagHandler.
		 * @throws JspException- NoSuchDefinitionException No
Definition  found for name.
		 * @throws JspException- FactoryNotFoundException Can't find
Definitions factory.
		 * @throws JspException- DefinedComponentFactoryException
General error in factory.
		 * @roseuid 3AB4CEFB01CB
		 */
		protected TagHandler processDefinitionName(String name)
      throws JspException
		{

    try
      {
      ComponentDefinition definition =  DefinitionsUtil.getDefinition(name,
pageContext);
      if( definition == null )
        {  // is it possible ?
        throw new NoSuchDefinitionException();
        }
      return processDefinition( definition );

      }
     catch( NoSuchDefinitionException ex )
        {
        throw new JspException ( "Error -  Tag Insert : Can't get component
definition '"
                               + definitionName
                               + "'. Check if this name exist in component
definitions." );
        }

Well, I know that this is a long e-mail but I would really like to get an
answer so that my team can start using tiles. I am trying very hard to
escape from "One Microsoft Way" (not just their address, its their
philosophy).

Thank you in advance,


Stephen W. Gissendaner
Senior Application Engineer, (contractor)
EPL



Re: tiles definition not found error with JDeveloper but rest of tiles works

Posted by Cedric Dumoulin <ce...@lifl.fr>.

  Hi Stephen,

  There was a bug preventing Tiles to run with the latest versions of
commons-*.jar. It is no corrected.

  Maybe you can download latest Tiles distribution from original sited (Struts
site need 1 day to be updated) and try again. If you still have some trouble,
let me know.

   Cedric


Stephen Gissendaner wrote:

> Hello Fellow Travelers,
>
> DISCLAIMER: ( I had e-mailed Cedric this basic question when I was searching
> the mail-archives site. I apologize for my breach of etiquette. This e-mail
> is a much better asking of the question and will hopefully help other
> persons new to struts and tiles)
>
> -------------------BACKGROUND:-----------------------
> We are using struts 1.0 successfully in our project but the page maintenance
> is a pain. I want us to begin using struts1.1 and the tiles.tld functions.
> It seems like a great piece of technology. I envision being able to define
> all of our pages (states) in the tiles.xml file and have all of our Actions
> (transitions) refer only to items in the tiles.xml file. I anticipate that
> it will make maintenance much easier.
>
> ------------------ENVIRONMENT:---------------------------
> Oracle 9i JDeveloper 5.0.0.5.65 (beta)
> M$2k machine P3 (512k)
> JAVA_HOME=I:\java\jdk1.3.1
> struts: the 20010927 nightly build
> WEB-INF has all of the tld's from the build, plus the web.xml, tiles.xml,
> and struts-config.xml files
> WEB-INF/lib has all of the .jar files from the build
> My project library settings include the tiles.jar and struts.jar files.
>
> My web.xml file has:
>         <web-app>
>    <description>Collections Plus Next Generation</description>
>    <servlet>
>       <servlet-name>action</servlet-name>
>
> <servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class
> >
>       <init-param>
>          <param-name>definitions-config</param-name>
>          <param-value>/WEB-INF/tiles.xml</param-value>
>       </init-param>
>
> My tiles.xml file has:
> <?xml version = '1.0' encoding = 'UTF-8'?>
> <component-definitions>
>   <definition name="page.basic" path="/common/MainLayout.jsp">
>           <put name="title"  value="Basic Page" direct="true"/>
>           <put name="header" value="/common/header.jsp" />
>           <put name="footer" value="/common/footer.jsp" />
>           <put name="menu"   value="/common/MainMenu.jsp" />
>   </definition>
>   <definition name="swgpage" extends="page.basic">
>     <put name="title" value="The Main Page" />
>     <pub name="body"  value="/content/MainPage.jsp" />
>   </definition>
> //Alll of the referenced files exist in the proper directories (see WHAT
> WORKS below)
>
> -----------------THE PROBLEM:---------------------------------
> When I try to run this .jsp file:
>         <%@ taglib uri='/WEB-INF/tiles.tld' prefix="tiles" %>
>         <tiles:insert definition="swgpage" flush="true" />
>
> I get this error:
> Tag Insert : Can't get component definition 'swgpage'. Check if this name
> exist in component definitions
>
> ----------------------WHAT I HAVE
> TRIED:---------------------------------------
> I have searched the archives of this list and found notes similar to this
> problem but the answers all seem to be guided towards either:
> 1)getting struts to work at all due to xml parser issues
> 2) handling the Can't get definitions factory from context error which is
> solved by having the real name of your tiles.xml file in the web.xml's
> <definitions-config> parameter!
>
> ----------------WHAT WORKS:-----------------------
> Plain struts works fine!. My foo.do's get called. I can forward to any .jsp
> page I want. My Action and form classes behave as expected.
> Using tiles in a .jsp file: specifically, the following file works as
> expected (notice how similar to the <definition> it is.)
>         <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
>         <tiles:insert template="/common/MainLayout.jsp" flush="true" >
>            <tiles:put name="titlestring" value="Basic Page" />
>            <tiles:put name="header"      value="/common/header.jsp" />
>            <tiles:put name="footer"      value="/common/footer.jsp" />
>            <tiles:put name="menu"        value="/common/MainMenu.jsp" />
>            <tiles:put name="body"        value="/content/MainPage.jsp" />
>         </tiles:insert>
>
> -----------------MY THOUGHTS:----------------------------
> 1) Because struts works I believe that I am instantiating the servlet
> mentioned in my web.xml
> 2) Because <tiles:insert template=....> works, I believe that I have the tag
> libraries set up correctly and the correct JAXP xml parser installed.
> 3 )Because I can get struts, tiles and .jsp's to work as well as break
> things in predictable ways, I think that my development environment is
> basically sound.
>
> ---------------------MY QUESTION:--------------------------
>         Can someone point me in the right direction to get the <definition>
> feature of tiles to work? I am assuming that I am doing something very
> obviously stupid but I am blinded by a "somebody else's problem field".
>         I downloaded the 20010927_src files and noticed that the
> DefinitionsUtil class did not have any of its methods implemented. Is this
> the file that was actually used for the build? If so, then which class does
> the actual definition parsing? I assume that this is the portion of code
> that is throwing my error.
>                 /**
>                  * Process tag attribute "definition"
>      * First, search definition in the factory, then create handler from
> this definition.
>                  * @param name Name of the definition.
>                  * @return Appropriate TagHandler.
>                  * @throws JspException- NoSuchDefinitionException No
> Definition  found for name.
>                  * @throws JspException- FactoryNotFoundException Can't find
> Definitions factory.
>                  * @throws JspException- DefinedComponentFactoryException
> General error in factory.
>                  * @roseuid 3AB4CEFB01CB
>                  */
>                 protected TagHandler processDefinitionName(String name)
>       throws JspException
>                 {
>
>     try
>       {
>       ComponentDefinition definition =  DefinitionsUtil.getDefinition(name,
> pageContext);
>       if( definition == null )
>         {  // is it possible ?
>         throw new NoSuchDefinitionException();
>         }
>       return processDefinition( definition );
>
>       }
>      catch( NoSuchDefinitionException ex )
>         {
>         throw new JspException ( "Error -  Tag Insert : Can't get component
> definition '"
>                                + definitionName
>                                + "'. Check if this name exist in component
> definitions." );
>         }
>
> Well, I know that this is a long e-mail but I would really like to get an
> answer so that my team can start using tiles. I am trying very hard to
> escape from "One Microsoft Way" (not just their address, its their
> philosophy).
>
> Thank you in advance,
>
> Stephen W. Gissendaner
> Senior Application Engineer, (contractor)
> EPL


Re: tiles definition not found error with JDeveloper but rest of tile s works

Posted by Jeff Turner <je...@socialchange.net.au>.
On Thu, Sep 27, 2001 at 01:31:46PM -0500, Stephen Gissendaner wrote:
> ------------------ENVIRONMENT:---------------------------
> Oracle 9i JDeveloper 5.0.0.5.65 (beta)
> M$2k machine P3 (512k)
> JAVA_HOME=I:\java\jdk1.3.1
> struts: the 20010927 nightly build
> WEB-INF has all of the tld's from the build, plus the web.xml, tiles.xml,
> and struts-config.xml files
> WEB-INF/lib has all of the .jar files from the build

>From which build? Did you build from CVS or download a build from the
website? Can you get the tiles example wars working?
 
> I get this error:
> Tag Insert : Can't get component definition 'swgpage'. Check if this name
> exist in component definitions

I had this problem, and it was because I built Struts with the latest
commons-digester.jar, built from CVS. It seems that Tiles requires an
older version. The commons jars in the nightly builds work.

http://marc.theaimsgroup.com/?t=100077331200001&w=2&r=1

HTH,

--Jeff