• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring "views.properties" file field "stylesheetLocation" needs to point outside of project/WAR-file

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a bean "ResourceBundleViewResolver" that connects to file "views.properties".
The Bean and the file is described generally there:
http://static.springsource.org/spring/docs/2.0.x/reference/view.html

I generate XML data in code at runtime but XSL-file locates inside project there:
F:\eclipse_workspace\TKIS\WebContent\WEB-INF\xsl\decisionsIType.xsl

I'm successfully generating Pdf-files from Xml using XSL-files if my file "views.properties" has such folder path in variable "stylesheetLocation":



I want my project to read xsl-file "F:\TEMP\xsl\" instead (which locates outside the project/WAR), so i copied the xsl file to there:
F:\TEMP\xsl\decisionOfSupervisionFee.xsl

But I'm getting error if my file "views.properties" has such folder path in variable "stylesheetLocation":

decisionIType.(class) = ee.vet.tkis.domain.pdf.DecisionITypeView
decisionIType.contentType = application/pdf;charset=UTF-8
decisionIType.stylesheetLocation = F:\\TEMP\\xsl\\decisionsIType.xsl

The error is such:

SEVERE: Servlet.service() for servlet [toidukontroll] in context with path [/TKIS] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'decisionIType': Initialization of bean failed; nested exception is org.springframework.context.ApplicationContextException: Can't load XSLT stylesheet from ServletContext resource [/F:/TEMP/xsl/decisionsIType.xsl]; nested exception is java.io.FileNotFoundException: ServletContext resource [/F:/TEMP/xsl/decisionsIType.xsl] cannot be resolved to URL because it does not exist] with root cause
java.io.FileNotFoundException: ServletContext resource [/F:/TEMP/xsl/decisionsIType.xsl] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:129)
at org.springframework.web.servlet.view.xslt.AbstractXsltView.getStylesheetSource(AbstractXsltView.java:577)
at org.springframework.web.servlet.view.xslt.AbstractXsltView.getTemplates(AbstractXsltView.java:542)





Why i get this error?
My overall goal is to compile .WAR file so that folder containing XSL-files is outside the WAR-file, let's say i want the XSL files directory be folder "F:\\TEMP\\xsl
". How can i achieve that?
Maybe "views.properties" file does not allow full path with drive letter to attribute "stylesheetLocation"?

 
Charles Roos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got solution, the full path should be with "file:///" prefix so:

 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Java Ranch! Thanks for posting back with the solution.
 
reply
    Bookmark Topic Watch Topic
  • New Topic