Sorry, seems Item 1 seems is not put out clearly, some explanations for item 1:
With Jboss 4.2.x, in an EAR, if a .jar file on the classpath contained entities and a persistence.xml, Jboss would not automatically find it. Instead, it had to be added to the meta-inf/application.xml. For example:
<application> ... <!--the jar containing the persistence unit --> <module> <java>lib/myLib.jar</java> </module> ... </application>
In Jboss 5, you should not declare the jar file containing persistence.xml (and the entity classes) in application.xml anymore. since it's already (apparently) scanned automatically. If you still declare your persistence unit that way, you'll get the following exception/error:
... Caused by: java.lang.IllegalStateException: Context already exists with path 'lib/myLib.jar' at org.jboss.deployers.plugins.structure.StructureMetaDataImpl.addContext(StructureMetaDataImpl.java:59) ....
The EAR/lib folder is by default added to the classpath of the EAR. So you need not add it as a module in the application.xml. However, i am not sure if it is expected to throw an exception if you add it as a module. I would recommend that you open a new thread in the JBossAS5 forum http://www.jboss.com/index.html?module=bb&op=viewforum&f=287 with the entire exception stacktrace and details and point to this thread.
The EAR/lib folder is by default added to the classpath of the EAR. So you need not add it as a module in the application.xml.
In Jboss 4.2.x this was really required though. Maybe this was a bug, or maybe this was because Jboss 4.2.x was not 100% Java EE compliant?
See here: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078239
The last comment by mzeijen:
I discovered that in AS 4.2 with a JEE5 application.xml file all normal jars in the Lib process are added to the classpath but the file containing the persistence.xml needs to be added to the application.xml as a java module.