openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Louis Bros <louisbros...@hotmail.com>
Subject tomee ejb annotation not injecting
Date Thu, 09 Aug 2012 06:12:41 GMT
tomee ejb annotation not injecting

Hi everyone,

I'm having problems with EJB injection is tomee. I can't seem to find what
I'm missing.

I have a simple JSF webapp with both my ManagedBean and Stateless Bean in
the same war file under WEB-INF/classes.

The webapp works as expected when run in Glassfish 3 but in tomee the
injection seems to fail.

I hope someone knows what I'm doing wrong.


My EJB:

package com.ejbtest.ejb;

import javax.ejb.Stateless;

@Stateless
public class HelloEJB{

	public String sayHello(){
		return "Hey hey"; 
	}
}


My Managed Bean:

package com.ejbtest.test;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.io.Serializable;

import javax.ejb.EJB;
import com.ejbtest.ejb.HelloEJB;

@ManagedBean
@RequestScoped
public class TestBean implements Serializable{

	@EJB
	private HelloEJB helloEJB;

	private String test = "default";

	public String getTest() {
		return test;
	}

	public void setTest(String test){
		this.test = test;
	}

	public String doTest(){

		if(helloEJB == null){
			test = "Not Injected";
		}
		else{
			test = helloEJB.sayHello();
		}
		return null;
	}
}



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-ejb-annotation-not-injecting-tp4656726.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message