SimpleJdbcCall函数返回null

时间:2019-12-02 14:01:38

标签: spring postgresql spring-jdbc simplejdbccall

我们已经构建了一些程序,该程序调用simplejdbccall进行功能并从postgres数据库中提取数据。通过主程序进行测试时,它工作正常

 public class MainApp {
public static void main(String[] args) {

    JdbcApplicationDao JdbcApplicationDao1 = new JdbcApplicationDao();
    System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^calling getApplicationConnections^^^^^^^^^^^^^^^^^^^");
    Collection<ConnectionDto> applicationConnectionList = JdbcApplicationDao1.getApplicationConnections("OneView");

}

其中的getApplication定义如下:

   public final Collection<ConnectionDto> getApplicationConnections(String applicationName)
{
    LOGGER.info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^You are in  common getApplicationConnections return studentJDBCTemplate1^^^^^^^^^^^^^^^^^^^^^^^^");

    ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
 StudentJDBCTemplate1 studentJDBCTemplate = (StudentJDBCTemplate1)context.getBean("studentJDBCTemplate1");


        LOGGER.info("^^^^^^^^^^^^^^^^^^^^^Fetch Connections from the database for applicationName^^^^^^^^^^^^^^^^^^^: " + applicationName);

   return ( studentJDBCTemplate.getApplicationConnections(applicationName));

}

但是,如果我从第二个模块(即作业管理)调用相同的函数,那么我从函数调用中得到null。看来,spring-jdbc版本存在问题,但我无法弄清

Maven树-常见如下

    [INFO] -----------------< com.ubs.fit.artemis:common-parent >------------------
    [INFO] Building common-parent 4.0.52-SNAPSHOT                             [1/5]
    [INFO] --------------------------------[ pom ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ common-parent ---
    [INFO] com.ubs.fit.artemis:common-parent:pom:4.0.52-SNAPSHOT
    [INFO]
    [INFO] ----------------< com.ubs.fit.artemis:common-database >-----------------
    [INFO] Building common-database 4.0.52-SNAPSHOT                           [2/5]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ common-database ---
    [INFO] com.ubs.fit.artemis:common-database:jar:4.0.52-SNAPSHOT
    [INFO] +- org.springframework:spring-jdbc:jar:5.2.1.RELEASE:compile
    [INFO] |  +- org.springframework:spring-beans:jar:5.2.1.RELEASE:compile
    [INFO] |  +- org.springframework:spring-core:jar:5.2.1.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-jcl:jar:5.2.1.RELEASE:compile
    [INFO] |  \- org.springframework:spring-tx:jar:5.2.1.RELEASE:compile
    [INFO] +- org.springframework:spring-context:jar:5.1.2.RELEASE:compile
    [INFO] |  +- org.springframework:spring-aop:jar:5.1.2.RELEASE:compile
    [INFO] |  \- org.springframework:spring-expression:jar:5.1.2.RELEASE:compile
    [INFO] +- org.postgresql:postgresql:jar:42.2.8:compile
    [INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
    [INFO] |  \- commons-pool:commons-pool:jar:1.5.4:compile
    [INFO] +- oracle-jdbc:ojdbc16:jar:11.2.0.2:compile
    [INFO] +- org.apache.commons:commons-math3:jar:3.6:compile
    [INFO] +- log4j:log4j:jar:1.2.17:compile
    [INFO] +- com.ubs.bps:log4jmm:jar:15.2.0:compile
    [INFO] +- com.google.guava:guava:jar:17.0:compile
    [INFO] +- junit:junit:jar:4.5:test
    [INFO] \- org.mockito:mockito-core:jar:1.9.5:test
    [INFO]    \- org.objenesis:objenesis:jar:1.0:test
    [INFO]
    [INFO] ----------------< com.ubs.fit.artemis:common-resources >----------------
    [INFO] Building common-resources 4.0.52-SNAPSHOT                          [3/5]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ common-resources ---
    [INFO] com.ubs.fit.artemis:common-resources:jar:4.0.52-SNAPSHOT
    [INFO] +- log4j:log4j:jar:1.2.14:compile
    [INFO] \- com.ubs.bps:log4jmm:jar:15.2.0:compile
    [INFO]
    [INFO] ------------------< com.ubs.fit.artemis:common-core >-------------------
    [INFO] Building common-core 4.0.52-SNAPSHOT                               [4/5]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ common-core ---
    [INFO] com.ubs.fit.artemis:common-core:jar:4.0.52-SNAPSHOT
    [INFO] +- junit:junit:jar:4.5:test
    [INFO] +- org.mockito:mockito-core:jar:1.9.5:test
    [INFO] |  \- org.objenesis:objenesis:jar:1.0:test
    [INFO] \- log4j:log4j:jar:1.2.14:compile
    [INFO]
    [INFO] -------------------< com.ubs.fit.artemis:common-web >-------------------
    [INFO] Building common-web 4.0.52-SNAPSHOT                                [5/5]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ common-web ---
    [INFO] com.ubs.fit.artemis:common-web:jar:4.0.52-SNAPSHOT
    [INFO] +- junit:junit:jar:4.5:test
    [INFO] +- org.mockito:mockito-core:jar:1.9.5:test
    [INFO] |  \- org.objenesis:objenesis:jar:1.0:test
    [INFO] +- log4j:log4j:jar:1.2.14:compile
    [INFO] +- javax.servlet:servlet-api:jar:2.5:provided
    [INFO] +- com.ubs.fit.artemis:common-core:jar:4.0.52-SNAPSHOT:compile
    [INFO] +- org.springframework:spring-web:jar:3.2.4.RELEASE:compile
    [INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
    [INFO] |  +- org.springframework:spring-aop:jar:3.2.4.RELEASE:compile
    [INFO] |  +- org.springframework:spring-beans:jar:3.2.4.RELEASE:compile
    [INFO] |  +- org.springframework:spring-context:jar:3.2.4.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-expression:jar:3.2.4.RELEASE:compile
    [INFO] |  \- org.springframework:spring-core:jar:3.2.4.RELEASE:compile
    [INFO] |     \- commons-logging:commons-logging:jar:1.1.1:compile
    [INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.2.2:compile
    [INFO]    +- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.2:compile
    [INFO]    \- com.fasterxml.jackson.core:jackson-core:jar:2.2.2:compile

和工作管理如下:

          [INFO] Building job-management-core 4.0.69-SNAPSHOT                      [5/11]
            [INFO] --------------------------------[ jar ]---------------------------------
            [INFO]
            [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ job-management-core ---
            [INFO] com.ubs.fit.artemis:job-management-core:jar:4.0.69-SNAPSHOT
            [INFO] +- com.ubs.fit.common:fc-config-utils:jar:2.0.12:compile
            [INFO] |  +- com.ubs.fit.common:fc-test-utils:jar:2.0.12:compile
            [INFO] |  |  +- junit:junit:jar:4.5:test
            [INFO] |  |  +- commons-lang:commons-lang:jar:2.4:compile
            [INFO] |  |  +- com.ubs.ibas.loom:loom-oracle:jar:1.3.10:compile
            [INFO] |  |  |  +- com.ubs.ibas.loom:loom-utils:jar:1.3.10:compile
            [INFO] |  |  |  |  +- commons-cli:commons-cli:jar:1.1:compile
            [INFO] |  |  |  |  \- jdom:jdom:jar:1.0:compile
            [INFO] |  |  |  +- com.google.inject:guice:jar:2.0:compile
            [INFO] |  |  |  |  \- aopalliance:aopalliance:jar:1.0:compile
            [INFO] |  |  |  +- org.apache.maven:maven-plugin-api:jar:3.0.3:compile
            [INFO] |  |  |  |  +- org.apache.maven:maven-model:jar:3.0.3:compile
            [INFO] |  |  |  |  +- org.apache.maven:maven-artifact:jar:3.0.3:compile
            [INFO] |  |  |  |  \- org.sonatype.sisu:sisu-inject-plexus:jar:2.1.1:compile
            [INFO] |  |  |  |     +- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
            [INFO] |  |  |  |     +- org.codehaus.plexus:plexus-classworlds:jar:2.4:compile
            [INFO] |  |  |  |     \- org.sonatype.sisu:sisu-inject-bean:jar:2.1.1:compile
            [INFO] |  |  |  |        \- org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4:compile
            [INFO] |  |  |  +- org.apache.maven.shared:maven-verifier:jar:1.2:compile
            [INFO] |  |  |  +- org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
            [INFO] |  |  |  +- org.concordion:concordion:jar:1.4.1:compile
            [INFO] |  |  |  |  +- junit:junit-dep:jar:4.8.2:compile
            [INFO] |  |  |  |  |  \- org.hamcrest:hamcrest-core:jar:1.1:compile
            [INFO] |  |  |  |  +- ognl:ognl:jar:2.6.9:compile
            [INFO] |  |  |  |  \- xom:xom:jar:1.2.5:compile
            [INFO] |  |  |  |     \- xml-apis:xml-apis:jar:1.3.03:compile
            [INFO] |  |  |  +- org.apache.commons:commons-parent:pom:15:compile
            [INFO] |  |  |  +- com.ubs.ibas.loom:loom-test-utils:jar:1.3.10:compile
            [INFO] |  |  |  |  +- com.ubs.ibas.loom:loom-informatica:jar:1.3.10:compile
            [INFO] |  |  |  |  |  \- org.tmatesoft.svnkit:svnkit:jar:1.3.4:compile
            [INFO] |  |  |  |  |     +- net.java.dev.jna:jna:jar:3.2.2:compile
            [INFO] |  |  |  |  |     +- org.tmatesoft.svnkit:trilead-ssh2:jar:build213-svnkit-1.3-patch:compile
            [INFO] |  |  |  |  |     \- org.tmatesoft.sqljet:sqljet:jar:1.0.3:compile
            [INFO] |  |  |  |  |        \- org.antlr:antlr-runtime:jar:3.1.3:compile
            [INFO] |  |  |  |  |           \- org.antlr:stringtemplate:jar:3.2:compile
            [INFO] |  |  |  |  |              \- antlr:antlr:jar:2.7.7:compile
            [INFO] |  |  |  |  \- org.hamcrest:hamcrest-library:jar:1.1:compile
            [INFO] |  |  |  +- oracle-ucp:ucp:jar:11.2.0.0.2:compile
            [INFO] |  |  |  +- com.ubs.fit.common:fc-fatt:jar:1.1.44:compile
            [INFO] |  |  |  |  +- org.easymock:easymock:jar:2.5.2:compile
            [INFO] |  |  |  |  \- org.easymock:easymockclassextension:jar:2.4:compile
            [INFO] |  |  |  |     \- cglib:cglib-nodep:jar:2.1_3:compile
            [INFO] |  |  |  \- org.slf4j:slf4j-api:jar:1.5.8:compile
            [INFO] |  |  +- org.dbunit:dbunit:jar:2.4.8:compile
            [INFO] |  |  \- org.slf4j:slf4j-log4j12:jar:1.5.2:compile
            [INFO] |  \- com.ubs.ibas.loom:loom-credentials:jar:1.3.10:compile
            [INFO] |     +- com.ubs.ibas.loom:loom-ssh:jar:1.3.10:compile
            [INFO] |     |  +- com.jcraft:jsch:jar:0.1.55:compile
            [INFO] |     |  \- commons-io:commons-io:jar:2.0.1:compile
            [INFO] |     +- com.ubs.ibas.loom:loom-cmd-executor:jar:1.3.10:compile
            [INFO] |     +- com.ubs.ibas.loom:loom-os-process:jar:1.3.10:compile
            [INFO] |     |  \- com.ubs.ibas.loom:loom-log4j-plexus-appender:jar:1.3.10:compile
            [INFO] |     |     \- org.apache.maven:maven-project:jar:2.2.0:compile
            [INFO] |     |        +- org.apache.maven:maven-settings:jar:2.2.0:compile
            [INFO] |     |        +- org.apache.maven:maven-profile:jar:2.2.0:compile
            [INFO] |     |        +- org.apache.maven:maven-artifact-manager:jar:2.2.0:compile
            [INFO] |     |        |  +- org.apache.maven:maven-repository-metadata:jar:2.2.0:compile
            [INFO] |     |        |  +- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:compile
            [INFO] |     |        |  \- backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
            [INFO] |     |        +- org.apache.maven:maven-plugin-registry:jar:2.2.0:compile
            [INFO] |     |        +- org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
            [INFO] |     |        \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
            [INFO] |     |           \- classworlds:classworlds:jar:1.1-alpha-2:compile
            [INFO] |     +- oracle-jdbc:ojdbc16:jar:11.2.0.2:compile
            [INFO] |     +- org.apache.poi:poi:jar:3.5-FINAL:compile
            [INFO] |     |  \- commons-logging:commons-logging:jar:1.1:runtime
            [INFO] |     |     +- logkit:logkit:jar:1.0.1:runtime
            [INFO] |     |     +- avalon-framework:avalon-framework:jar:4.1.3:runtime
            [INFO] |     |     \- javax.servlet:servlet-api:jar:2.5:provided
            [INFO] |     \- org.jasypt:jasypt:jar:1.9.0:compile
            [INFO] +- com.ubs.fit.artemis:job-management-utility:jar:4.0.69-SNAPSHOT:compile
            [INFO] +- com.ubs.fit.artemis:job-management-core-api:jar:4.0.69-SNAPSHOT:compile
            [INFO] +- com.ubs.fit.artemis:job-management-core-db:jar:4.0.69-SNAPSHOT:compile
            [INFO] |  +- org.springframework:spring-jdbc:jar:5.2.1.RELEASE:compile
            [INFO] |  |  \- org.springframework:spring-tx:jar:5.2.1.RELEASE:compile
            [INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
            [INFO] |  \- com.ubs.fit.artemis:common-database:jar:4.0.52-SNAPSHOT:compile
            [INFO] |     +- org.postgresql:postgresql:jar:42.2.8:compile
            [INFO] |     +- commons-dbcp:commons-dbcp:jar:1.4:compile
            [INFO] |     |  \- commons-pool:commons-pool:jar:1.5.4:compile
            [INFO] |     \- com.google.guava:guava:jar:17.0:compile
            [INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.1:compile
            [INFO] +- org.springframework:spring-context:jar:5.1.2.RELEASE:compile
            [INFO] |  +- org.springframework:spring-aop:jar:5.1.2.RELEASE:compile
            [INFO] |  +- org.springframework:spring-beans:jar:5.1.2.RELEASE:compile
            [INFO] |  +- org.springframework:spring-core:jar:5.1.2.RELEASE:compile
            [INFO] |  |  \- org.springframework:spring-jcl:jar:5.1.2.RELEASE:compile
            [INFO] |  \- org.springframework:spring-expression:jar:5.1.2.RELEASE:compile
            [INFO] +- org.mockito:mockito-core:jar:1.9.5:test
            [INFO] |  \- org.objenesis:objenesis:jar:1.0:test
            [INFO] +- org.apache.commons:commons-math3:jar:3.6:compile
            [INFO] +- log4j:log4j:jar:1.2.17:compile
            [INFO] \- com.ubs.bps:log4jmm:jar:15.2.0:compile
            [INFO]

1 个答案:

答案 0 :(得分:0)

降低弹簧版本后,问题已解决

相关问题