0 Replies Latest reply on Nov 24, 2009 11:23 AM by javacl

    [Spring + EJB3 (and JSF)] How inject a stateless ejb3 into m

      Hi all.

      I'm new in the ejb3 world,and i haven't experience with Jboss Application Server.

      I have created an application using JSF+Spring+Hibernate and deplyed into Tomcat....and it's work well.

      Now I want to integrate Spring with EJB3,using JBoss 5.1.0:
      I have a Spring bean and i wont inject into this bean my stateless EJB3.


      The structure in my project is:


      Enterprice Application
       |
       |____EjbProject.jar
       | |
       | |
       | |__ejb.service
       | | |__ UtenteService.java (Remote Ejb Interface)
       | | |__ UtenteServiceImpl.java (Stateless Ejb implementation)
       | |
       | |__ejb.dominio
       | |__ Utente.java (Entity Ejb)
       |
       |
       |
       |
       |____WebProject.war
       |
       |__webPages
       | |
       | |__WEBINF
       | |
       | |__ applicationContext.xml
       |
       |
       |__spring.service
       |
       |__spring.service
       |
       |__ SpringUtenteService.java (Spring bean interface)
       |
       |__ SpringUtenteServiceImpl.java (implement. of interf.)
      


      But when I try to run my project i have this excpetion:

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utenteService': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UtenteService not bound
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1362)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:407)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
       at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:251)
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      


      I don't understand where is the error!
      The package with applicationContext and spring's beans go into the WAR file or into the JAR file?

      Are there other configuration file to configure for my scope?

      Thanks for your help!