incubator-esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Hirsch <hirsch.d...@gmail.com>
Subject Re: Tomcat/ESME: Shutdown Problems
Date Thu, 04 Feb 2010 15:34:34 GMT
LiftRules.unloadHooks.append(() => dbVendor.closeAllConnections_!())

"dbVendor" instead of "DBVendor"
---------------
http://wiki.liftweb.net/index.php/FAQ

How do I execute code when my application is unloaded?

You can define methods to be called when Lift is unloaded via the
LiftRules object in the Boot class.

For example:

def myUnloader(): Unit = {
 // run when Lift is being unloaded
}

LiftRules.unloadHooks += myUnloader _



On Thu, Feb 4, 2010 at 4:24 PM, Uday Subbarayan
<uday.subbarayan@yahoo.com> wrote:
> I am new to Scala. I need some time to make this work. I changed this line of code to,
>
> [WARNING] /home/uday/projects/M1/Prototype/esme/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala:300:
error: value closeAllConnections_! is not a member of object bootstrap.liftweb.DBVendor
>
> [WARNING]     LiftRules.unloadHooks.append(() => DBVendor.closeAllConnections_!())
>                         ^
> [WARNING] one error found
>
> & build FAILS.
>
> I put it under,
>
> def releaseConnection(conn: Connection): Unit = synchronized {
>     pool = conn :: pool
>     LiftRules.unloadHooks.append(() => DBVendor.closeAllConnections_!())
>     notify
>   }
>
> & NOT sure whether this is the right place too.
>
> Best,
> Uday.
> -------------------------
>
> I do not blog but e-write:
>
> http://uds-web.blogspot.com
>
> --- On Thu, 2/4/10, Richard Hirsch <hirsch.dick@gmail.com> wrote:
>
> From: Richard Hirsch <hirsch.dick@gmail.com>
> Subject: Re: Tomcat/ESME: Shutdown Problems
> To: esme-dev@incubator.apache.org
> Date: Thursday, February 4, 2010, 3:58 AM
>
> More ideas from the lift list:
>
> "You can also add to Boot.scala (given that the StandardDBVendor is
> called dbVendor):
>
> LiftRules.unloadHooks.append(() => dbVendor.closeAllConnections_!())
>
> What this will do is close all the DB connections when the context is unloaded.
>
> Additionally, you can switch to H2 which is generally more stable than Derby
> in my experience."
>
> Why don't you try adding the line above to Boot.scala to see if it helps.
>
> I've also added a Jira item to deal with the problem:
> https://issues.apache.org/jira/browse/ESME-155
>
> D.
>
>
>
> On Wed, Feb 3, 2010 at 11:05 PM, Uday Subbarayan
> <uday.subbarayan@yahoo.com> wrote:
>> Tomcat didn't shutdown. I did kill -9 on the process.
>>
>> Uday.
>>
>> -------------------------
>>
>> I do not blog but e-write:
>>
>> http://uds-web.blogspot.com
>>
>> --- On Wed, 2/3/10, Richard Hirsch <hirsch.dick@gmail.com> wrote:
>>
>> From: Richard Hirsch <hirsch.dick@gmail.com>
>> Subject: Re: Tomcat/ESME: Shutdown Problems
>> To: esme-dev@incubator.apache.org
>> Date: Wednesday, February 3, 2010, 8:00 PM
>>
>> I got a comment back from David Pollack on the lift list:
>>
>> http://groups.google.com/group/liftweb/browse_thread/thread/bf498414b18d4226/4299ce36a03749f0?show_docid=4299ce36a03749f0
>>
>> Was the tomcat process really shutdown or did it hang and you had to kill it.
>>
>> D.
>>
>> On Wed, Feb 3, 2010 at 8:41 PM, Richard Hirsch <hirsch.dick@gmail.com> wrote:
>>> No problem in jetty but I remember having problems on occasion with
>>> derby and tomcat. If I remember correctly, I sometimes had problems
>>> during hot deploys.
>>>
>>> D.
>>>
>>> On Wed, Feb 3, 2010 at 7:54 PM, Uday Subbarayan
>>> <uday.subbarayan@yahoo.com> wrote:
>>>> Thanks. Did you try to shutting down & starting your container with ESME?
Just want to make sure that it's not my local environment problem.
>>>>
>>>> Best,
>>>> Uday.
>>>>
>>>> -------------------------
>>>>
>>>> I do not blog but e-write:
>>>>
>>>> http://uds-web.blogspot.com
>>>>
>>>> --- On Wed, 2/3/10, Richard Hirsch <hirsch.dick@gmail.com> wrote:
>>>>
>>>> From: Richard Hirsch <hirsch.dick@gmail.com>
>>>> Subject: Re: Tomcat/ESME: Shutdown Problems
>>>> To: esme-dev@incubator.apache.org
>>>> Date: Wednesday, February 3, 2010, 6:13 PM
>>>>
>>>> looks like a lift problem that might be occur when the container shuts down..
>>>>
>>>> I just posted on the issue on the Lift Google Group. I'm hopeful that
>>>> someone there has an idea.
>>>>
>>>> D.
>>>>
>>>>
>>>> On Wed, Feb 3, 2010 at 4:30 PM, Uday Subbarayan
>>>> <uday.subbarayan@yahoo.com> wrote:
>>>>> After I shutdown Tomcat, i see that there is lot's of stack trace in
the log file. I also noticed that derby is not getting shutdown. Next time, when i restart
Tomcat, ESME fails to load. I get all kinds of exception in the browser.
>>>>>
>>>>> Once i manually kill -9 on the java process then everything works fine..
Here is the (partial) stack trace from the log file. Yahoo email is not allowing me to post
full stack.
>>>>>
>>>>> Best,
>>>>> Uday.
>>>>>
>>>>> ================
>>>>> SEVERE:
>>>>> A web application created a ThreadLocal with key of type
>>>>> [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@13f79f7]) and a
>>>>> value of type [org.apache.derby.iapi.services.context.ContextManager]
>>>>> (value [org.apache.derby.iapi.services.context.ContextManager@b52a28])
>>>>> but failed to remove it when the web application was stopped. To
>>>>> prevent a memory leak, the ThreadLocal has been forcibly removed.
>>>>> Feb 3, 2010 7:04:57 AM
>>>>>  org.apache.coyote.http11.Http11Protocol destroy
>>>>> INFO: Stopping Coyote HTTP/1.1 on http-8080
>>>>> Exception in thread "pool-2-thread-14" java.lang.NullPointerException
>>>>>     at scala.runtime.BoxesRunTime.boxToLong(Unknown Source)
>>>>>     at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$wrapQuery$1.apply(S.scala:972)
>>>>>     at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$wrapQuery$1.apply(S.scala:972)
>>>>>     at scala.List.foreach(List.scala:841)
>>>>>     at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:972)
>>>>>     at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$$anonfun$apply$25.apply(S.scala:1109)
>>>>>     at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:906)
>>>>>     at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$doAround$1..apply(S.scala:907)
>>>>>     at
>>>>>  net.liftweb.mapper.MetaProtoExtendedSession$myWrapper$.apply(ProtoExtendedSession.scala:80)
>>>>>     at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:907)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>>
>
>
>
>

Mime
View raw message