[jboss-jira] [JBoss JIRA] (WFLY-3698) Could not inject persistence unit into CDI managed bean
Oscar Calderon (JIRA)
issues at jboss.org
Thu Jul 31 10:32:29 EDT 2014
[ https://issues.jboss.org/browse/WFLY-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oscar Calderon updated WFLY-3698:
---------------------------------
Description:
I have a project running Spring 4 & JSF 2.1 using Primefaces 5 and Hibernate JPA 2.0. I use Wildfly 8.1 and configured a datasource pointing to an Oracle 10 database. The Wildfly datasource works fine (i've tested using plain JDBC) but when i try to create a LocalContainerEntityManagerFactoryBean through Spring i set the property persistenceUnitName to specify the name of my PU and then injecting in my DAOs using @PersistenceContext(unitName="myPersUnit").
Using JBoss AS 7.1.1 Final works fine and even i don't need to specify persistenceUnitName and it creates as "default" and injects it to my DAOs without specifying name, but with JBoss 8.1 Final it doesn't work. With the same configuration, it shows me the next error:
Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named persUnit in deployment
But, when i remove the @PersistenceContext annotation from my property in my DAO, strangely it initializes the persistenceUnit as i can see in server log:
08:19:57,144 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-13) HHH000204: Processing PersistenceUnitInfo [
name: persUnit
...]
But when i try to inject it, it doesn't
was:
I have a project running Spring 4 & JSF 2.1 using Primefaces 5. I use Wildfly 8.1 and configured a datasource pointing to an Oracle 10 database. The Wildfly datasource works fine (i've tested using plain JDBC) but when i try to create a LocalContainerEntityManagerFactoryBean through Spring i set the property persistenceUnitName to specify the name of my PU and then injecting in my DAOs using @PersistenceContext(unitName="myPersUnit").
Using JBoss AS 7.1.1 Final works fine and even i don't need to specify persistenceUnitName and it creates as "default" and injects it to my DAOs without specifying name, but with JBoss 8.1 Final it doesn't work. With the same configuration, it shows me the next error:
Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named persUnit in deployment
But, when i remove the @PersistenceContext annotation from my property in my DAO, strangely it initializes the persistenceUnit as i can see in server log:
08:19:57,144 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-13) HHH000204: Processing PersistenceUnitInfo [
name: persUnit
...]
But when i try to inject it, it doesn't
> Could not inject persistence unit into CDI managed bean
> -------------------------------------------------------
>
> Key: WFLY-3698
> URL: https://issues.jboss.org/browse/WFLY-3698
> Project: WildFly
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: CDI / Weld, JPA / Hibernate
> Affects Versions: 8.1.0.Final
> Environment: Windows 8.1 64 bits, Notebook Lenovo Z570 Intel Core i7 (2nd Gen) 2670QM / 2.2 GHz , 8GB RAM, using Eclipse Luna to develop
> Reporter: Oscar Calderon
> Assignee: Stuart Douglas
> Original Estimate: 1 week
> Remaining Estimate: 1 week
>
> I have a project running Spring 4 & JSF 2.1 using Primefaces 5 and Hibernate JPA 2.0. I use Wildfly 8.1 and configured a datasource pointing to an Oracle 10 database. The Wildfly datasource works fine (i've tested using plain JDBC) but when i try to create a LocalContainerEntityManagerFactoryBean through Spring i set the property persistenceUnitName to specify the name of my PU and then injecting in my DAOs using @PersistenceContext(unitName="myPersUnit").
> Using JBoss AS 7.1.1 Final works fine and even i don't need to specify persistenceUnitName and it creates as "default" and injects it to my DAOs without specifying name, but with JBoss 8.1 Final it doesn't work. With the same configuration, it shows me the next error:
> Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named persUnit in deployment
> But, when i remove the @PersistenceContext annotation from my property in my DAO, strangely it initializes the persistenceUnit as i can see in server log:
> 08:19:57,144 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-13) HHH000204: Processing PersistenceUnitInfo [
> name: persUnit
> ...]
> But when i try to inject it, it doesn't
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jboss-jira
mailing list