aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Should dependency work with inherence from an abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Should dependency work with inherence from an abstract class" Watch "Should dependency work with inherence from an abstract class" New topic
Author

Should dependency work with inherence from an abstract class

Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
For a project I have created a general abstract class in which I try to inject a entitymanager with @PersistenceContext annotation.

The concrete class which is a child of the abstract class is annoteted with @Stateless and is so a stateless session bean.

Now I tried to use an entitymanager but the injection didn't work. I got the famous NullPointerException.

Should this work. I used JBoss Enterprise Application 4.3.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9343
    
111

That version of JBoss was not fully EJB3 spec compliant. So i am not sure whether it was working there. The recent community version of JBoss AS 5.1.0 should have this working.

[My Blog] [JavaRanch Journal]
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Thanks for your reaction. So it should work following the specification

I will give the newest JBoSS a try on this behaviour. Is it advisable to upgrade to JBoss 5.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Should dependency work with inherence from an abstract class
 
Similar Threads
Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2
I have to use EJB in my project. Where?
EJB3/JPA: problem reloading object with one-to-many
JPA EntityManager lookup failure in Websphere7 environment
Got NullPointer exception when injecting EntityManger