You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bertrand Guay-Paquet <be...@step.polymtl.ca> on 2012/12/20 21:54:20 UTC
wicket-cdi and TomEE
Hi,
My web application contains EJB stateless beans which I currently access
in Wicket through JNDI injection with the wicketstuff-javaee-inject project.
With Wicket 6.4.0, I am trying out CDI (@inject) but can't get it to
work on the TomEE Java EE application server. In my Application class, I
put:
BeanManager manager = (BeanManager) new
InitialContext().lookup("java:comp/BeanManager");
This fails with ClassCastException:
org.apache.webbeans.container.InjectableBeanManager cannot be cast to
javax.enterprise.inject.spi.BeanManage
So the BeanManager lookup does work, but there is a problem casting it.
From what I understand, TomEE uses OpenWebBeans to provide CDI while
Wicket is based on Weld. I found this discussion relating to this :
http://wicket-users.markmail.org/thread/ibec5hnkimampyr7 but it only
gave me solutions for using wicket-cdi with Tomcat (servlet container)
and not TomEE (full application server) and its included OWB.
Igor said (in http://wicket-dev.markmail.org/thread/lhwlhqmmyy5zemjg)
that "jboss seam-conversation module has plugins for every cdi
container." Maybe this is the solution, but I'm not versed enough in CDI
to understand it!
Thanks for any hint.
Regards,
Bertrand
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket-cdi and TomEE
Posted by Kurt Sys <ku...@gmail.com>.
Hey,
I got it all working (wicket+tomee)
I had some posts to this list to get it to work:
http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCADLtzBDLyPzbBV-PiOFedaM7unF2Nt1dQVDVY4TtGuAymU0KiQ@mail.gmail.com%3E
I posted most of my configs in here, you don't need weld-stuff:
http://wicket-users.markmail.org/search/?q=kurt.sys#query:kurt.sys+page:1+mid:5bjezmiz7muq5iqj+state:results
... and check out this as well, there are some useful lilnks:
http://wicket-users.markmail.org/search/?q=tomee+cdi#query:tomee%20cdi+page:1+mid:ibec5hnkimampyr7+state:results
Kurt
2012/12/20 Bertrand Guay-Paquet <be...@step.polymtl.ca>:
> Hi,
>
> My web application contains EJB stateless beans which I currently access in
> Wicket through JNDI injection with the wicketstuff-javaee-inject project.
>
> With Wicket 6.4.0, I am trying out CDI (@inject) but can't get it to work on
> the TomEE Java EE application server. In my Application class, I put:
>
> BeanManager manager = (BeanManager) new
> InitialContext().lookup("java:comp/BeanManager");
>
> This fails with ClassCastException:
> org.apache.webbeans.container.InjectableBeanManager cannot be cast to
> javax.enterprise.inject.spi.BeanManage
>
> So the BeanManager lookup does work, but there is a problem casting it.
>
> From what I understand, TomEE uses OpenWebBeans to provide CDI while Wicket
> is based on Weld. I found this discussion relating to this :
> http://wicket-users.markmail.org/thread/ibec5hnkimampyr7 but it only gave
> me solutions for using wicket-cdi with Tomcat (servlet container) and not
> TomEE (full application server) and its included OWB.
>
> Igor said (in http://wicket-dev.markmail.org/thread/lhwlhqmmyy5zemjg) that
> "jboss seam-conversation module has plugins for every cdi container." Maybe
> this is the solution, but I'm not versed enough in CDI to understand it!
>
> Thanks for any hint.
>
> Regards,
> Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket-cdi and TomEE
Posted by Kurt Sys <ku...@gmail.com>.
Hey Bertrand,
I do get
No suitable constructor found for injection target class : [class
org.apache.wicket.cdi.DetachEventEmitter]. produce() method does not
work!
I don't think it matters a lot. I must be something like: it doesn't
find the right constructor for the annotated type (maybe something
with non-empty wicket constructors, but actually, I have not really a
clue, it's just openejb throwing some 'info' at you, no warnings :) ).
However, I don't get any other errors. I don't think you really need
'seam-conversation-owb' to make conversation scope etc working. The
only seam-library I use is (although I didn't test conversation
scope):
seam-conversation-spi-3.0.0.Final.jar
I'm not using maven, so I can't help you out with that part, but if
you can't get it working, I probably still have a mwe at home... I
might put it online this weekend somewhere.
Good luck,
Kurt Sys
2013/1/3 Bertrand Guay-Paquet <be...@step.polymtl.ca>:
> Thanks to you both for you help.
>
> Here's what I did so far:
> -Upgraded from TomEE 1.0.0 to 1.5.1 (not sure if that made a change, but it
> was a todo anyway)
> -Removing the seam-conversation-weld dependency
> -Finally, added the following section to my pom:
> <dependencyManagement>
> <dependencies>
> <dependency>
> <artifactId>cdi-api</artifactId>
> <groupId>javax.enterprise</groupId>
> <scope>provided</scope>
> </dependency>
> </dependencies>
> </dependencyManagement>
> wicket-cdi includes this dependency as "compile" but it is provided by the
> Java EE container.
>
> Igor: perhaps you could modify your blog post to include the info about
> changing the scope of cdi-api?
>
> With these changes, I can get @RequestScoped, @SessionScoped and
> @ApplicationScoped working, although with warnings. I get a ton of log
> messages of the following type:
> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl
> defineConstructor
> INFO: No suitable constructor found for injection target class : [class
> org.apache.wicket.cdi.DetachEventEmitter]. produce() method does not work!
> I can't understand why I get these or what they mean.
>
> As for the conversion scope, from what I understand I should simply have to
> replace the seam-conversation-weld dependency with seam-conversation-owb to
> run with OpenWebBeans (used by TomEE). However, when I do that, all wicket
> pages throw an exception:
> java.lang.NoSuchMethodError:
> org.apache.webbeans.conversation.ConversationManager.getInstance()Lorg/apache/webbeans/conversation/ConversationManager;
> org.jboss.seam.conversation.plugins.openwebbeans.OpenWebBeansSeamConversationManager.doActivate(OpenWebBeansSeamConversationManager.java:41)
> org.jboss.seam.conversation.plugins.openwebbeans.OpenWebBeansHttpSeamConversationContext.doActivate(OpenWebBeansHttpSeamConversationContext.java:44)
> org.jboss.seam.conversation.api.AbstractSeamConversationContext.activate(AbstractSeamConversationContext.java:54)
> org.apache.wicket.cdi.CdiContainer.activateConversationalContext(CdiContainer.java:94)
> org.apache.wicket.cdi.ConversationPropagator.activateConversationIfNeeded(ConversationPropagator.java:147)
> org.apache.wicket.cdi.ConversationPropagator.onRequestHandlerResolved(ConversationPropagator.java:123)
> org.apache.wicket.request.cycle.RequestCycleListenerCollection$5.notify(RequestCycleListenerCollection.java:155)
>
> I don't need conversion scope right now, but all these warnings and errors
> worry me.
>
> Kurt, do you get all these errors?
>
> Regards,
> Bertrand
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket-cdi and TomEE
Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Thanks to you both for you help.
Here's what I did so far:
-Upgraded from TomEE 1.0.0 to 1.5.1 (not sure if that made a change, but
it was a todo anyway)
-Removing the seam-conversation-weld dependency
-Finally, added the following section to my pom:
<dependencyManagement>
<dependencies>
<dependency>
<artifactId>cdi-api</artifactId>
<groupId>javax.enterprise</groupId>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
wicket-cdi includes this dependency as "compile" but it is provided by
the Java EE container.
Igor: perhaps you could modify your blog post to include the info about
changing the scope of cdi-api?
With these changes, I can get @RequestScoped, @SessionScoped and
@ApplicationScoped working, although with warnings. I get a ton of log
messages of the following type:
org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl
defineConstructor
INFO: No suitable constructor found for injection target class : [class
org.apache.wicket.cdi.DetachEventEmitter]. produce() method does not work!
I can't understand why I get these or what they mean.
As for the conversion scope, from what I understand I should simply have
to replace the seam-conversation-weld dependency with
seam-conversation-owb to run with OpenWebBeans (used by TomEE). However,
when I do that, all wicket pages throw an exception:
java.lang.NoSuchMethodError:
org.apache.webbeans.conversation.ConversationManager.getInstance()Lorg/apache/webbeans/conversation/ConversationManager;
org.jboss.seam.conversation.plugins.openwebbeans.OpenWebBeansSeamConversationManager.doActivate(OpenWebBeansSeamConversationManager.java:41)
org.jboss.seam.conversation.plugins.openwebbeans.OpenWebBeansHttpSeamConversationContext.doActivate(OpenWebBeansHttpSeamConversationContext.java:44)
org.jboss.seam.conversation.api.AbstractSeamConversationContext.activate(AbstractSeamConversationContext.java:54)
org.apache.wicket.cdi.CdiContainer.activateConversationalContext(CdiContainer.java:94)
org.apache.wicket.cdi.ConversationPropagator.activateConversationIfNeeded(ConversationPropagator.java:147)
org.apache.wicket.cdi.ConversationPropagator.onRequestHandlerResolved(ConversationPropagator.java:123)
org.apache.wicket.request.cycle.RequestCycleListenerCollection$5.notify(RequestCycleListenerCollection.java:155)
I don't need conversion scope right now, but all these warnings and
errors worry me.
Kurt, do you get all these errors?
Regards,
Bertrand
On 21/12/2012 2:53 AM, Kurt Sys wrote:
> ... forgot this one: my full system setup, used jars etc.
>
> http://openejb.979440.n4.nabble.com/tomee-eclipselink-gt-NoClassDefFoundError-ClassNotFoundException-td4658870.html
>
> Kurt
>
> 2012/12/20 Igor Vaynberg <ig...@gmail.com>:
>> looks like you have two jars on the classpath that provide the
>> javax.enterprise.inject.spi.BeanManager interface. maybe one comes
>> with wicket-cdi and the other one is included in tomee...
>>
>> -igor
>>
>> On Thu, Dec 20, 2012 at 12:54 PM, Bertrand Guay-Paquet
>> <be...@step.polymtl.ca> wrote:
>>> javax.enterprise.inject.spi.BeanManage
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket-cdi and TomEE
Posted by Kurt Sys <ku...@gmail.com>.
... forgot this one: my full system setup, used jars etc.
http://openejb.979440.n4.nabble.com/tomee-eclipselink-gt-NoClassDefFoundError-ClassNotFoundException-td4658870.html
Kurt
2012/12/20 Igor Vaynberg <ig...@gmail.com>:
> looks like you have two jars on the classpath that provide the
> javax.enterprise.inject.spi.BeanManager interface. maybe one comes
> with wicket-cdi and the other one is included in tomee...
>
> -igor
>
> On Thu, Dec 20, 2012 at 12:54 PM, Bertrand Guay-Paquet
> <be...@step.polymtl.ca> wrote:
>> javax.enterprise.inject.spi.BeanManage
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket-cdi and TomEE
Posted by Igor Vaynberg <ig...@gmail.com>.
looks like you have two jars on the classpath that provide the
javax.enterprise.inject.spi.BeanManager interface. maybe one comes
with wicket-cdi and the other one is included in tomee...
-igor
On Thu, Dec 20, 2012 at 12:54 PM, Bertrand Guay-Paquet
<be...@step.polymtl.ca> wrote:
> javax.enterprise.inject.spi.BeanManage
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org