Deploying Wicket CDI on TomEE with OWB

691 views Asked by At

I’m facing a problem when trying do deploy on TomEE (using OWB). I’m getting the following exception:

javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.apache.wicket.cdi.AutoConversation] is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name : autoConversation, Bean Owner : [null]  
at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60)  
at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:250)
at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:76)
at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:372)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:358)
at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:342)
at org.apache.wicket.cdi.NonContextual.postConstruct(NonContextual.java:129)
at org.apache.wicket.cdi.NonContextualManager.postConstruct(NonContextualManager.java:65)
at org.apache.wicket.cdi.ConversationPropagator.(ConversationPropagator.java:122)
at org.apache.wicket.cdi.CdiConfiguration.configure(CdiConfiguration.java:188)
…

I’ve been looking for information online, but there seems to be nothing on it. I have the seam-conversation-spi and seam-conversation-owb jars on my classpath, so that’s not a dependency issue (had some of those, but got over them).

I understand from other people that deploying an EAR with wicket-cdi on other application servers is very easy and straightforward. However, I really like TomEE (the whole "based on TomCat" concept), and wouldn't want to have to switch.

I'm at a loss here, does anyone have a clue on what's going on ?

Edit 1:

This is the contents of my application class init method:

public void init() {
  super.init();

  BeanManager manager = (BeanManager)new InitialContext().lookup(“java:comp/BeanManager”);

  new CdiConfiguration(manager).configure(this);
}

There's really nothing more in the class.

Edit 2:

Here's the code of my application.xml file used to create the EAR file I deploy:

<application xmlns="http://java.sun.com/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
             version="6">
    <initialize-in-order>true</initialize-in-order>
    <module>
        <ejb>integration.jar</ejb>
    </module>
    <module>
        <ejb>application.jar</ejb>
    </module>
    <module>
        <web>
            <web-uri>presentation.war</web-uri>
            <context-root>app</context-root>
        </web>
    </module>
</application>

Edit 3:

From what I read in the code of wicket-cdi and openwebbeans, I think it has to be one of these scenarios:

  • OWB doesn't find the AutoConversation class (i.e. the wicket-cdi JAR) - I bundle the class inside the WAR in the lib directory using Ant's standard task, so that seems strange
  • OWB doesn't recognize that the wicket-cdi JAR is a beans JAR - That sounds almost impossible, especially since there's a beans.xml and MANIFEST.MF in the JAR under META-INF as request by the cdi spec

Still at a loss, any help would be appreciated.

Edit 4:

Here's the list of JARs I have in the WAR file, in case it helps:

  • seam-conversation-spi-3.0.0.Final.jar
  • velocity-1.7-dep.jar
  • velocity-1.7.jar
  • wicket-auth-roles-6.15.0.jar
  • wicket-bean-validation-6.15.0.jar
  • wicket-bootstrap-0.17.jar
  • wicket-cdi-6.15.0.jar
  • wicket-core-6.15.0.jar
  • wicket-datetime-6.15.0.jar
  • wicket-devutils-6.15.0.jar
  • wicket-extensions-6.15.0.jar
  • wicket-guice-6.15.0.jar
  • wicket-ioc-6.15.0.jar
  • wicket-jmx-6.15.0.jar
  • wicket-request-6.15.0.jar
  • wicket-spring-6.15.0.jar
  • wicket-util-6.15.0.jar
  • wicket-velocity-6.15.0.jar
1

There are 1 answers

1
Martin Strejc On

Wicket expects AutoConversion bean to inject into ConversationPropagator.

See the fragment of the source of org.apache.wicket.cdi.ConversationPropagator:

@Inject
Conversation conversation_;

@Inject
AutoConversation autoConversation;

Solutions:

  1. Add a bean of type org.apache.wicket.cdi.AutoConversation to your bean definitions.

  2. Disable ConversationPropagator

See your modified code, how to disable ConversationPropagator

new CdiConfiguration(manager).setPropagation(ConversationPropagation.NONE).configure(this);