This discussion is archived
1 Reply Latest reply: Dec 14, 2012 5:27 AM by 650063 RSS

Spring "views.properties" file field "stylesheetLocation" problem

650063 Journeyer
Currently Being Moderated
I have 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":
decisionIType.(class) = ee.vet.tkis.domain.pdf.DecisionITypeView
decisionIType.contentType = application/pdf;charset=UTF-8
decisionIType.stylesheetLocation = WEB-INF\\xsl\\decisionsIType.xsl
I want my project to read xsl-file from there instead, 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"?

Edited by: CharlesRoos on 14.12.2012 14:33

Edited by: CharlesRoos on 14.12.2012 14:33

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points