views:

44

answers:

1

Hi Guyz,

I am using Eclipse 3.6 and jboss 4.2 I've created Enterprise Application with two modules, EJB and WEB.

I have converted the WEB module into GWT application (and added necessary files - html and css)

The problem is, when I need to Inject either the Remote or Local interfaces in the GWTServiceImpl servlet using the @EJB annotation, and when deploy the app on JBoss and start it using default browser (i.e. web mode , or prod mode), I get NullPointerException saying that, the SLSB interface is null. Which means no injection happend.

Please help.

A: 

I encountered the same issue (no injection happened for @EJB fields) with Glassfish v3 some time ago. In my case, it turned out to be the problem, that GWT uses a deployment descriptor of version 2.3 by default. When I changed it to 2.5 (or newer), it worked. JBoss 4.2 supports Servlet 2.5, so you should be able to use something like:

<?xml version="1.0" encoding="UTF-8"?>
<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">

     ...

</web-app>
Chris Lercher
I am carefully changed it, but doesnt' not work too!
Mohammed
@Mohammed: If it worked before you converted the project into a GWT application, then something must have changed with your deployment (ear, war, ejb-jar) - because @EJB works in GWT's RemoteServiceServlets just like in any Servlet (tested with GWT 2.0.3).
Chris Lercher