You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jason Pyeron <jp...@pdinc.us> on 2019/01/31 02:10:43 UTC

XML based configuration

It has been 10+ years since I used the XML configuration, so please bear
with me.

I am attempting to deploy Apache Roller under a sub context
(public#roller.war) so the url would be
http://127.0.0.1:8080/public/roller/roller-ui/login.rol .

When I do so, I get an exception cannot find definition named .Login

<struts>
    <package name="weblogger" namespace="/roller-ui"
extends="struts-default">
        <action name="login"
                class="org.apache.roller.weblogger.ui.struts2.core.Login">
            <result type="tiles">.Login</result>
        </action>


18:58:52.383 [http-bio-8092-exec-3] WARN
org.apache.struts2.views.tiles.TilesResult - could not find @TilesDefinition
for action: login
org.apache.tiles.definition.NoSuchDefinitionException: Cannot find
definition named '.Login'
        at
org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContaine
r.java:123)
        at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:161)
        at
org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.ja
va:208)
        at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:373)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:277)
        at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(D
efaultWorkflowInterceptor.java:176)
        at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:98)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:247)
        at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Validati
onInterceptor.java:260)
        at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.do
Intercept(AnnotationValidationInterceptor.java:52)
        at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:98)
        at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:247)
        at
org.apache.roller.weblogger.ui.struts2.util.UIActionPrepareInterceptor.doInt
ercept(UIActionPrepareInterceptor.java:54)


Of course moving the context back to /roller from /public/roller fixes the
issue.

Any ideas where to start?

$ git log -1
commit d456d54200e7c747ef0312ca190c2a15433b6b3d (HEAD -> master,
origin/master, origin/HEAD)
Author: Dave Johnson <sn...@gmail.com>
Date:   Fri Jan 18 17:36:28 2019 -0500

    From Kohei's PR

$ git remote -v
origin  https://github.com/apache/roller.git (fetch)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [struts-user] XML based configuration

Posted by Lukasz Lenart <lu...@apache.org>.
pon., 4 lut 2019 o 23:16 Dave <sn...@gmail.com> napisał(a):
>
> Hi Lukasz,
>
> Here's a summary of how Roller uses Struts and Tiles:
>
> Roller uses the StrutsPrepareAndExecute filter and maps it to all requests
> ending with “.rol”
> https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/web.xml
>
> Roller’s actions are defined in struts.xml and return results of type
> “tiles”
> https://github.com/apache/roller/blob/master/app/src/main/resources/struts.xml
>
> Roller’s JSP pages are kept under /WEB-INF/jsps to prevent direct access to
> them. You can see that in the tiles.xml file
> https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/tiles.xml
>
> Hope that is helpful. What else can I tell you about Roller and it's use of
> Struts & Tiles?

In my opinion it all looks good, I don't see any problems in your
current setup. Sorry for a late answer, I did review it early but
totally forgot to post my findings :(


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [struts-user] XML based configuration

Posted by Dave <sn...@gmail.com>.
Hi Lukasz,

Here's a summary of how Roller uses Struts and Tiles:

Roller uses the StrutsPrepareAndExecute filter and maps it to all requests
ending with “.rol”
https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/web.xml

Roller’s actions are defined in struts.xml and return results of type
“tiles”
https://github.com/apache/roller/blob/master/app/src/main/resources/struts.xml

Roller’s JSP pages are kept under /WEB-INF/jsps to prevent direct access to
them. You can see that in the tiles.xml file
https://github.com/apache/roller/blob/master/app/src/main/webapp/WEB-INF/tiles.xml

Hope that is helpful. What else can I tell you about Roller and it's use of
Struts & Tiles?

Best regards,
Dave



On Fri, Feb 1, 2019 at 2:41 AM Lukasz Lenart <lu...@apache.org>
wrote:

> pt., 1 lut 2019 o 00:38 Dave <sn...@gmail.com> napisał(a):
> > Thanks for helping to track down this problem, Jason; Roller (and Struts
> in
> > general) should work at any path. Maybe this error is occuring because
> > Roller is using Struts/Tiles in a non-best practices way?
>
> Could you describe how do you use Struts/Tiles in Roller? Maybe I
> would be able to help :)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: [struts-user] XML based configuration

