There is a path through statements in the class I18nFactorySet which 
discards FileNotFoundExceptions:

0. the constructor calls initFactory(servletContext, properties), which 
calls initFactory(servletContext, filename); when this call is made, 
defaultFactory=null;
 
1. initFactory(servletContext, filename) therefore calls createDefaultFactory();

2. createDefaultFactory() creates rootXmlConfig; but because 
rootXmlConfig is null, a FileNotFoundException is thrown;

3. initFactory(servletContext, filename) does not catch 
createDefaultFactory()'s FileNotFoundException and handle it; instead, 
initFactory(servletContext, filename) throws the FileNotFoundException;

4. initFactory(servletContext, properties) catches the 
FileNotFoundException but does nothing with it!

Suggestion: print the filename string when the FileNotFoundException is 
caught.

My problem: I was using a config file named tiles-definitions.xml 
(instead of tileDefinitions.xml, componentDefinitions.xml or 
instanceDefinitions.xml). 

On 05/22/02, I received this from [EMAIL PROTECTED]:
>   I think that your problem is more related to a tiles' factory initialization 
>problem rather than a
> private/protected
> attribute.
> 
>   You have subclassed TilesRequestProcessor, do you have overloaded the init(...) 
>method ? If yes, don't you
> forget to call
> the parent's init(...) method ?
> 
>   You can check if the problem comes from private/protected attribute by changing 
>the attribute to protected
> in
> TilesRequestProcessor, recompile and test.
> 
>    Let us know where is the issue,
>         Cedric
> 
> 
> Mark Johnson wrote:
> 
> > I've been having some trouble with tiles under both the 20020508 and
> > 20020520 struts nightly builds. I believe that the problem may be that
> > TilesRequestProcessor.definitionsFactory is declared private, but should
> > instead be declared as protected. Here's why:
> >
> > My app has a login.jsp; upon successful login, a results.jsp
> > displays some info retrieved from a database. These pages use
> > tiles.
> >
> > If I override TilesRequestProcessor.doForward as follows:
> >   public class MyRequestProcessor extends TilesRequestProcessor {
> >
> >     protected void doForward(String uri, HttpServletRequest request,
> >                                   HttpServletResponse response)
> >       throws java.io.IOException, javax.servlet.ServletException {
> >              super.doForward(uri, request, response);
> >     }
> >
> >   }// MyRequestProcessor
> >
> > I get this error from Tomcat upon submitting the login.jsp:
> > java.lang.NullPointerException
> > at 
>org.apache.struts.tiles.xmlDefinition.FactorySet.getDefinition(FactorySet.java:96)
> > at 
>org.apache.struts.tiles.definition.ReloadableDefinitionsFactory.getDefinition(ReloadableDefinitionsFactory.java:161)
> > at 
>org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:114)
> > at com.myblank.MyRequestProcessor.doForward(MyRequestProcessor.java:50)
> > ...and so forth
> >
> > Now if I replace the code [ie, super.doForward(...)] in the overridden
> > MyRequestProcessor.doForward() with the code from
> > TilesRequestProcessor.doForward, it won't compile because
> > TilesRequestProcessor.definitionsFactory is declared private.
> >
> > However, if I introduce a variable:
> > protected ComponentDefinitionsFactory myDefinitionsFactory;
> > into my subclass, and replace all the references in doForward to
> > definitionsFactory with myDefinitionsFactory, everything works just
> > fine.
> >
> > --
> >
> > Mark Johnson
> > [EMAIL PROTECTED]
> 
> 
> 

-- 

Mark Johnson
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to