struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgm <str...@rgm.nu>
Subject Fwd: Theme problem after update to 2.3.16 -- loading parent theme templates?
Date Wed, 11 Dec 2013 23:40:23 GMT
To demonstrate the problem more clearly and help narrow down the issue, I
have removed everything custom and changed the application to use
"css_xhtml" theme like this:

    <constant name="struts.ui.templateDir" value="mx/themes"></constant>
    <constant name="struts.ui.theme" value="css_xhtml"></constant>

This causes this error to appear in the JBoss log file:

ERROR [template.FreemarkerTemplateEngine]  Could not load the FreeMarker
template named 'form':
ERROR [template.FreemarkerTemplateEngine]  Attempted:
/mx/themes/css_xhtml/form.ftl
ERROR [template.FreemarkerTemplateEngine]  The TemplateLoader provided by
the FreeMarker Configuration was a:
org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader
ERROR [components.ClosingUIBean]  Could not open template:
java.io.FileNotFoundException: Template /mx/themes/css_xhtml/form.ftl not
found.

The problem seems to be that BaseTemplateEngine cannot read the
theme.properties file.  This method returns null:

    private InputStream tryReadingPropertyFileFromFileSystem(String
propName)

My "propFile" name is built up as "mx/themes/css_xhtml/theme.properties" --
this file does exist at that path in my webapp root, but propFile.exists()
returns false on this JBoss 7 application server.  The file is definitely
there, but the relative path I specified in struts.ui.templateDir does not
appear to be searched with respect to the webapp's root.

Here's where JBoss puts it on my filesystem:

/usr/local/jboss/standalone/tmp/vfs/deploymentee851be496797b89/rgm-app.war-ccba0b3fcf2c2b22/mx/themes/css_xhtml/theme.properties

I don't know if it's appropriate to teach BaseTemplateEngine about
ServletContext.getRealPath.  It looks like I might have some success moving
my templates into the WEB-INF/classes folder such that I do not need to
rely on BaseTemplateEngine.tryReadingPropertyFileFromFileSystem and can
load it from the classloader instead.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message