Note that there are some explanatory texts on larger screens.

plurals
  1. POThe matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'
    text
    copied!<p>I am trying to configure JSF+Spring+hibernate and I'm tying to run a test but when I use this "tx:annotation-driven" on my application-context.xml file, I get this error: </p> <blockquote> <p>The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven' </p> </blockquote> <p>Here is my application-context.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.6.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.6.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.6.xsd " xmlns:tool="http://www.springframework.org/schema/tool"&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver"/&gt; &lt;property name="url" value="jdbc:oracle:thin:@192.168.56.101:1521:Gpsi"/&gt; &lt;property name="username" value="omar"/&gt; &lt;property name="password" value="omar"/&gt; &lt;/bean&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;property name="annotatedClasses"&gt; &lt;list&gt; &lt;value&gt;om.mycompany.model.Course&lt;/value&gt; &lt;value&gt;om.mycompany.model.Student&lt;/value&gt; &lt;value&gt;om.mycompany.model.Teacher&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory"/&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction.manager="transactionManager"/&gt; &lt;context:annotation-config/&gt; &lt;context:component-scan base.package="com.mmycompany"/&gt; &lt;/beans&gt; </code></pre> <p>and here is my CourseServiceImplTest. I have still not implemented the tests:</p> <pre><code>public class CourseServiceImplTest { private static ClassPathXmlApplicationContext context; private static CourseService courseService; public CourseServiceImplTest() { } @BeforeClass public static void setUpClass() throws Exception { context=new ClassPathXmlApplicationContext("application-context.xml"); courseService=(CourseService) context.getBean("courseService"); } @AfterClass public static void tearDownClass() throws Exception { context.close(); } @Before public void setUp() { } @After public void tearDown() { } /** * Test of getAllCourses method, of class CourseServiceImpl. */ @Test public void testGetAllCourses() { System.out.println("getAllCourses"); CourseServiceImpl instance = new CourseServiceImpl(); List expResult = null; List result = instance.getAllCourses(); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } /** * Test of getCourse method, of class CourseServiceImpl. */ @Test public void testGetCourse() { System.out.println("getCourse"); Integer id = null; CourseServiceImpl instance = new CourseServiceImpl(); Course expResult = null; Course result = instance.getCourse(id); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } </code></pre> <p>and here is the CourseServiceImpl:</p> <pre><code>@Service("courseService") @Transactional public class CourseServiceImpl implements CourseService{ @Autowired private SessionFactory sessionFactory; @Override public List&lt;Course&gt; getAllCourses() { return sessionFactory.getCurrentSession().createQuery("from Course").list(); } @Override public Course getCourse(Integer id) { return (Course) sessionFactory.getCurrentSession().get(Course.class, id); } @Override public void save(Course course) { sessionFactory.getCurrentSession().saveOrUpdate(course); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload