0

I'm getting started with some CDI stuff (coming from a Spring background.) I'm following some war examples online and they typically use an older dependency of weld-servlet such as 1.1.10.Final.

When I use this dependency my sample app works just fine [Tomcat 7]. However, when I try to upgrade to 2.2.9.Final, I end up getting startup error:

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserTransaction with qualifiers @Default

This happens only when I upgrade.

Currently in this simple webapp I have a single beans.xml file located under WEB-INF (although I also tried adding an extra one under META-INF as well.)

Any ideas what I might be be doing wrong.

It just seems so odd that it works fine under 1.1 but not 2.2 ?

My beans.xml I've tried defining two ways (not sure which one is better.. I've seen both)

<beans  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
  bean-discovery-mode="annotated"
  >
</beans>

<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_1.xsd">
</beans>
Rick Reumann
  • 383
  • 1
  • 3
  • 10
  • There is no default producer for UserTransaction, do you provide one? You may want to switch from `annotated` to `all` to maintain how it would have worked previously in 1.1 as well. – John Ament Feb 20 '15 at 12:21
  • @JohnAment ok thanks John. I'm going to be using the mybatis cdi jar within my project so that should take care of my transaction management so maybe I shouldn't bother going to 2.2. – Rick Reumann Feb 20 '15 at 15:31

0 Answers0