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>