Thanks Ales...That explains it....So then I have my EAR file with ejb3.jar (ejb3 module) and spring-inject.jar (spring module) and ejb3.war (web-module) .
I also have my ejb 3 as :- package com.ejb3.beans; | | import static javax.ejb.TransactionAttributeType.REQUIRED; | | import javax.ejb.Stateful; | import javax.ejb.TransactionAttribute; | import javax.ejb.EJB; | import javax.annotation.PostConstruct; | import javax.annotation.Resource; | import javax.interceptor.ExcludeDefaultInterceptors; | import javax.sql.DataSource; | import javax.annotation.PreDestroy; | | import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport; | import org.jboss.annotation.spring.Spring; | | import com.ejb3.domain.IPerson; | import com.ejb3.interfaces.Calculator; | import com.ejb3.interfaces.SayHello; | | /** | * @author Ragav | * | */ | | @Stateful | @TransactionAttribute(REQUIRED) | @ExcludeDefaultInterceptors | public class SayHelloBean extends SimpleJdbcDaoSupport implements SayHello { | | @Resource(name = "jdbc/TestDs", type = DataSource.class, shareable = true, mappedName = "java:jdbc/OracleDS") | private DataSource ds; | | @EJB(beanName = "CalculatorBean") | private Calculator calculator; | | @Resource(name = "sqlForEjb") | private String sql; | | @Spring(jndiName = "spring-inject", bean = "person") | private IPerson p; | | public String sayHelloWithEjb3DI() { | return "Testing ejb3 DI & your age is " | + getSimpleJdbcTemplate().queryForInt(sql); | } | | public double calulate() { | return calculator.calculate(2, 3); | } | | @PostConstruct | public void init() { | setDataSource(ds); | } | | @PreDestroy | public void callThis() { | System.out.println("Invoking method: preDestroy()"); | } | | public IPerson getPerson() { | return this.p; | } | | } | But it appears that annotation @Spring(jndiName = "spring-inject", bean = "person") does not work since the jndiName "spring-inject" is not bound. This is the error I get : 20:13:40,609 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [/home,ejbLocalIntf]; root of BeanFactory hierarchy] 20:13:40,844 ERROR [STDERR] java.lang.RuntimeException: javax.naming.NameNotFoundException: spring-inject not bound 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.EJBContainer.construct(EJBContainer.java:727) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.createBeanContext(StatefulContainer.java:103) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.pool.AbstractPool.createBeanContext(AbstractPool.java:130) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:79) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:58) 20:13:40,844 ERROR [STDERR] at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:113) If you see, it says that the name "spring-inject" (name of my spring archive within my EAR ) is not bound to jndi. My application.xml is as follows :- <application xmlns="http://java.sun.com/xml/ns/javaee" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | http://java.sun.com/xml/ns/javaee/application_5.xsd" | version="5"> | <description>Test ejb3 j2ee 5 application</description> | <display-name>Ejb3</display-name> | <module> | <web> | <web-uri>Ejb3.war</web-uri> | <context-root>ejb3</context-root> | </web> | </module> | <module> | <ejb>Ejb3.jar</ejb> | </module> | <module> | <java>spring-inject.jar</java> | </module> | </application> | | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116282#4116282 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116282 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user