Additional steps to integrate with EJBs (3.1, probably similar for
3.0) This is more straightforward, but there are a few minor stumbling
blocks:

7. Enterprise Archive
------------------------------

Create a "JavaEE/Enterprise Application project". Let's call it
"myEar".
Add "myProject" to its module dependencies.

Important: Generate an application.xml deployment descriptor!
In the application.xml, set <context-root>/</context-root>

GWT-Compile myProject once again (I don't really know why this is
necessary, however it didn't work for me without this step. Does
anybody have an explanation?)

In the Servers view, remove the myProject deployment. Then add myEar
instead.

Run the application server and the GWT code server again. The
application should work as before - only difference is, that it's now
bundled in an EAR (Note: Bundling as an EAR shouldn't be absolutely
necessary for Java EE 6, but Eclipse 3.5 still seems to require that
layout.)

8. EJB Project
---------------------

Create an "EJB/EJB Project". Let's call it "myEjb".
Add it to "myEar" as a Java EE module dependency.
Add at least one EJB to the project source code (otherwise, deployment
will be refused (!))

Add "myEjb" as a Java EE module dependency to "myProject" (Properties -
> Java EE Module Dependencies)

Now you can inject your EJBs into GreetingServiceImpl by using the
@EJB annotation. But: It won't work with Deployment Descriptor v2.3
(which was generated by WebAppCreator). So open your web.xml, remove
the DTD declaration, and replace the opening tag with this:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://
java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
        id="WebApp_ID" version="2.5">

Try using an injected EJB from GreetingServiceImpl. GWT-Recompile
"myProject", and run the application server and the GWT code server.

I hope it worked! Ideally there would be an Eclipse wizard for the
entire setup of course ;-)

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to