Spring and War exporting

22 views
Skip to first unread message

Emerson Macedo

unread,
Jun 18, 2009, 5:19:28 PM6/18/09
to play-framework
Hi,

In development time, I run my play application with play run, but in
production, I use it deployed on Jboss. My issue is that when I export
a WAR and deploy it, I get an error when using Spring as a Plugin.

See:
Spring context is not started !
The Spring application context is not started.

play.libs.Spring$SpringError
at play.libs.Spring.getBean(Spring.java:99)
at controllers.Login.login(Login.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at play.libs.Java.invokeStatic(Java.java:73)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:113)
at play.server.ServletWrapper$ServletInvocation.execute
(ServletWrapper.java:341)
at play.Invoker$Invocation.doIt(Invoker.java:110)
at play.server.ServletWrapper$ServletInvocation.doIt
(ServletWrapper.java:331)
at play.Invoker.invokeInThread(Invoker.java:44)
at play.server.ServletWrapper.service(ServletWrapper.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:330)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process
(AjpProtocol.java:384)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
447)
at java.lang.Thread.run(Thread.java:619)

Any sugestions?

Thanks

Guillaume Bort

unread,
Jun 18, 2009, 6:57:05 PM6/18/09
to play-fr...@googlegroups.com
Try to copy the application-context.xml to WEB-INF/classes

Emerson Macedo

unread,
Jun 19, 2009, 8:54:09 AM6/19/09
to play-framework
I did this but with no success ...

On 18 jun, 19:57, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Try to copy the application-context.xml to WEB-INF/classes
>

Emerson Macedo

unread,
Jun 19, 2009, 9:43:04 AM6/19/09
to play-framework
Note: when I export war, play don't create classes dir inside WEB-INF.
I created by myself. Why they dont compile classes into WEB-INF/
classes?

About Spring: any other sugetions?

Guillaume Bort

unread,
Jun 19, 2009, 10:45:57 AM6/19/09
to play-fr...@googlegroups.com
Because play never uses the class files, but rely directly on the Java sources.
There are no previous error from Spring ? It should just search for an
application-context.xml file in the classpath and try to load it.

Emerson Macedo

unread,
Jun 19, 2009, 10:57:31 AM6/19/09
to play-framework
Before Spring error, I have an error from LOG, that I'm trying to
solve. See:

11:47:41,182 ERROR ~ Oops. Error in Logger !
java.util.UnknownFormatConversionException: Conversion = 'F'
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:
2605)
at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2633)
at java.util.Formatter.parse(Formatter.java:2479)
at java.util.Formatter.format(Formatter.java:2413)
at java.util.Formatter.format(Formatter.java:2366)
at java.lang.String.format(String.java:2770)

After this, I'm involking an Action that uses Spring, and than, I get
the error. See the line of my code:
MyClass myClass = (MyClass)Spring.getBean
(Play.configuration.getProperty("myclass.bean"));

The name of class is a fake, because I cant post the real name because
is from my company.

I put application-context.xml in WEB-INF/application/conf/ and WEB-INF/
classes and still have the same error.

Thanks,

Emerson



On 19 jun, 11:45, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Because play never uses the class files, but rely directly on the Java sources.
> There are no previous error from Spring ? It should just search for an
> application-context.xml file in the classpath and try to load it.
>

Guillaume Bort

unread,
Jun 19, 2009, 11:16:05 AM6/19/09
to play-fr...@googlegroups.com
Hum.
Do you have a custom play.plugins file in your conf/ directory ? If so
put it to the WEB-INF/classes directory as well.

Basically all files under the conf/ directory must be discoverable
using the classpath. But in WAR mode, they are not ... they should be
copied to the WEB-INF/classes directory by the 'play war' command. It
is a bug.

Let me know if it works. Thank !

Emerson Macedo

unread,
Jun 19, 2009, 1:36:02 PM6/19/09
to play-framework
Yes, it works. Thanks.

By the way, to run Spring properly in war mode, we need only
application-context.xml and play.plugins in WEB-INF/classes as you
said before.

I've made a task in my build script to copy these files and now
everything is ok.

I just need one more help with the log problem I said before. Can you
help me with this?

Thanks!!

On 19 jun, 12:16, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Hum.
> Do you have a custom play.plugins file in your conf/ directory ? If so
> put it to the WEB-INF/classes directory as well.
>
> Basically all files under the conf/ directory must be discoverable
> using the classpath. But in WAR mode, they are not ... they should be
> copied to the WEB-INF/classes directory by the 'play war' command. It
> is a bug.
>
> Let me know if it works. Thank !
>

Guillaume Bort

unread,
Jun 19, 2009, 2:04:22 PM6/19/09
to play-fr...@googlegroups.com
This because the log message contains something like %F and the logger
try to transform it using String.format().

My latest commit fix both problems (logger & war export).
Can you test and tell me if that work ?

Thank.
Reply all
Reply to author
Forward
0 new messages