Topic
1 reply Latest Post - ‏2013-05-02T17:22:02Z by bkail
tkanters
tkanters
1 Post
ACCEPTED ANSWER

Pinned topic @Startup, Singleton EJB doesn't support injection

‏2013-04-22T14:51:35Z |

Hi,

The following doesn't seem to work:

 

@Singleton
@Startup
public class StartupBean {
 
    @PersistenceContext
    private EntityManager entityManager;
 
    @PostConstruct
    public void createData() {
        entityManager.persist(new Task("Timothy", "Kanters"));
    }
}

This does work in Websphere 8.5 Full profile. I'm deploying a war containing a jar with my EJB's the both the JAR and the WAR have a beans.xml. In my full application I am not injecting the persistencecontect but am instead injecting a statefull session bean. Both scenarios don't work on Liberty profile (8.5 Beta) and do work on full profile.

  • bkail
    bkail
    23 Posts
    ACCEPTED ANSWER

    Re: @Startup, Singleton EJB doesn't support injection

    ‏2013-05-02T17:22:02Z  in response to tkanters

    What problem/error are you seeing?  If you're using runtime enhancement and seeing the following warning, then that's a known issue with EJB+CDI+JPA that will be fixed:

    [WARNING ] CWWJP9991W: openjpa.Enhance: Warn: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: