Whenever you see @In attribute requires non-null value foo this means that the component does not exist in the Seam container at the time of injection. To fix this problem, you need to use @In(create=true) or @In(required=false).
You should be able to inject your EntityManager/SMPC like this every time:
@In private EntityManager entityManager;
<persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/fooEntityManagerFactory"/>
The instance variable name that is injected must match the name attribute of the SMPC config in components.xml, as in the example above.
Make sure your persistence.xml and foo-ds.xml are configured properly as well. Look at the hotel booking example in the Seam distro for example configs (they use HSQLDB for the examples).
For the out of memory problem, you need to increase PermSize, like this:
-Dprogram.name="JBossTools JBoss 4.2 Runtime" -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.endorsed.dirs="C:/jboss-4.2.3.GA/lib/endorsed" -Dnoverify
If you are using Eclipse, this can be set in the Server Launch Configuration.
from DAllen's Seam in Action:
Sun JVM options when running JBoss AS
While you’re on the task of setting up the JBoss AS runtime, I recommend a set of
JVM options to use when running JBoss AS with the Sun JVM. The default memory
allocation settings in Java are extremely conservative. On top of that, Sun’s JVM has
a concept of PermGen space, a separate allocated memory region from the heap.6
Even though the JVM garbage collector frees up memory automatically, there are certain
objects (such as class and method objects) that can evade removal because
they are in this isolated memory region. A flag must be provided that enables garbage
collection for the PermGen space. In addition, the garbage collector has trouble keeping
up when memory is tight. The limited resources quickly become a problem when
running a hefty application like JBoss AS that has high memory demands.
To avoid an untimely death of the JVM, and in turn, JBoss AS, you should supply the
following parameters in the VM options of the JBoss AS runtime configuration in your
IDE (or bin/run.conf in the JBoss AS home directory). I have never experienced an
out-of-memory error when using these settings.7
-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m -Xverify:none
There are ramifications of using the Concurrent Mark Sweep (CMS) garbage collector,
such as a longer startup time, so I wouldn’t blindly apply these settings to production.
However, I have found them to be sufficient for development purposes