users@glassfish.java.net

Re: Seam without Hibernate?

From: <glassfish_at_javadesktop.org>
Date: Sun, 13 Jan 2008 22:30:41 PST

Ok, I got a bit further and managed to deploy a Seam application as an EAR file. Here is what I learned:

1) You need to declare all session beans in web.xml, like this:

    <ejb-local-ref>
        <ejb-ref-name>SeamTest/RegisterActionBean/local</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home/>
        <local>
            seamtest.session.RegisterActionLocal
        </local>
        <ejb-link>RegisterActionBean</ejb-link>
    </ejb-local-ref>

This assumes a URL pattern of

<core:init jndi-pattern="java:comp/env/SeamTest/#{ejbName}/local" debug="true"/>

in components.xml

2) You also need to declare

    <ejb-local-ref>
        <ejb-ref-name>
            SeamTest/EjbSynchronizations/local
        </ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local>
            org.jboss.seam.transaction.LocalEjbSynchronizations
        </local>
        <ejb-link>EjbSynchronizations</ejb-link>
    </ejb-local-ref>

in web.xml.

3) To convince NetBeans to actually include that empty seam.properties, put it in "Source Packages" (AKA src/java), not in the project root.

4) The JPQL query in the tutorial doesn't work with Toplink. Try

select u.username from User u where u.username=#{user.username}

(i.e. introduce the variable u)

Every one of these errors (and a couple of silly other ones that aren't worth reporting) caused another sucky Stack Trace from Hell, with not the slightest bit of useful information, and no googling value whatsoever (except to find others who shared my pain). This fellow said it very nicely (http://weblogs.java.net/blog/rogerk/archive/2006/07/seam_fcs_on_gla.html):

[b]I really liked seam and the idea. ejb3 is really seems simplified blah blah ... but again eating the elephant???
[/b]

5) You need at least the following libraries (with the 2.0.1 release):

jboss-seam.jar
hibernate-validator.jar
javassist.jar
dom4j.jar
hibernate.jar
hibernate-annotations.jar (not sure about this one)
hibernate-commons-annotations.jar (not sure about this one)
commons-logging.jar
jboss-el.jar
jboss-seam-ui.jar

You do NOT need hibernate-entitymanager.jar. Alexis--is that what you meant? I am sorry if I misunderstood.

Now I am stuck with issue #2:

Deploying application in domain failed; Error loading deployment descriptors for module [SeamTest] -- Invalid ejb jar [jboss-seam.jar]: it contains zero ejb.
[Message sent by forum member 'cayhorstmann' (cayhorstmann)]

http://forums.java.net/jive/thread.jspa?messageID=253676