1 Reply Latest reply on Aug 21, 2009 9:22 AM by stijn slaets

    "EJB cannot be resolved to a type" when using @EJB from a JS

    stijn slaets Newbie

      Using JBOSS 5 and Richfaces.

      I have an EAR file containing
      lib.jar
      ui.war

      lib.war contains an EJB "Service"

      @Stateless
      public class ServiceImpl implements Service {
      ...
      }
      


      ui.war contains a JSF backing bean "Backing"

      public class Backing{
      
       @EJB
       Service myService;
      ....
      


      When I try to access a web page using the Backing bean I get the following stack trace.
      Any idea what is happening here?



      javax.servlet.ServletException: Servlet execution threw an exception
       org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      root cause
      
      java.lang.Error: Unresolved compilation problem:
       EJB cannot be resolved to a type
      
      org.something.Backing.<init>(Backing.java:8)
       sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      
      





        • 1. Re:
          stijn slaets Newbie

          Ignore my post above, I figured out that this probably has nothing to do with the JBOSS container. Some kind of issue in my Maven setup prevents the Backed.java class to be compiled correctly...