Play.configuration is null

90 views
Skip to first unread message

My Head Hurts

unread,
May 4, 2011, 7:29:02 AM5/4/11
to play-framework
Hi

I would like to begin by saying thank you for creating Play - it is an
amazing framework and is a pleasure to work with!

But now to the gritty stuff...

I have a problem that is causing my Play.configuration object to be
null. I do not know the cause of this issue and when I restore to
previous sub-versions (that did previously work) the problem appears
to persist.

As a result, I thought there may have been a corruption within the
installation of my Play framework... However, other projects I have
created are able to use the Play.configuration object without
incident.

I am developing in IntelliJ IDEA and I have tried deleting my module
and creating a fresh idealize (I have resorted to clutching at
straws).

I know I have not provided much information with this problem, but I
am not sure what to include.

Has anybody else encountered a similar issue or does anyone have a
good suggestion as to where I can start debugging this problem?

My Head Hurts

unread,
May 4, 2011, 8:07:46 AM5/4/11
to play-framework
Please find the following additional information about the problem:

This is a stacktrace of one of the errors that I am receiving (they
are all the same - just in different classes):

java.lang.ExceptionInInitializerError
at BasicTest.generateSWF(BasicTest.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at org.junit.runners.model.FrameworkMethod
$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
28)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:
43)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:
97)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:
196)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
115)
Caused by: java.lang.NullPointerException
at models.PDFtoSWF.<clinit>(PDFtoSWF.java:21)
... 28 more


The above error is caused by the following line:

private final static String SWF_TOOL =
Play.configuration.getProperty( "command.pdf2swf" );


When placing a try / catch around the above declaration (within a
static method) I receive the following stacktrace:

java.lang.NullPointerException
at models.PDFtoSWF.<clinit>(PDFtoSWF.java:25)
at BasicTest.generateSWF(BasicTest.java:54)
at org.junit.runners.model.FrameworkMethod
$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
28)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:
43)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:
97)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:
196)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
65)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
115)


To confirm that the Play.configuration is in fact null I use the
following code:

if( Play.configuration == null ){
Logger.info( "play config is null" );
}
else{
Logger.info( "play config is not null" );
}


Which returns the following line during a basic test:

INFO: play config is null


Where as in my other projects I receive the message that it is not
null.

I have compared a working project with the broken project but I cannot
find any relevant differences.

Any suggestions are appreciated as I cannot think of anything new to
try...

Thank you.

Morten Kjetland

unread,
May 4, 2011, 8:30:58 AM5/4/11
to play-fr...@googlegroups.com
It looks like you run the test directly in IntelliJ.

When you do it like this, Play it self is not running - nor is it initialized.

When running tests that use Play features like that you have to run them in play:

"play test" and goto http://localhost:9000/@tests

or "play auto-test"

-Morten


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.


My Head Hurts

unread,
May 4, 2011, 9:12:09 AM5/4/11
to play-framework
Ah - ok, yeah, that did seem to be the problem.

Thank you very much and I am embarrassed that was the cause of it all.

Thank you again for your help and your time.

On May 4, 1:30 pm, Morten Kjetland <m...@kjetland.com> wrote:
> It looks like you run the test directly in IntelliJ.
>
> When you do it like this, Play it self is not running - nor is it
> initialized.
>
> When running tests that use Play features like that you have to run them in
> play:
>
> "play test" and gotohttp://localhost:9000/@tests
>
> or "play auto-test"
>
> -Morten

Pascal Voitot Dev

unread,
May 4, 2011, 9:15:59 AM5/4/11
to play-fr...@googlegroups.com
great, I think you should report those comments on stackoverflow for other people ;)

My Head Hurts

unread,
May 4, 2011, 9:17:43 AM5/4/11
to play-framework
I certainly will :)

On May 4, 2:15 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:
> great, I think you should report those comments on stackoverflow for other
> people ;)
>
Reply all
Reply to author
Forward
0 new messages