Global JNDI names dissapear after using annotation @PersistenceContext
ggolebio Sep 3, 2010 3:45 AMHi,
I discovered that when I'm use @PersistenceContext annotation then after deploy i lost some global JNDI names.
(Example project is ready in attachment)
For example in my EJB I have 3 classes : Number, NumberArabic and NumberRome.
Number is Remote and NumberArabic and NumberRome are local.
When I deploy my ear without @PersistenceContext annotation then below JNDI names are produced :
InjectionTestEar/NumberArabic/local - EJB3.x Default Local Business Interface
InjectionTestEar/NumberArabic/local-ejb.injection.test.interfaces.NumberArabicInterface - EJB3.x Local Business Interface
....
InjectionTestEar/NumberRome/local - EJB3.x Default Local Business Interface
InjectionTestEar/NumberRome/local-ejb.injection.test.interfaces.NumberRomeInterface - EJB3.x Local Business Interface
....
Number - EJB3.x Default Remote Business Interface
InjectionTestEar/Number/remote-ejb.injection.test.interfaces.NumberInterfaceRemote - EJB3.x Remote Business Interface
InjectionTestEar/Number/local - EJB3.x Default Local Business Interface
InjectionTestEar/Number/local-ejb.injection.test.interfaces.NumberInterfaceLocal - EJB3.x Local Business Interface
When in NumberArabic class i use @PersistenceContext then i lost e.g. Number jndi name and then lookup from client is impossible.
This is the NumberArabic class :
package injectton.test.sessionbean;
import injection.test.enums.NumType;
import javax.ejb.Local;
import javax.ejb.Stateful;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContexts;
import ejb.injection.test.interfaces.NumberArabicInterface;
//below annotation make problems
//@PersistenceContexts({
// @PersistenceContext(name="BlobDB1TypeUnit", unitName="BlobDB1TypeUnit"),
// @PersistenceContext(name="BlobDB2TypeUnit", unitName="BlobDB2TypeUnit")
//})
@Local
@Stateful
public class NumberArabic implements NumberArabicInterface{
public String getNumberType(NumType type) {
return type.toString();
}
}
In Result after deploy with uncommented @PersistenceContext annotation only below JNDI names are produced :
InjectionTestEar/NumberRome/local - EJB3.x Default Local Business Interface
InjectionTestEar/NumberRome/local-ejb.injection.test.interfaces.NumberRomeInterface - EJB3.x Local Business Interface
I'm use JBoss 6 m4. Maybe someone know where the problem is? (Whole source code as eclipse projects are in attachment : InjectionTest.zip)
Regards,
Greg
-
InjectionTest.zip 30.7 KB