Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.NoClassDefFoundError: Could not initialize class play.data.format.Formatters
    primarykey
    data
    text
    <p>I'm using Play 2.1.2 and I want to use dynamic forms. I tried it in my own small hello world project and everything worked fine, but when I use forms in other bigger project I'm getting an exception. Here is my code (in both project is the same):</p> <p><strong>Controller</strong></p> <pre><code>public static Result signInForm() { DynamicForm form = Form.form().bindFromRequest(); //exception on this line return renderJapid(form); } </code></pre> <p><strong>Routes</strong></p> <pre><code>GET /sign-in controllers.Authentication.signInForm() </code></pre> <p>When I go to localhost:9000/sign-in I get this <strong>exception</strong>:</p> <pre><code>Caused by: java.lang.NoClassDefFoundError: Could not initialize class play.data.format.Formatters at play.data.Form.bind(Form.java:320) ~[play-java_2.10.jar:2.1.2] at play.data.DynamicForm.bind(DynamicForm.java:100) ~[play-java_2.10.jar:2.1.2] at play.data.DynamicForm.bindFromRequest(DynamicForm.java:71) ~[play-java_2.10.jar:2.1.2] at controllers.Authentication.signInForm(Authentication.java:310) ~[na:na] at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:305) ~[na:na] at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:305) ~[na:na] </code></pre> <p>Please, can you help me? Where could be the problem? I've checked Global.java and application.conf in both projects but I didn't find anything what could cause this problem.</p> <p><strong>UPDATE</strong>:</p> <p>I've tried to put this code </p> <pre><code>FormattingConversionService fcs = Formatters.conversion; </code></pre> <p>before the line with the dynamic form call. After reloading localhost:9000/sign-in in browser I got this exception on that new line:</p> <pre><code>Caused by: java.lang.NullPointerException: null at play.data.format.Formatters.register(Formatters.java:186) ~[play-java_2.10.jar:2.1.2] at play.data.format.Formatters.&lt;clinit&gt;(Formatters.java:100) ~[play-java_2.10.jar:2.1.2] at controllers.Authentication.signInForm(Authentication.java:310) ~[na:na] at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:305) ~[na:na] at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:305) ~[na:na] at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:175) ~[play_2.10.jar:2.1.2] </code></pre> <p>So it seems that Formatters is in the classpath. But when I hit the reload button in the browser again I get the same NoClassDefFoundError as before (this time on the line which I added).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload