Announcement Announcement Module
No announcement yet.
Spring between business layer & dao layer Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring between business layer & dao layer


    I deploy a .ear on JBOSS.

    I have 3 layers : web.war, ejb.jar, dao.jar.

    I can reach ejb from web layer using Spring.
    But I can't manage to reach dao from ejb !

    I wire ejb with dao in the applicationContext.xml of ejb.jar. But no way to reach the dao.

    Is there a special thing to do ?

    Thanx 4 help.

  • #2
    Please be more specific about your problem. What do you mean by "can't reach"?


    • #3
      precisions ...

      Hi Rod,

      It's a honnor for me that you answer !

      I have this EJB in package busy of my business.jar :
      Business the business interface
      BusinessHome the Home Interface
      BusinessLocal the Remote Interface
      BusinessEjb the EJB wich calls BusinessImpl
      BusinessImpl the POJO which implements Business

      I have this dao in package dao in dao.jar :
      IDAO interface
      DAO implements IDAO

      I wanna wire BusinessImpl to DAO.
      Here is applicationContext of ejb.jar :

      <bean id="dao" class="dao.DAO"/>

      <bean id="businessImpl" class="busy.BusinessImpl">
      <property name="dao">
      <ref bean="dao"/>

      <bean id="businessEjb" class="busy.BusinessEjb">
      <property name="business">
      <ref bean="businessImpl" />

      If I don't wire the EJB to the DAO, it's OK.

      But now they are wired and JBOSS says CreateException :
      2006-01-24 23:10:19,038 DEBUG [org.springframework.jndi.JndiTemplate] Looking up JNDI object with name [java:comp/env/ejb/BeanFactoryPath]
      2006-01-24 23:10:19,038 DEBUG [org.springframework.context.access.ContextJndiBean FactoryLocator] Located object with JNDI name [java:comp/env/ejb/BeanFactoryPath]
      2006-01-24 23:10:19,038 DEBUG [org.springframework.context.access.ContextJndiBean FactoryLocator] Bean factory path from JNDI environment variable [java:comp/env/ejb/BeanFactoryPath] is: applicationContext.xml
      2006-01-24 23:10:19,128 INFO [org.springframework.beans.factory.xml.XmlBeanDefin itionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
      2006-01-24 23:10:19,128 DEBUG [org.springframework.beans.factory.xml.XmlBeanDefin itionReader] Using JAXP implementation [[email protected] 15cb235]
      2006-01-24 23:10:19,128 DEBUG [org.springframework.beans.factory.xml.ResourceEnti tyResolver] Trying to resolve XML entity with public ID [-//SPRING//DTD BEAN//EN] and system ID []
      2006-01-24 23:10:19,128 DEBUG [org.springframework.beans.factory.xml.ResourceEnti tyResolver] Trying to locate [spring-beans.dtd] in Spring jar
      2006-01-24 23:10:19,128 DEBUG [org.springframework.beans.factory.xml.ResourceEnti tyResolver] Found beans DTD [] in classpath
      2006-01-24 23:10:19,148 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract busy.BusinessLocal busy.BusinessHome.create() throws javax.ejb.CreateException:
      javax.ejb.EJBException: Could not instantiate bean
      at org.jboss.ejb.plugins.AbstractInstancePool.get(Abs
      at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invokeHome(StatelessSessionInstanceInterce
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHo me(
      at vokeHome(
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHo me(
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(Lo
      at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invokeHome( )
      at org.jboss.ejb.SessionContainer.internalInvokeHome(
      at org.jboss.ejb.Container.invoke(
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invokeHome(
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(
      at $Proxy51.create(Unknown Source)

      I don't know how to reach my DAO.

      Thanx 4 your help :-)


      • #4
        space !

        Hi Rod,

        It was a stupid mistake from me : I use comma instead of space in ejb.jar Class-Path=...

        My ejb can reach now my dao.

        Sorry 4 the disturbance and thanx a lot.