question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.1.0 Regression] Dev-Mode ClassLoader does not contain app classes

See original GitHub issue

In play 2.1.0, our custom logback filter located in our app can’t be loaded in dev mode (throwing a ClassNotFoundException). In production mode, it can be loaded. In play 2.0, logback was able to load the filter in both modes.

This is the exception we get in dev mode (reduced context, originally about 50 lines of probably irrelevant stuff):

11:38:21,235 |-ERROR in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not create component [filter] of type [de.deviceident.log.MarkerFilter] java.lang.ClassNotFoundException: de.deviceident.log.MarkerFilter
        at java.lang.ClassNotFoundException: de.deviceident.log.MarkerFilter
        at      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at      at java.security.AccessController.doPrivileged(Native Method)
        at      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at      at sbt.PlayCommands$$anonfun$53$$anonfun$55$$anon$2.loadClass(PlayCommands.scala:535)
        at      at ch.qos.logback.core.util.Loader.loadClass(Loader.java:124)

In dev-mode (via ‘sbt run’), the following ClassLoader is used (log message provoked by adding a non-fatal error in the application-logger.xml):

11:38:21,166 |-ERROR in ch.qos.logback.core.joran.util.PropertySetter@31eeeaed - The class "ch.qos.logback.core.filter.Filter" was loaded by 
11:38:21,167 |-ERROR in ch.qos.logback.core.joran.util.PropertySetter@31eeeaed - [SBT/Play shared ClassLoader, with: WrappedArray(file:/home/ole/projects/ll/di/lib/UASparser-0.3.1.jar, file:/home/ole/projects/ll/di/lib/jregex-1.2_01.jar, file:/home/ole/.sbt/boot/scala-2.10.0/lib/scala-library.jar, file:/home/ole/.ivy2/cache/play/play_2.10/jars/play_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/play/sbt-link/jars/sbt-link-2.1.0.jar, file:/home/ole/.ivy2/cache/org.javassist/javassist/jars/javassist-3.16.1-GA.jar, file:/home/ole/.ivy2/cache/play/play-exceptions/jars/play-exceptions-2.1.0.jar, file:/home/ole/.ivy2/cache/play/templates_2.10/jars/templates_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/com.github.scala-incubator.io/scala-io-file_2.10/jars/scala-io-file_2.10-0.4.2.jar, file:/home/ole/.ivy2/cache/com.github.scala-incubator.io/scala-io-core_2.10/jars/scala-io-core_2.10-0.4.2.jar, file:/home/ole/.ivy2/cache/com.jsuereth/scala-arm_2.10/jars/scala-arm_2.10-1.3.jar, file:/home/ole/.ivy2/cache/play/play-iteratees_2.10/jars/play-iteratees_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/org.scala-stm/scala-stm_2.10.0/jars/scala-stm_2.10.0-0.6.jar, file:/home/ole/.ivy2/cache/com.typesafe/config/bundles/config-1.0.0.jar, file:/home/ole/.ivy2/cache/io.netty/netty/bundles/netty-3.5.9.Final.jar, file:/home/ole/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.6.jar, file:/home/ole/.ivy2/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.6.6.jar, file:/home/ole/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.6.6.jar, file:/home/ole/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.0.7.jar, file:/home/ole/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.7.jar, file:/home/ole/.ivy2/cache/com.typesafe.akka/akka-actor_2.10/bundles/akka-actor_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/com.typesafe.akka/akka-slf4j_2.10/bundles/akka-slf4j_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.1.jar, file:/home/ole/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.2.jar, file:/home/ole/.ivy2/cache/org.apache.commons/commons-lang3/jars/commons-lang3-3.1.jar, file:/home/ole/.ivy2/cache/com.ning/async-http-client/jars/async-http-client-1.7.6.jar, file:/home/ole/.ivy2/cache/oauth.signpost/signpost-core/jars/signpost-core-1.2.1.2.jar, file:/home/ole/.ivy2/cache/commons-codec/commons-codec/jars/commons-codec-1.7.jar, file:/home/ole/.ivy2/cache/oauth.signpost/signpost-commonshttp4/jars/signpost-commonshttp4-1.2.1.2.jar, file:/home/ole/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar, file:/home/ole/.ivy2/cache/org.codehaus.jackson/jackson-core-asl/jars/jackson-core-asl-1.9.10.jar, file:/home/ole/.ivy2/cache/org.codehaus.jackson/jackson-mapper-asl/jars/jackson-mapper-asl-1.9.10.jar, file:/home/ole/.ivy2/cache/net.sf.ehcache/ehcache-core/jars/ehcache-core-2.6.0.jar, file:/home/ole/.ivy2/cache/javax.transaction/jta/jars/jta-1.1.jar, file:/home/ole/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.0.jar, file:/home/ole/.ivy2/cache/play/play-test_2.10/jars/play-test_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.1.jar, file:/home/ole/.ivy2/cache/org.specs2/specs2_2.10/jars/specs2_2.10-1.13.jar, file:/home/ole/.ivy2/cache/org.specs2/scalaz-core_2.10/jars/scalaz-core_2.10-7.0.0.jar, file:/home/ole/.ivy2/cache/org.specs2/scalaz-concurrent_2.10/jars/scalaz-concurrent_2.10-7.0.0.jar, file:/home/ole/.ivy2/cache/org.specs2/scalaz-effect_2.10/jars/scalaz-effect_2.10-7.0.0.jar, file:/home/ole/.ivy2/cache/com.novocode/junit-interface/jars/junit-interface-0.9.jar, file:/home/ole/.ivy2/cache/junit/junit-dep/jars/junit-dep-4.8.2.jar, file:/home/ole/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar, file:/home/ole/.ivy2/cache/org.fluentlenium/fluentlenium-festassert/jars/fluentlenium-festassert-0.7.3.jar, file:/home/ole/.ivy2/cache/org.fluentlenium/fluentlenium-core/jars/fluentlenium-core-0.7.3.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-java/jars/selenium-java-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-android-driver/jars/selenium-android-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-remote-driver/jars/selenium-remote-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/cglib/cglib-nodep/jars/cglib-nodep-2.1_3.jar, file:/home/ole/.ivy2/cache/org.json/json/jars/json-20080701.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-api/jars/selenium-api-2.25.0.jar, file:/home/ole/.ivy2/cache/com.google.guava/guava/jars/guava-12.0.jar, file:/home/ole/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-1.3.9.jar, file:/home/ole/.ivy2/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.1.2.jar, file:/home/ole/.ivy2/cache/org.apache.httpcomponents/httpcore/jars/httpcore-4.1.3.jar, file:/home/ole/.ivy2/cache/org.apache.commons/commons-exec/jars/commons-exec-1.1.jar, file:/home/ole/.ivy2/cache/net.java.dev.jna/jna/jars/jna-3.4.0.jar, file:/home/ole/.ivy2/cache/net.java.dev.jna/platform/jars/platform-3.4.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-chrome-driver/jars/selenium-chrome-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-htmlunit-driver/jars/selenium-htmlunit-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/net.sourceforge.htmlunit/htmlunit/jars/htmlunit-2.9.jar, file:/home/ole/.ivy2/cache/xalan/xalan/jars/xalan-2.7.1.jar, file:/home/ole/.ivy2/cache/xalan/serializer/jars/serializer-2.7.1.jar, file:/home/ole/.ivy2/cache/xml-apis/xml-apis/jars/xml-apis-1.3.04.jar, file:/home/ole/.ivy2/cache/commons-collections/commons-collections/jars/commons-collections-3.2.1.jar, file:/home/ole/.ivy2/cache/commons-lang/commons-lang/jars/commons-lang-2.6.jar, file:/home/ole/.ivy2/cache/org.apache.httpcomponents/httpmime/jars/httpmime-4.1.2.jar, file:/home/ole/.ivy2/cache/net.sourceforge.htmlunit/htmlunit-core-js/jars/htmlunit-core-js-2.9.jar, file:/home/ole/.ivy2/cache/xerces/xercesImpl/jars/xercesImpl-2.9.1.jar, file:/home/ole/.ivy2/cache/net.sourceforge.nekohtml/nekohtml/jars/nekohtml-1.9.15.jar, file:/home/ole/.ivy2/cache/net.sourceforge.cssparser/cssparser/jars/cssparser-0.9.5.jar, file:/home/ole/.ivy2/cache/org.w3c.css/sac/jars/sac-1.3.jar, file:/home/ole/.ivy2/cache/commons-io/commons-io/jars/commons-io-2.0.1.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-firefox-driver/jars/selenium-firefox-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-ie-driver/jars/selenium-ie-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-iphone-driver/jars/selenium-iphone-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-safari-driver/jars/selenium-safari-driver-2.25.0.jar, file:/home/ole/.ivy2/cache/org.webbitserver/webbit/jars/webbit-0.4.6.jar, file:/home/ole/.ivy2/cache/org.seleniumhq.selenium/selenium-support/jars/selenium-support-2.25.0.jar, file:/home/ole/.ivy2/cache/org.easytesting/fest-assert/jars/fest-assert-1.4.jar, file:/home/ole/.ivy2/cache/org.easytesting/fest-util/jars/fest-util-1.1.6.jar, file:/home/ole/.ivy2/cache/org.mongodb/casbah-commons_2.10/jars/casbah-commons_2.10-2.5.0.jar, file:/home/ole/.ivy2/cache/com.github.nscala-time/nscala-time_2.10/jars/nscala-time_2.10-0.2.0.jar, file:/home/ole/.ivy2/cache/org.mongodb/mongo-java-driver/jars/mongo-java-driver-2.10.1.jar, file:/home/ole/.ivy2/cache/org.mongodb/casbah-core_2.10/jars/casbah-core_2.10-2.5.0.jar, file:/home/ole/.ivy2/cache/org.mongodb/casbah-query_2.10/jars/casbah-query_2.10-2.5.0.jar, file:/home/ole/.ivy2/cache/org.mongodb/casbah-gridfs_2.10/jars/casbah-gridfs_2.10-2.5.0.jar, file:/home/ole/.ivy2/cache/net.sf.opencsv/opencsv/jars/opencsv-2.1.jar, file:/home/ole/.ivy2/cache/com.typesafe.play.plugins/play-statsd_2.10/jars/play-statsd_2.10-2.1.0.jar, file:/home/ole/.ivy2/cache/com.github.scopt/scopt_2.10/jars/scopt_2.10-2.1.0.jar), using parent: Common ClassLoader: ] whereas object of type

