Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > EJB

Reply
 
Thread Tools Display Modes
  #1  
Old Nov 23rd, 2009, 06:54 PM
jcl jcl is offline
Junior Member
 
Join Date: Oct 2009
Posts: 2
Default [EJB into Spring]inject a Stateless EJB3 into a Bean Spring

Hi all

I have an Enterprise project in NetBeans,this is the layout:
Code:
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.)
My application service is Jboss 5.1.0.

My application context is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">

    <jee:jndi-lookup id = "utenteService" jndi-name ="ejb.service.UtenteService" resource-ref = "true"/>

    <bean id ="springUtenteService" class = "spring.service.SpringUtenteServiceImpl">
        <property name = "utenteService" ref = "utenteService"/>
    </bean>

</beans>

But when i run the project i have this exception:

Code:
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'm a newbie and I don't understand where is the error...I hope someone can help me.

regards
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:34 PM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.