[jboss-user] [EJB3] - PersistenceContext is null after datasource hot deploy

David Visicchio do-not-reply at jboss.com
Fri Nov 11 06:16:57 EST 2011


David Visicchio [http://community.jboss.org/people/ryandavid] created the discussion

"PersistenceContext is null after datasource hot deploy"

To view the discussion, visit: http://community.jboss.org/message/636103#636103

--------------------------------------------------------------
Hello,
I am using some EJB3 session stateless bean with hibernate JPA integration on JBoss 5.1.0 GA. 

The EJBs are packaged within a JAR (containing the persistence.xml and *.hbm.xml mapping files) and each EJB defines a Session object injected with @PersistenceContext annotation. All works fine.

The problem raises when I try to make a hot deploy of the datasource. 

In this case I see that JBoss starts a new deployment of the datasource, of the persistence unit and the EJBs too but when I try to call an EJB I get a NullPointerException because the Session object wasn't injected.

This is the persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">  
          <persistence-unit name="CFP-HibernateManager" transaction-type="JTA">
                         <description>Configurazione di JPA</description>    
            <jta-data-source>java:/jdbc/OracleCFP</jta-data-source>      
                <properties>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
            </properties> 
          </persistence-unit>  
</persistence>

and the following is snipped code of an EJB

public class AnnoEJB extends CFPHibernateImpl implements AnnoRemote {

          @PersistenceContext(unitName="CFP-HibernateManager") 
          private Session sx;

Any idea is appreciated.

Thanks a lot
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/636103#636103]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111111/0e62254c/attachment-0001.html 


More information about the jboss-user mailing list