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

  • Spring between business layer & dao layer

    Hi,

    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.
    TalkinJive.

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

    Comment


    • #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"/>
      </property>
      </bean>

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

      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 [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@ 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 [http://www.springframework.org/dtd/spring-beans.dtd]
      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 [http://www.springframework.org/dtd/spring-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 tractInstancePool.java:180)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invokeHome(StatelessSessionInstanceInterce ptor.java:78)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHo me(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.CallValidationInterceptor.in vokeHome(CallValidationInterceptor.java:41)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:109)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:335)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome( TxInterceptorCMT.java:146)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHo me(SecurityInterceptor.java:116)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(Lo gInterceptor.java:121)
      at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invokeHome(ProxyFactoryFinderInterceptor.java:93 )
      at org.jboss.ejb.SessionContainer.internalInvokeHome( SessionContainer.java:613)
      at org.jboss.ejb.Container.invoke(Container.java:894)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invokeHome(BaseLocalProxyFactory.java:342)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke( LocalHomeProxy.java:118)
      at $Proxy51.create(Unknown Source)

      I don't know how to reach my DAO.

      Thanx 4 your help :-)
      TalkinJive.

      Comment


      • #4
        space !

        Hi Rod,

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

        My ejb can reach now my dao.

        Sorry 4 the disturbance and thanx a lot.
        TalkinJive.

        Comment

        Working...
        X