I've got a working example with Weld.  Check out:

http://svn.carmanconsulting.com/public/wicket-candi/trunk

There's a weld-example subdirectory in there.  Currently, I don't have the
conversation stuff working, but the injections appear to be working.
Unfortunately, the implementation doesn't work with OWB. :(  I'll see what's
causing it and see if we can get them both working.  Good luck.

On Fri, Mar 26, 2010 at 6:35 PM, Ericksen, Mark W (IS) <
mark.erick...@ngc.com> wrote:

> Thanks Josh.
>
> With your idea in mind I dug deeper into what Weld's support for Wicket
> is/was.
> In the Weld download is a jar called weld-wicket.jar that has a
> WeldApplication class for doing what you suggest.  However following the
> instruction for using their integration code only got me an error when
> including their jar in my project.
> java.lang.NoSuchMethodError:
> org.jboss.weld.Container.services()Lorg/jboss/weld/bootstrap/api/Service
> Registry;
>
> So I included the weld-wicket code in my simple project to see what was
> going on.  Their integration solution provides a new RequestCycle class
> called WeldRequestCycle.  In this class they attempt to preserve a long
> running conversation through weld/wicket trickery.  There's a line of
> code in a few places that causes a runtime exception that stops the
> request cycle.
>
> ConversationContext conversationContext =
> Container.instance().services().get(ContextLifecycle.class).getConversat
> ionContext();
>
> These are Weld classes, but stepping through the debugger shows it goes
> go back through the Wicket filter.  Therefore I don't know who is at
> fault here.  Maybe something in Wicket changed that is causing Weld to
> croak or Weld in Glassfish is the culprit.  Either way I really don't
> care about long running conversation support at this point so I removed
> the class and any dependency on it in my modified version of the
> weld-wicket code base.
>
> With that exception out of the way and changing my application to
> subclass from WeldApplication, I have simple injection working with
> Weld.  Yippee!  I'll cross my fingers there are no other side effects.
>
> Problem is now what?  I guess I can post this with the Seam/Weld team
> and hope someone updates the Weld-Wicket integration.  Or I can hope
> someone from the Wicket team will take a look and see if it's something
> in the latest version of Wicket that caused this to break and could do a
> patch.
>
> Anyone? :)
>
> -Mark
>
> -----Original Message-----
> From: Josh Chappelle [mailto:jchappe...@4redi.com]
> Sent: Friday, March 26, 2010 2:59 PM
> To: users@wicket.apache.org
> Subject: RE: Wicket and JEE6
>
> Mark,
>
> Try taking a look at the addComponentInstantiationListener method on the
> Application class. It takes one parameter of type
> IComponentInstantiationListener and that interface has one method which
> is
> onInstantiation(Component component). Every time a component gets
> instantiated it will be handed to this listener so maybe you can write
> your
> own dependency injection code there. I would think that is what the
> WeldApplication is doing under the covers but since it isn't working for
> you
> then you may have more luck just writing it yourself. The other trick is
> to
> making this work is obtaining a reference to your weld context. I use
> Spring
> so I'm not familiar with what it takes with Weld.
>
> I hope this helps.
>
> Thanks,
>
> Josh
>
> -----Original Message-----
> From: Ericksen, Mark W (IS) [mailto:mark.erick...@ngc.com]
> Sent: Friday, March 26, 2010 11:52 AM
> To: users@wicket.apache.org
> Subject: Wicket and JEE6
>
> Hi,
>
>
>
> I'm building a new java project using all JEE6 technologies.  That means
> I'm using JPA, CDI, and JSF2 for example. Each layer came together great
> with fully annotated classes until I got to the JSF2 layer which drove
> me crazy because JSF wants to mess with HTML element ids and names.   In
> looking for alternative view layers I came across Wicket.  The
> technology seems great in terms of its philosophy to keep presentation
> code separate, except I'm not finding much information about its support
> for JEE6 technologies.
>
>
>
> In particular searches for support for CDI (aka WebBeans, aka Weld) only
> got me to an old example in the Seam project.  I cannot find any current
> references to using Weld within a Wicket project where I can use
> annotations such as @Inject, @Named, @ApplicationScoped, etc.
>
>
>
> So my very first question for this list of experts is this:  Is there
> currently any support for Weld in Wicket?  Downloading the Weld project
> from JBoss, I included the weld-wicket.jar into my project and my
> application is subclassed from WeldApplication.  No such luck.  Any
> class injected using @Inject is still null.
>
>
>
> I am using GlassFish v3 which has all the JEE6 goodies included.
> Developing with Eclipse.
>
>
>
> Any help is *greatly* appreciated!
>
>
>
> -Mark
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to