当前位置: 首页 > 知识库问答 >
问题:

请求处理失败;嵌套异常为org.mybatis.spring.MyBatisSystemException:

刘令
2023-03-14

当我尝试连接到Oracle数据库时,出现了以下问题。

有例外

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:oracle.jdbc.driver.OracleDriver@3ff2a34f returned null for URL:jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
### The error may exist in file [D:\file\pro\querytest\target\classes\mapperxml\ReportMapper.xml]
### The error may involve com.qt.mapper.ReportMapper.selectAll
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:oracle.jdbc.driver.OracleDriver@3ff2a34f returned null for URL:jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE] with root cause

java.sql.SQLException: Driver:oracle.jdbc.driver.OracleDriver@3ff2a34f returned null for URL:jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
    at ...
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.


There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.
PersistenceException: 
### Error querying database. Cause: 
org.springframework.jdbc.CannotGetJdbcConnectionException: 
Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:oracle.jdbc.driver.OracleDriver@3ff2a34f returned null for URL:jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 
### The error may exist in file [D:\file\pro\querytest\target\classes\mapperxml\ReportMapper.xml] ### The error may involve com.qt.mapper.ReportMapper.selectAll 
### The error occurred while executing a query 
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:oracle.jdbc.driver.OracleDriver@3ff2a34f returned null for URL:jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
server:
 port: 8081

management:
 endpoints:
  web:
   exposure:
    include: '*'

spring:
 datasource:
  jdbc-url: jdbc:oracle:thin:@xxx.x.xxx.xxx:1521:orcl
  driver-class-name: oracle.jdbc.driver.OracleDriver
  username: xxxx
  password: xxxxx
  hikari:
   minimum-idle: 2
   maximum-pool-size: 5
   connection-test-query: SELECT 1

mybatis:
 configuration:
  map-underscore-to-camel-case: true
 mapper-locations: classpath:mapperxml/*.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>querytest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>2.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>1.5.9.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>

            <!-- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1: -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <verbose>true</verbose>
                    <fork>true</fork>
                    <executable>D:/normal/java/jdk/bin/javac</executable>
                </configuration>
            </plugin>
        </plugins>
        <defaultGoal>compile</defaultGoal>
    </build>


</project>

此reportMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.qt.mapper.ReportMapper">

    <select id="selectAll" resultType="com.qt.bean.Report">
        select * from xxxxx
    </select>

</mapper>

共有1个答案

萧建木
2023-03-14

移除H2依赖项并运行?

<dependency>
     <groupId>com.h2database</groupId>
     <artifactId>h2</artifactId>
     <scope>runtime</scope>
</dependency>
 类似资料:
  • 异常严重:Servlet。路径为[z2]的上下文中servlet[dispatcher]的service()引发异常[请求处理失败;嵌套异常为org.springframework.dao.DataIntegrityViolationException:not null属性引用null或瞬时值:com.spring.entity.Product.cd;嵌套异常为org.hibernate.Prop

  • 我得到的。 这是我的密码: 我得到错误作为 2014年10月16日下午4:31:47 严重:Servlet。路径为[/CustomerPortal]的上下文中servlet[dispatcherServlet]的服务()引发了异常[Request processing failed;嵌套异常为java.lang.NumberFormatException:null],其根本原因为 当我运行这个项目

  • 我现在正在使用JPA eclipselink,我想用Eclipselink连接到我的数据库 我有一些类de表在我的数据库和查询来获取我的条目: 我为我的桌子做了一些课程: FDC_DBCHANGE 已执行FDC_ 和FDC_系统 当我在Tomcat上运行它时,有一个例外: 组织。springframework。网状物util。NestedServletException:请求处理失败;嵌套异常是异

  • 我试图在SpringWeb应用程序中的两个用户之间共享一个使用非对称加密加密的对称密钥。但是我得到了javax的错误。加密。BadPaddingException。 下面是问题的细节。在一种控制器方法中,我使用AES对称密钥进行文件加密,然后用另一个用户公钥加密AES密钥并将其保存到MySQL数据库中。 在控制器的另一种方法中,我从数据库获取加密的secretkey,使用私钥解密secretkey

  • 类项目: hbm文件: 方法如下:

  • 我有jsp和html页面的应用程序 说明服务器遇到一个内部错误,使其无法满足此请求。 例外 NestedServletException:处理程序处理失败;嵌套异常是java.lang.NosuchMethoderror:javax.servlet.http.HttpServletResponse.getHeader(ljava/lang/string;)ljava/lang/string;rig