0

I am working on uplifting Java version and deployment tool for an existing legacy Spring MVC project. While deploying them in Tomcat 8.5, facing the below error.

 org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed


       org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fieldDetailsDaoImpl' defined in class path resource 
         [com/test/dao/dao-beans.xml]: Cannot resolve reference to bean 'searchDetails' while setting bean property 'searchDetails';
         nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchDetails' defined in class path resource 
         [com/test/dao/dao-beans.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
         Could not instantiate bean class [com.aexp.travel.docdelivery.tcapp.dao.DocDeliveryJdbcCall]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: 
         com.test.dao.DocDeliveryJdbcCall.returningResultSet(Ljava/lang/String;Lorg/springframework/jdbc/core/RowMapper;)
         Lorg/springframework/jdbc/core/simple/SimpleJdbcCall;

I searched on the error and found it may be due to version mismatch ,so i did mvn dependency:tree but no where I am able to get the conflicts. Attached is my result:

[INFO] |  \- quartz:quartz:jar:1.6.6:compile
[INFO] |  |  +- org.slf4j:slf4j-jdk14:jar:1.6.1:compile
[INFO] |  |  +- com.americanexpress.dtr.legacy:ehcache-core:jar:2.4.4:compile
[INFO] |  |  \- org.springframework:spring:jar:2.5.6:compile
[INFO] |  \- net.sf.ehcache:ehcache-core:jar:2.4.7:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] +- log4j:log4j:jar:1.2.16:runtime
[INFO] +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- org.apache.tiles:tiles-api:jar:2.2.2:compile
[INFO] +- org.apache.tiles:tiles-core:jar:2.2.2:compile
[INFO] |  \- commons-digester:commons-digester:jar:2.0:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:2.2.2:compile
[INFO] +- org.apache.tiles:tiles-servlet:jar:2.2.2:compile
[INFO] +- org.apache.tiles:tiles-template:jar:2.2.2:compile
[INFO] +- net.sf:json-lib:jar:2.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.3:compile
[INFO] +- net.sf:ezmorph:jar:1.0.3:compile
[INFO] +- org.springframework:spring-test:jar:3.1.0.RELEASE:test
[INFO] +- org.easymock:easymock:jar:3.0:test
[INFO] +- cglib:cglib:jar:2.1:test
[INFO] |  +- asm:asm:jar:1.5.3:test
[INFO] |  +- asm:asm-util:jar:1.3.4:test
[INFO] |  \- aspectwerkz:aspectwerkz-core:jar:0.8.1:test
[INFO] +- org.objenesis:objenesis:jar:1.2:test
[INFO] +- junit:junit:jar:4.8.1:test
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- commons-io:commons-io:jar:2.0.1:compile
[INFO] +- org.springframework:spring-orm:jar:3.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:3.1.0.RELEASE:compile
[INFO] +- org.jboss.resteasy:resteasy-jaxrs:jar:2.1.0.GA:compile
[INFO] |  +- org.slf4j:slf4j-simple:jar:1.5.8:compile
[INFO] |  +- org.scannotation:scannotation:jar:1.0.2:compile
[INFO] |  |  \- javassist:javassist:jar:3.6.0.GA:compile
[INFO] |  +- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] |  +- javax.activation:activation:jar:1.1:compile
[INFO] |  +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.2:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.0:compile
[INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[INFO] |  \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] +- org.jboss.resteasy:jaxrs-api:jar:2.0.1.GA:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.codehaus.jackson:jackson-core-asl:jar:1.5.3:compile
[INFO] \- org.codehaus.jackson:jackson-mapper-asl:jar:1.5.3:compile

The method which is throwing error do exist in my project. Attached is the class.

import javax.sql.DataSource;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;


public class DocDeliveryJdbcCall extends SimpleJdbcCall{

    public DocDeliveryJdbcCall(DataSource dataSource) {
        super(dataSource);
    }

    @SuppressWarnings("rawtypes")
    public DocDeliveryJdbcCall(DataSource dataSource,String storedProcedureName,String clazz) throws ClassNotFoundException {
        //create jdbc call object
        super(dataSource);
        //set stored procedure name
        withProcedureName(storedProcedureName);
        //set return type class with pointer(RESULT) to result set.
        returningResultSet(DocDeliveryCommonConstants.RESULT,  (RowMapper)ParameterizedBeanPropertyRowMapper.newInstance(Class.forName(clazz)));
        compile();
    }

    @SuppressWarnings("rawtypes")
    public DocDeliveryJdbcCall(DataSource dataSource,String storedProcedureName,RowMapper rowMapper) throws ClassNotFoundException {
        //create jdbc call object
        super(dataSource);
        //set stored procedure name
        withProcedureName(storedProcedureName);
        //set return type class with pointer(RESULT) to result set.
        **returningResultSet(DocDeliveryCommonConstants.RESULT, rowMapper);**
        compile();
    }

}

UPDATE

Attached is my dao-beans.xml:

<bean id="Storage" class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName" value="java:/comp/env/jdbc/STORE" /> 
      </bean>

      <bean id="fieldDetailsDaoImpl" class="com.test.daoImpl.FieldDetailsDaoImpl">
            <property name="searchDetails" ref="searchDetails"/>
            <property name="getPassangersDetails" ref="getPassangersDetails"/>
       </bean>

       <bean id="searchDetails" class="com.test.DocDeliveryJdbcCall">
        <constructor-arg index="0" ref="Storage"/>
        <constructor-arg index="1" value="csp_SEARCH_Get"/>
        <constructor-arg index="2" ref="reasearchPnrRM"/>
     </bean>

     <bean name="reasearchPnrRM" class="com.test.rowMapper.ResearchPnrRM"/>

     <bean id="getPassangersDetails" class="com.test.dao.DocDeliveryJdbcCall">
            <constructor-arg index="0" ref="Storage"/>
            <constructor-arg index="1" value="csp_DOC_DETAILS_Get"/>
            <constructor-arg index="2" ref="passangerRM"/>
     </bean>

     <bean name="passangerRM" class="com.test.rowMapper.PassengerRM"/>

Highlighted one is throwing error.

Where might I be going wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
kinnu
  • 396
  • 2
  • 12
  • 22

0 Answers0