Session bean equivalent for Tomcat

I have an application that usesTomcatandHibernate.

MyJSF pagescommunicate withmanaged beans and I would like these beans to communicate with aservice layer(something like Session Beans) and then with myDAOs.

Th problem is that I am usingTomcatthat I know that does not support EJBs technology.

So what I could use for the service layer something like a Session Bean that is not a Session Bean?

Thanking you in advance.

[530 byte] By [juanitaJa] at [2007-11-26 21:54:49]
# 1

If all you are wanting is a simple service layer, you can accomplish that by using Faces-managed beans:

<managed-bean>

<description>Service Layer</description>

<managed-bean-name>serviceBean</managed-bean-name>

<managed-bean-class>

com.foo.service.ServiceBean

</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<managed-bean>

<description>My Page's Bean</description>

<managed-bean-name>myBean</managed-bean-name>

<managed-bean-class>

com.foo.MyBean

</managed-bean-class>

<managed-bean-scope>request</managed-bean-scope>

<managed-property>

<property-name>service</property-name>

<value>#{serviceBean}</value>

</managed-property>

</managed-bean>

In ServiceBean, you can encapsulate your business logic, as well as the creation of your DAO (you can also let Faces manage that for you and inject into your service bean in faces-config.xml, if you'd like, which is likely the approach I'd take). There is no requirement that a managed bean handle only one page/view, so this bean can be used over and over if you need to.

If you need the "remoting" capabilities of EJB Session Beans, you might look into Spring, as it has remoting support. As an EJB3 user, though, I have no experience with that. :)

Hope that helps. Let me know if you need anything more...

jdleea at 2007-7-10 3:50:05 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
So what you propose is another managed bean that will handle the calls in the DAO correct?The truth is that I would like a service layer with "remoting" capabilities.Do you know anything else except from Spring? Does Spring work withTomcat?
juanitaJa at 2007-7-10 3:50:05 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

The extra managed bean is one approach, though if you need remoting, then the faces-config.xml route isn't the best choice. As far as Spring and Tomcat goes, they work together really well. I can't offer any help with Spring's remoting, though, as I noted, and there are other remoting technologies (RMI, SOAP and Hessian web services comes to mind) if you prefer not to use Spring.

jdleea at 2007-7-10 3:50:05 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
ok thank you very much for your replies
juanitaJa at 2007-7-10 3:50:05 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...