You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by axelspin <sp...@knmi.nl> on 2007/07/09 12:22:13 UTC

Spring+hibernate business logic accross multiple webapps

Hello,
I am wondering which is the best way to deploy within Tomcat multiple web
apps (portlets-web services) that have access
to the same business logic (developed with Spring+Hibernate).

I`ve seen something here
http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
but I can`t handle ears

I am looking to JNDI, but it is still not clear to me how and what to do
it..and if it is worth.

should I use just a JNDI connection to the JDBC datasource or it would be
better to have all the spring+hibernate service beans loaded in JNDI?



I`ve splitted the webapps applicationContext-<name>.xml files. Crated a jar
with all the business beans and the applicationContext-service.xml and
copied it in the common/lib, together with all the hibernate and spring
libs.It works but I wouldn`t load this stuff in each web.xml for each
web-app using the spring listner. I don`t think it`s a good way to achive my
target..is it?

Any experience about it?
Thnx


-- 
View this message in context: http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring+hibernate business logic accross multiple webapps

Posted by axelspin <sp...@knmi.nl>.

So guys.. Do you think that this discussion thread is hopeless within
Tomcat?
http://forum.springframework.org/archive/index.php/t-9962.html


axelspin wrote:
> 
> Hello,
> I am wondering which is the best way to deploy within Tomcat multiple web
> apps (portlets-web services) that have access
> to the same business logic (developed with Spring+Hibernate).
> 
> I`ve seen something here
> http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
> but I can`t handle ears
> 
> I am looking to JNDI, but it is still not clear to me how and what to do
> it..and if it is worth.
> 
> should I use just a JNDI connection to the JDBC datasource or it would be
> better to have all the spring+hibernate service beans loaded in JNDI?
> 
> 
> 
> I`ve splitted the webapps applicationContext-<name>.xml files. Crated a
> jar with all the business beans and the applicationContext-service.xml and
> copied it in the common/lib, together with all the hibernate and spring
> libs.It works but I wouldn`t load this stuff in each web.xml for each
> web-app using the spring listner. I don`t think it`s a good way to achive
> my target..is it?
> 
> Any experience about it?
> Thnx
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11500640
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Spring+hibernate business logic accross multiple webapps

Posted by "Nelson, Tracy M." <Tr...@nelnet.net>.
| From: axelspin [mailto:spinuso@knmi.nl]
| Sent: Monday, 09 July, 2007 13:12
| 
| But how about performance..
| 
| is it better to have multiple instances of hibernate sessionFactory
| Objects
| (one each web app) or to use an http call for each db query?
| 
| Maybe transactions are handled better with a centralized datasource access
| throug ws.. what do you think?

It sounds to me like you need to refactor your apps.  Your portlets should use a business delegate to request your business logic functions.  The business delegate should in turn call a session façade to perform the requested actions.  This provides a clean separation between your application and business logic, and you can experiment with the linkage between the BD and SF to improve performance (maybe start with web services, as they're likely to be the least troublesome, then move to RMI if the performance isn't good enough).
-----------------------------------------
------------------------------------------------------------
The information contained in this message is confidential
proprietary property of Nelnet, Inc. and its affiliated 
companies (Nelnet) and is intended for the recipient only.
Any reproduction, forwarding, or copying without the express
permission of Nelnet is strictly prohibited. If you have
received this communication in error, please notify us
immediately by replying to this e-mail.
------------------------------------------------------------

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring+hibernate business logic accross multiple webapps

Posted by axelspin <sp...@knmi.nl>.
But how about performance..

is it better to have multiple instances of hibernate sessionFactory Objects
(one each web app) or to use an http call for each db query?

Maybe transactions are handled better with a centralized datasource access
throug ws.. what do you think?



Andre Prasetya-2 wrote:
> 
> i think its better if you use web services for that purpose, or rmi,
> whichever right to your taste
> 
> On 7/9/07, axelspin <sp...@knmi.nl> wrote:
>>
>>
>> Hello,
>> I am wondering which is the best way to deploy within Tomcat multiple web
>> apps (portlets-web services) that have access
>> to the same business logic (developed with Spring+Hibernate).
>>
>> I`ve seen something here
>>
>> http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
>> but I can`t handle ears
>>
>> I am looking to JNDI, but it is still not clear to me how and what to do
>> it..and if it is worth.
>>
>> should I use just a JNDI connection to the JDBC datasource or it would be
>> better to have all the spring+hibernate service beans loaded in JNDI?
>>
>>
>>
>> I`ve splitted the webapps applicationContext-<name>.xml files. Crated a
>> jar
>> with all the business beans and the applicationContext-service.xml and
>> copied it in the common/lib, together with all the hibernate and spring
>> libs.It works but I wouldn`t load this stuff in each web.xml for each
>> web-app using the spring listner. I don`t think it`s a good way to achive
>> my
>> target..is it?
>>
>> Any experience about it?
>> Thnx
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> -- 
> -Andre-
> 
> When the hammer is the only tool that you have, every problem seems like a
> nail
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11506870
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring+hibernate business logic accross multiple webapps

Posted by axelspin <sp...@knmi.nl>.

Designing specific web services for this purpose.. comunications within the
same appserver.. 
sounds a bit depressive.But yes.. could be an option.

