4

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
ethanfar
  • 3,733
  • 24
  • 43
  • Could you post some code? – Lukas Eichler Jun 02 '14 at 11:35
  • There's really nothing in the class, I'm just starting out and have tried Ygor's example from: [integrating-cdi-into-wicket](https://www.42lines.net/2011/11/15/integrating-cdi-into-wicket/). I'm adding to the question the contents of the `init()` method of my application class (which extends `WebApplication`), even though, it's pretty much exactly as in the post. – ethanfar Jun 02 '14 at 11:45
  • Try removing the cdi jars from your classpath. You should use the TomEE cdi OWB depencies. – Lukas Eichler Jun 02 '14 at 11:54
  • I started out without the JAR files, but then I got whole bunch of ClassDefNotFound exceptions. Adding the JARs was the solution to these problems. – ethanfar Jun 02 '14 at 11:56
  • Are you using maven or are you adding the jars by hand? – Lukas Eichler Jun 03 '14 at 10:42
  • I'm using Ant. The EAR file I'm deploying is created by a standard Ant task, and inside it, the WAR file containing the wicket application is created by a standard Ant task. The JAR files are being added using the element. – ethanfar Jun 03 '14 at 11:19
  • I've also added the contents of the application.xml file I use to create the EAR file. – ethanfar Jun 03 '14 at 11:22
  • @eitanfar "Adding the JARs was the solution to these problems" - be careful there. What you did made a specific problem go away; that is in no way a guarantee that it is an actual solution. I would be a little more specific about which jars you are -exactly- deploying with your application. – Gimby Jun 03 '14 at 13:54
  • I added the list of JARs. I removed the seam-conversation-owb jar for now, since the same problem happens without it, and it didn't fix any other problems, so I decided to minimize the noise by removing unnecessary JARs. – ethanfar Jun 03 '14 at 16:27

1 Answers1

1

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);
Martin Strejc
  • 4,307
  • 2
  • 23
  • 38
  • I read the code, so I'm aware of that. However, disabling `ConversationPropagator` is not an option, since this is missing out on major functionality. Regarding adding a bean, this shouldn't be necessary, as there's already such a bean (`AutoConversation` itself), which for some reason TomEE fails to recognize. The 'some reason' part, is what I was looking for. In any case, due to too many difficulties with TomEE, and too few resources of information about it online, I gave up and switched to GlassFish. Thanks for trying though. – ethanfar Jun 11 '14 at 09:55