No embedded stylesheet instruction for file: error using logback
Asked Answered
H

3

17

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?

Holcman answered 15/11, 2012 at 16:22 Comment(0)
D
48

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.

Darkle answered 16/11, 2012 at 8:47 Comment(4)
Since Google pointed me here for this error, I'm going to add how I came across it -- in eclipse, I use the windows pc "f11" key as a shortcut for "debug". Mostly it re-runs the last thing I debugged. But if you have an XML file as the current file open in an editor, eclipse "debugs" the XML file instead of the java program you're working on.Baloney
I go with Kepler, and it still malfunctions. Thanks God a found this answer.Francinafrancine
Sweet. I had a small mishap when I clicked run, and clicked something else. This tip made it work again! +1Tzar
Solution: DON'T SELECT XML FILEPlank
D
3

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).

Dictatorial answered 7/7, 2013 at 20:27 Comment(0)
E
0

This is a problem with Eclipse. When you make configurations, ensure that you click the dropdown beside the run button and select the latest runtime.

Eton answered 10/1 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.