Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No embedded stylesheet instruction for file: error using logback

I have the following logback.xml configuration:

<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
    </encoder>
  </appender>

    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>logFile.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- daily rollover -->
      <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>

      <!-- keep 30 days' worth of history -->
      <maxHistory>30</maxHistory>
    </rollingPolicy>

    <encoder>
      <pattern>%-4relative [%thread] %highlight(%-5level) %cyan(%logger{35}) - %msg%n</pattern>
    </encoder>
  </appender> 

  <root level="DEBUG">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" /> 

  </root>
</configuration>

If I edit the config file in eclipse (Juno), I get the following error:

11:02:54,114 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
11:02:54,115 INFO  [main] Main  - java.endorsed.dirs=C:\Program Files\Java\jre7\lib\endorsed
11:02:54,117 INFO  [main] Main  - launchFile: C:\Users\roberth\Programming_Projects\eclipse\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
11:02:54,145 FATAL [main] Main  - No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
    at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
    ... 2 more

If I delete and recreate the config, sometimes it works, sometimes not. If I edit the file in Notepad++ or another text editor, it works fine. Is this an eclipse issue or am I missing something?

like image 477
Robert H Avatar asked Nov 15 '12 16:11

Robert H


2 Answers

It's an Eclipse bug, I've noticed it too. Make sure that you're running the right Eclipse Runtime config (i.e. if you're clicking on the little green "Play" button on the top, thinking it will re-run the last (valid) Runtime you've ran, re-check (by clicking on the down arrow next to it) to make sure no new Runtime has been created).

What I've noticed it that even though I create a perfectly valid run-time pointing to a Java main class and everything, which I run a few times and all is good, after a while, if I select an xml file (because I wanted to edit it for example) and then leave it selected as I click on my run button, Eclipse will create a new XSLT Transformation run time for that xml file and try to run it, failing with the exception you report. The solution is to erase that run time, make sure I have no xml file selected, and re-run the correct run time.

like image 55
Shivan Dragon Avatar answered Oct 02 '22 21:10

Shivan Dragon


I had the same problem with the newest Eclipse Juno Version. First it seems to be a bug inside Eclipse. After closing the active window inside Eclipse (with the spring-configuration.xml openend) I was able to start the spring container without this error. So it was depending on the run configuration. Take care that you start your "main" class and that you not try to "run" the xml-configuation. That solved the issue for me (Eclipse selected automatically the xml to run).

like image 23
Michael Kempny Avatar answered Oct 01 '22 21:10

Michael Kempny