0

I'm not even sure if this is a version incompatibility, but based on my searches seems to be something like that. Well, I'm upgrading some plugins on my project and it seems to be some version issue because with the old versions, everything works as expected and with the new ones I'm getting those errors. MyBatis

<dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>1.1.1</version>
            </dependency>

Apache CXF where cxf-version is: 3.1.4

<dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>${cxf-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxrs</artifactId>
                <version>${cxf-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-rs-client</artifactId>
                <version>${cxf-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-management</artifactId>
                <version>${cxf-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>${cxf-version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http-jetty</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-bindings-soap</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-rs-extension-providers</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-local</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-local</artifactId>
                <version>${cxf-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-bundle</artifactId>
                <version>3.0.0-milestone1</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-expression</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

And Spring where spring-version is: 4.1.6.RELEASE

<dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jms</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-oxm</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-expression</artifactId>
                <version>${spring-version}</version>
            </dependency>
<dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring-version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring-version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${spring-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring-version}</version>
            </dependency>

This is the configuration I have right now. I'm able to run most of the tests and they are passing. The beans are being populated as expected and everything is fine. But there is one test failing. On this test I have this:

public class JdeQueryServiceCxfTest extends AbstractTestCxf {

    @Autowired
    @Qualifier("jdeQueryServiceClient")
    private QueryService ws;

Into my QueryService I have this:

@WebService(endpointInterface = "myEndpoint.rs.QueryService")
@Service("queryService")
public class JdeQueryServiceImpl implements QueryService {

    @Autowired(required=true)
    @Qualifier("sqlSession")
    SqlSessionTemplate sqlSession;

    @Autowired(required=true)
@Qualifier("jdeObjectMapper")
JdeObjectMapper jdeObjectMapper;

And my test calls this method:

@SuppressWarnings("unchecked")
    @Override
    public List<RateSheet> getObjectGroups(ObjectMarkupTbl markup) throws Exception {

Using this:

@Test
    public void testObjectByGroup() throws Exception {
        List<RateSheet> rateSheets = ws.getObjectGroups(ObjectMarkupTbl.create(effectiveDate, "0222", "", "20151234", ""));
        Assert.assertNotNull(rateSheets);

By adding some log info into getObjectGroups I saw that the ObjectMarkupTbl fields are empty.

Into the console output I could see this:

[main][2015-12-14 13:27:43,768] o.s.b.f.s.DefaultListableBeanFactory     WARN  Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdeObjectMapper' defined in URL [jar:file:/Users/myuser/.m2/repository/com/project/16.02.RC1-SNAPSHOT/specs-16.02.RC1-SNAPSHOT.jar!/com/project/mapper/JdeObjectMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

I know it's a big shot adding this specific question here, but maybe someone already experienced something like this and can give me some advice about which version should I use to make it work.

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Igor
  • 1,397
  • 3
  • 24
  • 56
  • What does their documentation say? – blurfus Dec 14 '15 at 21:36
  • I saw that cxf 3.1.4 works with spring 4.1.6, but couldn't find about myBatis. Also not sure about which of them is causing the issue. – Igor Dec 14 '15 at 21:37
  • sounds like you may need to upgrade mybatis as well. More recent versions seems to support it: (http://blog.lanyonm.org/articles/2014/04/21/spring-4-mybatis-java-config.html) – blurfus Dec 14 '15 at 21:43
  • Ochi, I tried to do what you said, but then I started having another issues with classes the we are using and that doesn't exist anymore... But one thing that I'm not understanding is that we are able to call the webservice... Into the test method, the values into the object are fine, into the webservice method the fields are empty... is that an issue with myBatis? I don't know exactly what it could be there – Igor Dec 14 '15 at 23:02
  • Perhaps you can enable the logging and see from log whether it gets passed mybatis or not? – Ian Lim Dec 15 '15 at 01:23
  • What you mean? We are reaching the service, but the fields into the object are empty, like it wasn't set... – Igor Dec 16 '15 at 00:27

1 Answers1

0

From the logs its clear that, the bean for JdeObjectMapper class is missing required dependencies (sqlSessionFactory or sqlSessionTemplate). Try to inject them, also share your spring's context for further investigation.

Sarvesh Dubey
  • 343
  • 1
  • 14