Stripes framework and Java EE

Inspired by the Spring with Stripes integration I decided to make one for Java EE: Stripes Injection Enricher.

Stripes Injection Enricher enriches Stripes Framework objects by satisfying injection points specified declaratively using annotations.
There are three injection-based enrichers provided by Stripes Injection Enricher out of the box:

  • @Resource – Java EE resource injections
  • @EJB – EJB session bean reference injections
  • @Inject – CDI injections

The source code is available on GitHub at StripesFramework/stripes-injection-enricher.

Published by

Samuel Santos

Java developer, Open Source hacker, Web technologist, JUG Leader.

  • kabel

    I tried to use the EJB Interceptor according to your article, but without success :( I’ve got an EJB modul with some entities and SessionBeans for these entities. Next I’ve got web application which uses stripes. But always I use annotation in my ActionBean, e.g.:

    private PersonFacade personFacade;

    I’m still getting an exception that it can’t find this EJBBean.
    Does it depend on any application server?

  • Samuel Santos

    The only server I tested with was JBoss AS.

    Sorry to ask, but have you confirmed that your bean is binded with the JNDI name “PersonFacade”?

    I usually rely on the annotation @LocalBinding for the JNDI binding. e.g.
    @LocalBinding(jndiBinding = “PersonFacade”)
    public class PersonFacade { … }

  • Krzysztof

    Hello All,

    It doesn’t work for me either:( I’ve tried EJB Interceptor running on the jboss-4.2.2.GA and even on jboss-5.0.0.Beta4 (the latest one). I’ve got EJB (ear) application with web module and jar module. Same story as kabel described… can’t find this EJBBean.
    I’m sure that my beans are loaded by the Jboss server but I’m not under what names they are available.

    Samuel, could you tell me which exact version of the Jboss AS you were using.
    Did you add any additinal jar’s to the lib?
    In which jboss jar the @LocalBinding annotation is provided? I couldn’t find it.

    Thanks in advance!

    I wish you Happy Easter.


  • Samuel Santos

    org.jboss.annotation.ejb.LocalBinding class can be found in jboss-annotations-ejb3.jar that is in the jboss-4.2.2.GAserverdefaultdeployejb3.deployer folder.

    If you don’t use this annotation, JBoss will define the JNDI bindings for you.
    You can look at your server.log to check the JNDI bindings that were defined.

  • Krzysztof

    Hi Samuel,

    I’ve tried to run it again on jboss-4.2.2.GA with @LocalBinding annotation…. and it worked!

    I’ve realized that it doesn’t work on the latest jboss-5.0.0.Beta4 even with @LocalBinding feature. You have to pass full jndi name: ear-app-name/YourBeanName/local (or remote) into @EJBBean.


  • Samuel Santos

    Hi Krzysztof,

    Thanks for the info.
    JBoss 5.x is yet too buggy.


  • Hugo

    Hi Samuel,

    Thanks for your code, but i’m having a problem.
    The EJBInterceptor that I include in my package and that is deployed inside WEB-INF/classes of a WAR is crushing during deploy in JBoss 4.2.2 with Java 5. I’ve tried to compile with Java 6 and I get the same error. Could you help me?

    2008-06-25 17:55:46,722 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/adssimplex]] Exception starting filter StripesFilter
    java.lang.ClassFormatError: Invalid constant pool index 63 in class file pt/ptinovacao/adssimplex/util/EJBInterceptor
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(
    at org.apache.catalina.loader.WebappClassLoader.findClass(
    at org.jboss.web.tomcat.service.WebAppClassLoader.findClass(
    at org.apache.catalina.loader.WebappClassLoader.loadClass(
    at org.apache.catalina.loader.WebappClassLoader.loadClass(

  • Samuel Santos

    Hi Hugo,

    Can you please send me the complete stack trace by mail?

  • http://none simpatico

    I’ve been hardly trying to use stripejb3 plugin with stripes without success. I use JBoss 4.2.2 GA with JDK 1.6. Following your advices I use JBoss annotations @LocalBinding. Sadly Action Bean properties annotated with @EJBBean don’t work correctly. Stripejb3 plugin cannot invoke setter method because of invalid method arguments.
    The strange thing is, that I can see my binded local interfaces in JNDI view under configured names. I can lookup them in ActionBean by hand and get their proxies but I cannot cast them to the proper business interfaces because of class cast exception.

    Can anyone provide some example pom.xml for the web project to show me, what dependencies to use? Can anyone give some other helpful advice?


    • Samuel Santos

      If you can’t cast them to your business interfaces this has nothing to do neither with Stripes EJB3 Interceptor nor with Stripes framework.
      You should probably check your session bean definition.

      The only dependency you need in your pom in order to use the Stripes EJB3 Interceptor is the following:

  • http://none simpatico

    Thanks for reply Samuel.

    I checked once again my session bean definition and I don’t see anything wrong in there. It goes as folows:
    /* My business interface */
    public interface TestPlanning {


    /* My business interface implementation */
    @LocalBinding(jndiBinding = “testPlanning”)
    public class TestPlanningService implements TestPlanning {


    /* My action bean */
    public class PrepareTestActionBean extends SkillTestGenericActionBean {

    protected TestPlanning testPlanning;

    public PrepareTestActionBean() {

    public void setTestPlanning(TestPlanning testPlanning) {
    this.testPlanning = testPlanning;


    I’ve dig through tons of posts since last week but have not found solution. I’ve also downloaded your sources and checked step by step to find out what’s going on. In line 121 of EJBInterceptor when invoking method setTestPlanning(pl.itkontrakt.skilltest.core.api.TestPlanning) on action bean the looked up TestPlanning proxy appears to be an invalid type argument for this call. It looks like this proxy doesn’t implement pl.itkontrakt.skilltest.core.api.TestPlanning interface though JBoss JNDI view tells that it does.

    Please help me if you can.

    Here is my stacktrace:

    10:13:05,838 ERROR [STDERR] net.sourceforge.stripes.exception.StripesRuntimeException: Exception while trying to lookup and inject an EJB bean into a bean of type PrepareTestActionBean using method public void pl.itkontrakt.skilltest.web.actions.testing.PrepareTestActionBean.setTestPlanning(pl.itkontrakt.skilltest.core.api.TestPlanning)
    10:13:05,839 ERROR [STDERR] at com.samaxes.stripejb3.EJBInterceptor.intercept(
    10:13:05,839 ERROR [STDERR] at net.sourceforge.stripes.controller.ExecutionContext.proceed(
    10:13:05,839 ERROR [STDERR] at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(
    10:13:05,839 ERROR [STDERR] at net.sourceforge.stripes.controller.ExecutionContext.proceed(
    10:13:05,840 ERROR [STDERR] at net.sourceforge.stripes.controller.ExecutionContext.wrap(
    10:13:05,840 ERROR [STDERR] at net.sourceforge.stripes.controller.DispatcherHelper.resolveActionBean(
    10:13:05,840 ERROR [STDERR] at net.sourceforge.stripes.controller.DispatcherServlet.resolveActionBean(
    10:13:05,840 ERROR [STDERR] at net.sourceforge.stripes.controller.DispatcherServlet.service(
    10:13:05,840 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(
    10:13:05,840 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    10:13:05,840 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    10:13:05,840 ERROR [STDERR] at net.sourceforge.stripes.controller.StripesFilter.doFilter(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    10:13:05,841 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(
    10:13:05,841 ERROR [STDERR] at
    10:13:05,841 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
    10:13:05,841 ERROR [STDERR] at
    10:13:05,842 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(
    10:13:05,842 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(
    10:13:05,842 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(
    10:13:05,842 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(
    10:13:05,842 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(
    10:13:05,842 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(
    10:13:05,842 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
    10:13:05,842 ERROR [STDERR] at$
    10:13:05,842 ERROR [STDERR] at
    10:13:05,843 ERROR [STDERR] Caused by: java.lang.IllegalArgumentException: argument type mismatch
    10:13:05,843 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    10:13:05,843 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(
    10:13:05,843 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    10:13:05,843 ERROR [STDERR] at java.lang.reflect.Method.invoke(
    10:13:05,843 ERROR [STDERR] at com.samaxes.stripejb3.EJBInterceptor.intercept(

  • Samuel Santos

    It seems fine to me, except that you are injecting your bean twice.

    Try to remove one of the @EJBBean("testPlanning") annotations.

  • http://none simpatico

    It is still not working.

    Anyway, thanks for your help, Samuel.


    • Samuel Santos

      Can you check the JNDI binding name of your bean in the jmx-console and see if it matches “testPlanning”?
      And what version of JBoss are you using?
      The last time I checked JBoss 5 (I think it was 5.0 beta2) the annotation @LocalBinding did not work.

  • http://none simpatico

    I use JBoss 4.2.2 GA.
    I can see something like that in my JNDI view:

    +-testPlanning (proxy: $Proxy286 implements interface pl.itkontrakt.skilltest.core.api.TestPlanning,interface org.jboss.ejb3.JBossProxy)

    My web project .pom dependencies are:






    • Samuel Santos

      It looks all fine to me.
      Can you try one last test?
      Try it with Stripes 1.5; I’ve never tested the interceptor with Stripes 1.5.1 because we use a lot of AJAX and that version of Stripes has a bug.

  • http://none simpatico


    I’ve built another app from scratch. One EJB, one Stripes bean, one jsp. All with maven.
    It’s 100% not about Stripes or stripejb3. It’s something about JBoss.

    This time I did not use JBoss annotations. My local is bound under stripestest/SomeInterfaceImpl/local.

    I’ve got one handler in Stripes action going like that:

    public Resolution start() {
    ForwardResolution resolution = new ForwardResolution(“/jsp/start.jsp”);

    try {
    javax.naming.InitialContext ctx = new javax.naming.InitialContext();

    Object o = ctx.lookup(“stripestest/SomeInterfaceImpl/local”);
    SomeInterface s = (SomeInterface) o;

    } catch (Exception e) {
    System.out.println(“exception = ” + e.getMessage());

    return resolution;

    This lookup just doesn’t work. Same thing. Proxy cannot be cast to my business interface. If it doesn’t, stripejb3 will not.


    Thanks for your patience.
    Tomorrow I’ll continue my effort.

    Thanks a lot once again.

  • http://none simpatico

    Maybe somebody will find this usefull and save his time.
    The solution is here:

    Stupid me.