as you can see, the target/scala-2.10/classes dir is not on the classpath.

In prod-mode (via ‘sbt start’), the following ClassLoader is used:

11:14:49,241 |-ERROR in ch.qos.logback.core.joran.util.PropertySetter@4f2d26d2 - The class "ch.qos.logback.core.filter.Filter" was loaded by 
11:14:49,241 |-ERROR in ch.qos.logback.core.joran.util.PropertySetter@4f2d26d2 - [sun.misc.Launcher$AppClassLoader@3326b249] whereas object of type 
11:14:49,241 |-ERROR in ch.qos.logback.core.joran.util.PropertySetter@4f2d26d2 - "ch.qos.logback.classic.turbo.MarkerFilter" was loaded by [sun.misc.Launcher$AppClassLoader@3326b249].

and the filter loads fine and does its job.

This is an example of how we define the filter in our application-logger.xml:

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <filter class="de.di.log.MarkerFilter">
      <Marker>PERFORMANCE</Marker>
      <OnMatch>DENY</OnMatch>
    </filter>
    <encoder>
      <pattern>%date %coloredLevel %marker %logger\n%message%n%xException{5}\n</pattern>
    </encoder>
  </appender>

We have a couple of these filters in different appenders.

More info here: http://play.lighthouseapp.com/projects/82401/tickets/1023-210-Regression-Dev-Mode-ClassLoader-does-not-contain-app-classes @gissues:{“order”:94.87179487179486,“status”:“backlog”}

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
ghostcommented, Nov 27, 2014