Posted by Lukasz Lenart <lu...@apache.org>.
pt., 1 lut 2019 o 00:38 Dave <sn...@gmail.com> napisał(a):
> Thanks for helping to track down this problem, Jason; Roller (and Struts in
> general) should work at any path. Maybe this error is occuring because
> Roller is using Struts/Tiles in a non-best practices way?

Could you describe how do you use Struts/Tiles in Roller? Maybe I
would be able to help :)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [struts-user] XML based configuration

Posted by Dave <sn...@gmail.com>.
Thanks for helping to track down this problem, Jason; Roller (and Struts in
general) should work at any path. Maybe this error is occuring because
Roller is using Struts/Tiles in a non-best practices way?

Dave


On Thu, Jan 31, 2019 at 12:59 AM Jason Pyeron <jp...@pdinc.us> wrote:

> > -----Original Message-----
> > From: Jason Pyeron <jp...@pdinc.us>
> > Sent: Wednesday, January 30, 2019 9:53 PM
> > > -----Original Message-----
> > > From: Jason Pyeron <jp...@pdinc.us>
> > > Sent: Wednesday, January 30, 2019 9:11 PM
> > >
> > > It has been 10+ years since I used the XML configuration, so please
> bear
> > > with me.
> > >
> > > I am attempting to deploy Apache Roller under a sub context
> > > (public#roller.war) so the url would be
> > > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> > >
> > > When I do so, I get an exception cannot find definition named .Login
> > >
>
> So I think I have narrowed it down.
>
>
> file:/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-INF/tiles.xml
>
> But when this URL is stored in the
> org.apache.tiles.request.ApplicationResource, specifically
> org.apache.struts2.tiles.StrutsApplicationResource it is splitting the URL
> in two:
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
>
> and
>
> suffix=".82/webapps/public"
>
>
> If I hack it with the debugger to :
>
>
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
>
> and
>
> suffix=""
>
> It works until the next restart!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: [struts-user] XML based configuration

Posted by Yasser Zamani <ya...@apache.org>.
We had similar resolved issue at [1]. Could you please see if [2] fixes this also?

Regards.

[1] https://lists.apache.org/thread.html/f4e1d1a5c917d0fa759cce667b23ef1e076c51ad7907dcfbdeb88707@%3Cdev.struts.apache.org%3E
[2] https://lists.apache.org/thread.html/3825d060bb13474987603719026bb06f66d28a388680e13a5858db57@%3Cdev.struts.apache.org%3E


>-----Original Message-----
>From: Jason Pyeron <jp...@pdinc.us>
>Sent: Thursday, January 31, 2019 9:29 AM
>To: 'Struts Users Mailing List' <us...@struts.apache.org>
>Subject: RE: [struts-user] XML based configuration
>
>> -----Original Message-----
>> From: Jason Pyeron <jp...@pdinc.us>
>> Sent: Wednesday, January 30, 2019 9:53 PM
>> > -----Original Message-----
>> > From: Jason Pyeron <jp...@pdinc.us>
>> > Sent: Wednesday, January 30, 2019 9:11 PM
>> >
>> > It has been 10+ years since I used the XML configuration, so please
>> > bear with me.
>> >
>> > I am attempting to deploy Apache Roller under a sub context
>> > (public#roller.war) so the url would be
>> > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
>> >
>> > When I do so, I get an exception cannot find definition named .Login
>> >
>
>So I think I have narrowed it down.
>
>file:/C:/programs.x64/apache-software-foundation/apache-tomcat-
>7.0.82/webapps/public#roller/WEB-INF/tiles.xml
>
>But when this URL is stored in the org.apache.tiles.request.ApplicationResource,
>specifically org.apache.struts2.tiles.StrutsApplicationResource it is splitting the
>URL in two:
>
>pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
>
>and
>
>suffix=".82/webapps/public"
>
>
>If I hack it with the debugger to :
>
>
>pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-
>7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
>
>and
>
>suffix=""
>
>It works until the next restart!
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


RE: [struts-user] XML based configuration

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Jason Pyeron <jp...@pdinc.us>
> Sent: Wednesday, January 30, 2019 9:53 PM
> > -----Original Message-----
> > From: Jason Pyeron <jp...@pdinc.us>
> > Sent: Wednesday, January 30, 2019 9:11 PM
> >
> > It has been 10+ years since I used the XML configuration, so please bear
> > with me.
> >
> > I am attempting to deploy Apache Roller under a sub context
> > (public#roller.war) so the url would be
> > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> >
> > When I do so, I get an exception cannot find definition named .Login
> >

So I think I have narrowed it down.

file:/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-INF/tiles.xml

But when this URL is stored in the org.apache.tiles.request.ApplicationResource, specifically org.apache.struts2.tiles.StrutsApplicationResource it is splitting the URL in two:

pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"

and

suffix=".82/webapps/public"


If I hack it with the debugger to :


pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-INF/tiles.xml"

and

suffix=""

It works until the next restart!



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [struts-user] XML based configuration

Posted by Jason Pyeron <jp...@pdinc.us>.

> -----Original Message-----
> From: Jason Pyeron <jp...@pdinc.us>
> Sent: Wednesday, January 30, 2019 9:11 PM
> To: 'Struts Users Mailing List' <us...@struts.apache.org>
> Subject: [struts-user] XML based configuration
> 
> It has been 10+ years since I used the XML configuration, so please bear
> with me.
> 
> I am attempting to deploy Apache Roller under a sub context
> (public#roller.war) so the url would be
> http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> 
> When I do so, I get an exception cannot find definition named .Login
> 
> <struts>
>     <package name="weblogger" namespace="/roller-ui"
> extends="struts-default">
>         <action name="login"
>                 class="org.apache.roller.weblogger.ui.struts2.core.Login">
>             <result type="tiles">.Login</result>
>         </action>
> 
> 
> 18:58:52.383 [http-bio-8092-exec-3] WARN
> org.apache.struts2.views.tiles.TilesResult - could not find @TilesDefinition
> for action: login
> org.apache.tiles.definition.NoSuchDefinitionException: Cannot find
> definition named '.Login'
>         at
> org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContaine
> r.java:123)
>         at
> org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:161)
>         at
> org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.ja
> va:208)

Tracking this down further, it seems it could be related to https://issues.apache.org/jira/browse/WW-4624 .

It seems that tiles.xml is not found once I change the context path to have a / in it. I tested by making the tiles.xml contain invalid XML content, and no errors were found. Once I moved the context path back to /roller/ from /public/roller/ it found the XML errors.

21:36:30.902 [http-bio-8092-exec-1] WARN  org.apache.struts2.views.tiles.TilesResult - got TilesException while checking if definiton exists, ignoring it
org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.
        at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:328) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.loadDefinitionsFromResource(BaseLocaleUrlDefinitionDAO.java:150) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:239) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:230) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:230) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:208) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:197) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitions(ResolvingLocaleUrlDefinitionDAO.java:68) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:179) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:131) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88) ~[tiles-api-3.0.7.jar:3.0.7]
        at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100) ~[tiles-core-3.0.7.jar:3.0.7]
        at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:136) [struts2-tiles-plugin-2.5.17.jar:2.5.17]
        at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:206) [struts2-core-2.5.17.jar:2.5.17]
        at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375) [struts2-core-2.5.17.jar:2.5.17]
...
Caused by: org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[xercesImpl-2.10.0.jar:?]
        at org.apache.commons.digester.Digester.parse(Digester.java:1788) ~[commons-digester-1.8.1.jar:1.8.1]
        at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:325) ~[tiles-core-3.0.7.jar:3.0.7]
        ... 162 more




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org