Maybe I should move to JBoss or Geronimo and use "ears". But it doesn`t
sound good to my "ears" :-)
I have to open my portlets through wsrp (WSRP4J), so I don`t need to run a
portal sever and I was quite happy with Tomcat right now.. until I didn`t
plan to add Spring and persistency to the data service that should be
accessed from the portlets.. mybe I should develop all my portlet in a
single web app.. but I see this as a limitation as well.




Andre Prasetya-2 wrote:
> 
> i think its better if you use web services for that purpose, or rmi,
> whichever right to your taste
> 
> On 7/9/07, axelspin <sp...@knmi.nl> wrote:
>>
>>
>> Hello,
>> I am wondering which is the best way to deploy within Tomcat multiple web
>> apps (portlets-web services) that have access
>> to the same business logic (developed with Spring+Hibernate).
>>
>> I`ve seen something here
>>
>> http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
>> but I can`t handle ears
>>
>> I am looking to JNDI, but it is still not clear to me how and what to do
>> it..and if it is worth.
>>
>> should I use just a JNDI connection to the JDBC datasource or it would be
>> better to have all the spring+hibernate service beans loaded in JNDI?
>>
>>
>>
>> I`ve splitted the webapps applicationContext-<name>.xml files. Crated a
>> jar
>> with all the business beans and the applicationContext-service.xml and
>> copied it in the common/lib, together with all the hibernate and spring
>> libs.It works but I wouldn`t load this stuff in each web.xml for each
>> web-app using the spring listner. I don`t think it`s a good way to achive
>> my
>> target..is it?
>>
>> Any experience about it?
>> Thnx
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 
> -- 
> -Andre-
> 
> When the hammer is the only tool that you have, every problem seems like a
> nail
> 
> 

-- 
View this message in context: http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11500482
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring+hibernate business logic accross multiple webapps

Posted by Andre Prasetya <an...@gmail.com>.
i think its better if you use web services for that purpose, or rmi,
whichever right to your taste

On 7/9/07, axelspin <sp...@knmi.nl> wrote:
>
>
> Hello,
> I am wondering which is the best way to deploy within Tomcat multiple web
> apps (portlets-web services) that have access
> to the same business logic (developed with Spring+Hibernate).
>
> I`ve seen something here
>
> http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
> but I can`t handle ears
>
> I am looking to JNDI, but it is still not clear to me how and what to do
> it..and if it is worth.
>
> should I use just a JNDI connection to the JDBC datasource or it would be
> better to have all the spring+hibernate service beans loaded in JNDI?
>
>
>
> I`ve splitted the webapps applicationContext-<name>.xml files. Crated a
> jar
> with all the business beans and the applicationContext-service.xml and
> copied it in the common/lib, together with all the hibernate and spring
> libs.It works but I wouldn`t load this stuff in each web.xml for each
> web-app using the spring listner. I don`t think it`s a good way to achive
> my
> target..is it?
>
> Any experience about it?
> Thnx
>
>
> --
> View this message in context:
> http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
-Andre-

When the hammer is the only tool that you have, every problem seems like a
nail

Re: Spring+hibernate business logic accross multiple webapps

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Hi Axel, just out of curiosity, had a look at what you waffling on about, 
coz I've never done portlets.
It's interesting but it actually looks like a nightmare....
I did find a link that I think will help...
http://opensource.atlassian.com/confluence/spring/pages/viewpage.action?pageId=3089

Frames for me.... they can have portlets ;)
Good luck....


----- Original Message ----- 
From: "axelspin" <sp...@knmi.nl>
To: <us...@tomcat.apache.org>
Sent: Monday, July 09, 2007 12:22 PM
Subject: Spring+hibernate business logic accross multiple webapps


>
> Hello,
> I am wondering which is the best way to deploy within Tomcat multiple web
> apps (portlets-web services) that have access
> to the same business logic (developed with Spring+Hibernate).
>
> I`ve seen something here
> http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
> but I can`t handle ears
>
> I am looking to JNDI, but it is still not clear to me how and what to do
> it..and if it is worth.
>
> should I use just a JNDI connection to the JDBC datasource or it would be
> better to have all the spring+hibernate service beans loaded in JNDI?
>
>
>
> I`ve splitted the webapps applicationContext-<name>.xml files. Crated a 
> jar
> with all the business beans and the applicationContext-service.xml and
> copied it in the common/lib, together with all the hibernate and spring
> libs.It works but I wouldn`t load this stuff in each web.xml for each
> web-app using the spring listner. I don`t think it`s a good way to achive 
> my
> target..is it?
>
> Any experience about it?
> Thnx
>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Spring+hibernate business logic accross multiple webapps

Posted by Yefym Dmukh <Ye...@icw-global.com>.
Hi,
case you are going to use stateful session mechanism, be aware  that 
tomcat opens for each webapp context new httpsession. 






axelspin <sp...@knmi.nl> 
09.07.2007 12:22
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>


To
users@tomcat.apache.org
cc

Subject
Spring+hibernate business logic accross multiple webapps







Hello,
I am wondering which is the best way to deploy within Tomcat multiple web
apps (portlets-web services) that have access
to the same business logic (developed with Spring+Hibernate).

I`ve seen something here
http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html

but I can`t handle ears

I am looking to JNDI, but it is still not clear to me how and what to do
it..and if it is worth.

should I use just a JNDI connection to the JDBC datasource or it would be
better to have all the spring+hibernate service beans loaded in JNDI?



I`ve splitted the webapps applicationContext-<name>.xml files. Crated a 
jar
with all the business beans and the applicationContext-service.xml and
copied it in the common/lib, together with all the hibernate and spring
libs.It works but I wouldn`t load this stuff in each web.xml for each
web-app using the spring listner. I don`t think it`s a good way to achive 
my
target..is it?

Any experience about it?
Thnx


-- 
View this message in context: 
http://www.nabble.com/Spring%2Bhibernate-business-logic-accross-multiple-webapps-tf4048280.html#a11498981

Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org