@jroper , you’re so helpful 😉

I wouldn’t ask it here if I could find the solution somewhere else; on the stackfoverflow this question was already answered (see http://stackoverflow.com/questions/20210574/play-fails-to-load-custom-log-back-appender), but I don’t like the idea to compile logback stuff and manually put it to jar file at /lib directory. Shouldn’t playframework do our lifes easier?

Another related question in the mailing (see https://groups.google.com/forum/#!topic/play-framework/MgLHlBOldeE) has no answer.

So, sorry me, but in this case I have no other place to ask play-devs on how to make things right except here. We’ll be very grateful if you can confirm that the suggested solution at stackoverflow is the only valid or enlighten us with proper way to extend logback in playframework.

Thanks.

3reactions
jropercommented, Nov 26, 2014

@ssokolenko The mailing list and stack overflow are good places to ask questions, not the issue tracker.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class Loading Reference
This ClassLoader is non-persistent, it will be re-created when the application is started, and is isolated. This ClassLoader is the context ClassLoader that...
Read more >
GWT Release Notes
Fix an issue in super dev mode with changing compiler options not triggering full recompiles. Added missing command line parameters to DevMode entry...
Read more >
Quarkus 2.1.0.Final 发布
Complete changelog ; #18941 – NoSuchElementException in RuntimeUpdatesProcessor if no tests are present in multi module in dev mode ; #18921 – ...
Read more >
Play Change Log
No internal use of the global application instance ( Play.current ). It's now deprecated and possible to disable completely using play.
Read more >
Custom Class Loader Not Loading Class
If it is printing sun.misc.Launcher$AppClassLoader , then that suggests your class is already on the class-path/module-path (e.g., ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found