I worked out the issue, and it all depended on the correct config for the 
persistence.xml file.

Since the @PersistenceContext annotation introduces a dependency between my 
SLSB and the Persistence Context/Persistence Unit, if the persistence.xml file 
is incorrect, the SLSB would not deploy correctly and hence would not be bound 
in JNDI.

I found this same issue that you are seeing - remove the @PersistenceContext 
and then my bean would deploy (minus of course the dependency on the 
PersistenceContext.

In my case I had incorrectly packaged the persistence.xml file in the META-INF 
of the EAR instead of the JAR containing the bean. Once I'd worked that out, 
repackaged and redeployed, I did run into a string of other datasource issues 
(MySQL JDBC jar missing. wrong URL in datasource .xml file), but these were 
easy to fix.

If deploying and redeploying while the server was already running I noticed 
that some of the errors were not reporting. If I stopped and restarted the 
server when my ear was alreasdy deployed, I saw more informative dependency 
messages, which helped point me in the right direction:

  | --- MBeans waiting for other MBeans ---
  | ObjectName: 
jboss.j2ee:service=EJB3,ear=test1.ear,jar=test.jar,name=AddressBookBean
  |   State: NOTYETINSTALLED
  |   I Depend On:
  |     persistence.units:unitName=em
  | 
  | --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
  | ObjectName: persistence.units:unitName=em
  |   State: NOTYETINSTALLED
  |   Depends On Me:
  |     jboss.j2ee:service=EJB3,ear=test1.ear,jar=test.jar,name=AddressBookBean
  | 

I also found that also the persistence.xml format had changed. With JBoss 
4.0.4RC1, the syntax is like this:

  | <persistence>
  |    <persistence-unit name="em">
  |       <jta-data-source>java:/DefaultDS</jta-data-source>
  |       <properties>
  |          <property name="hibernate.dialect" 
value="org.hibernate.dialect.HSQLDialect"/>
  |          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
  |       </properties>
  |    </persistence-unit>
  | </persistence>
  | 

Hope that helps,
Kevin Hooke

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3930218#3930218

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3930218


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to