Re: init function when deploying war in Tomcat server

130 views
Skip to first unread message

James Reeves

unread,
Aug 10, 2012, 2:42:29 AM8/10/12
to ring-c...@googlegroups.com
Could you create an example project that suffers from this problem?

The version of Ring doesn't have any bearing on whether the :init
function is called, but there are a couple odd things in the code you
have provided.

Setting servlet-path-info? to false is unusual if you're deploying via
a war file (I can't think of many instances where it would have the
right result), and it's also odd to put the web.xml file into the
resources directory, which would result in the file being included
twice in the resulting war file.

- James.

On 10 August 2012 07:31, Casper Clausen <cas...@gmail.com> wrote:
> I am having trouble getting the init function to work when on a Tomcat server.
>
> When using 'lein ring server' it gets called fine, but when doing a 'lein ring war' and deploying it in a Tomcat 7 server it does not get called.
>
> From my project.clj:
>
> :ring {:handler order.routes/app
> :servlet-path-info? false
> :web-xml "resources/web.xml"
> :init order.routes/ring-init})
>
> Am I missing some configuration to get it to work? It also seems like the web.xml is not loaded properly, because after upgrading to ring 1.1.1 a jsp servlet (configured in the web.xml) it not working anyone.
>
> Anyone know what is up?

Casper Clausen

unread,
Aug 10, 2012, 8:07:57 AM8/10/12
to ring-c...@googlegroups.com, jre...@weavejester.com
Turns out that the problem was that we are using our own web.xml and hadn't defined a listener in the xml for the listener class that ring generates. 

You were spot on about the web.xml being in the wrong place.

/Casper
Reply all
Reply to author
Forward
0 new messages