Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Closing Spring root WebApplicationContext - Oracle11g - Spring 3.0.2

698116Nov 23 2010 — edited Aug 29 2013
Hi,

I have recently upgraded my server to 11G from 8.1. I know it's a big upgrade.
Also updated the Spring to 3.0.2 Version.

Application (war) get's deployed and spring container is initialized from web.xml alright.
Using ContextLoaderListener --
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

However on the first access of Login.jsp the Spring restarts...

<Nov 23, 2010 4:59:21 PM EST> <Info> <ServletContext-/weboms> <BEA-000000> <Closing Spring root WebApplicationContext>
Nov-23-2010 21:59:21 INFO (AbstractApplicationContext.java:823) - Closing org.springframework.web.context.support.XmlWebApplicationContext@194af77: d
isplay name [Root WebApplicationContext]; startup date [Tue Nov 23 21:58:19 GMT 2010]; root of context hierarchy

And then again Initializies

<Nov 23, 2010 4:59:58 PM EST> <Info> <ServletContext-/weboms> <BEA-000000> <Initializing Spring root WebApplicationContext>
Nov-23-2010 21:59:58 INFO (ContextLoader.java:189) - Root WebApplicationContext: initialization started
Nov-23-2010 21:59:58 INFO (AbstractApplicationContext.java:400) - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@19132a0
: display name [Root WebApplicationContext]; startup date [Tue Nov 23 21:59:58 GMT 2010]; root of context hierarchy
Nov-23-2010 21:59:59 INFO (XmlBeanDefinitionReader.java:308) - Loading XML bean definitions from URL [file:/C:/weblogic/user_projects/domains/ccfs/ap
pconfig/ccfs-webcontext.xml]

This is strange and really don't know why it's happening..
I have tried to start the server with Spring DEBUG and Weblogic DEBUG options turned on, but gives me no clue. I only see -- Closing Spring root WebApplicationContext.

Will appreciate any expert guidence on this problem if you have had the same situation.

Thanks
Amit

Comments

Frank Kulash
Answer
Hi,

Welcome to the forum!

Thanks for posting the CREATE TABLE and INSERT statements! That's very helpful.
It's also helpful if you format your code and output. When posting formatted text on this site, type these 6 characters:

\
(all small letters, inside curly brackets) to keep the site from compressing the spaces.

You can do two CONNECT BY queries: one to get the desired amount, and the other like you're already doing, to get the indented child column.  The first will differ in that it has no START WITH clause, which means every node in your table will be the root of a tree, and that there's an additional CONNECT BY condition to quit looking for descendants as soon as an amount is found.  This corresponds to your apparant requirement that the desired_amount is the amount, if it is not NULL, and only otherwise is the sum of the desired_amounts of one's descendants.
WITH desired_amount_tree AS
(
SELECT CONNECT_BY_ROOT child AS root
, child
, child_amount
FROM ent_rel
CONNECT BY PRIOR child = parent
AND PRIOR child_amount IS NULL
)
, got_desired_amount AS
(
SELECT root
, SUM (child_amount) AS desired_amount
FROM desired_amount_tree
GROUP BY root
)
select RPAD ( ' '
, (LEVEL - 1) * 2
, '-'
) || e.child AS child
, level
, e.child_amount
, desired_amount
from ent_rel e
JOIN got_desired_amount d ON e.child = d.root
start with parent is null
connect by prior child = parent
;
It's usually more efficient to do join after doing the CONNECT BY.  For better performance, try doing your original query by itself, and then joining its result set to got_desired_amount.
Of course, it would be a lot more efficient if we could eliminate the extra CONNECT BY query.  That might be possible using MODEL or (starting in Oracle 11.2) a recursive sub-query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
Marked as Answer by 529206 · Sep 27 2020
529206
Hi Frank,

Thanks a lot for the quick solution. It is working great and thanks for the tips too for better posting on this forum. Appreciate your help.

thanks and regards,
Knl.
Aketi Jyuuzou
I like scalar subQuery :D
create table ent_rel (parent integer,
child integer, child_amount integer);

insert into ent_rel
select null, 100, null from dual
union all select 100, 101, null from dual
union all select 101, 102, 20 from dual
union all select 102, 103, null from dual
union all select 103, 104, null from dual
union all select 104, 105, null from dual
union all select 105, 106, 40 from dual
union all select 106, 107, null from dual
union all select 107, 108, 20 from dual
union all select 107, 109, 10 from dual
union all select 101, 203, null from dual
union all select 203, 205, 50 from dual
union all select 205, 207, null from dual
union all select 207, 209, null from dual
union all select 209, 210, 10 from dual;

col parent for a40

select Lpad('-',(Level-1)*2,'-') || child as parent,
Level,child_amount,
(select sum(b.child_amount)
   from ent_rel b
start with b.RowID = a.RowID
connect by prior child = parent
       and prior child_amount is null) as sumV
  from ent_rel a
start with parent is null
connect by prior child = parent;

PARENT               LEVEL  CHILD_AMOUNT  SUMV
-------------------  -----  ------------  ----
100                      1          null    70
--101                    2          null    70
----102                  3            20    20
------103                4          null    40
--------104              5          null    40
----------105            6          null    40
------------106          7            40    40
--------------107        8          null    30
----------------108      9            20    20
----------------109      9            10    10
----203                  3          null    50
------205                4            50    50
--------207              5          null    10
----------209            6          null    10
------------210          7            10    10
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 26 2013
Added on Nov 23 2010
2 comments
6,349 views