Mantis - Resin
Viewing Issue Advanced Details
4406 major always 02-24-11 10:51 04-29-11 14:48
rickHigh  
ferg  
normal  
closed  
fixed  
none    
none 4.0.18  
0004406: Decorator from Weld Sample App does not work in CANDI
FloodingDecorator does not work from WELD pastbin example.
Note that...



 @Local

public interface CodeFragmentManager



FloodingDecorator decorates CodeFragmentManager which is a local interface (EJB @Local) not an actual implementation.

It seems to me that somehow our EJB engine is not recognizing the EJBs in this project as EJBs.

It could be that this sample app is non-standard wrt to EJB, but further investigation is in order.


After disabling the decorator, the app seems to run.

The exact error message is:

[23:54:59.328] {http://*:8080-2} [^] javax.enterprise.inject.InjectionException: DownloadServlet.codeFragmentManager: Exception while creating public org.jboss.weld.examples.pastecode.session.FloodingDecorator()





Here is the code for FloodingDecorator



package org.jboss.weld.examples.pastecode.session;



import java.io.Serializable;



import javax.decorator.Decorator;

import javax.decorator.Delegate;

import javax.inject.Inject;



import org.jboss.weld.examples.pastecode.model.CodeFragment;



/**

 * Prohibit posting more than 2 fragments a minute

 *

 * @author Pete Muir

 *

 */

@Decorator

public abstract class FloodingDecorator implements CodeFragmentManager, Serializable

{



   private static final long serialVersionUID = -4615837206290420112L;



   @Inject @Delegate

   private CodeFragmentManager codeFragmentManager;

   

   @Inject

   private PostTracker postTracker;

   

   public String addCodeFragment(CodeFragment code, boolean privateFragment)

   {

      // Check if we are allowed to post

      if (postTracker.isNewPostAllowed())

      {

         postTracker.addPost();

         return codeFragmentManager.addCodeFragment(code, privateFragment);

      }

      else

      {

         throw new IllegalStateException("You've posted more than 2 fragments in the last 20s. No flooding allowed!");

      }

   }

   

}


Note that...



 @Local

public interface CodeFragmentManager

Notes
(0005084)
rickHigh   
02-25-11 12:15   
I was able to reproduce this 0i70.qa.

decorator ejb: decorate local ejb interface not impl.

I believe the issue is the fact they they are decorating the local interface instead of the impl.

Just a guess.

BTW I created a new category for this as well as I believe the issue is with EJB/CDI support.

  <section start="0i00" name="@Decorator">
    <section start="0i70" name="ejb"/>
  </section>
(0005114)
ferg   
03-03-11 15:51   
The issue is the abstract Decorator - CanDI needs to build an extension class which implements the abstract methods.
(0005223)
ferg   
04-29-11 14:48   
ioc/0i70