ssh环境下客户信息管理系统学习问题(二)

问题1 

 

这是包冲突的问题,jar包中存在两个冲突的包,可以看到上面的Referenced Libraries中存在asm.jarasm-2.2.3.jar两个包,这两个包冲突了,所以应该把asm-2.2.3.jar这个包删掉,重新运行后可以发现就没上面说的那个问题了。

问题2

经检查,发现是数据库配置那里的名称打错了(如下图代码片段),所以我们在写代码的时候一定要注意不要打错关键词或是其它地方应使用相同的名词的时候。

<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">   
    <!-- 配置数据库池 -->
    <bean id="dataSource"
       class="org.apache.commons.dbcp.BasicDataSource">
       <property name="driverClassName"
           value="com.mysql.jdbc.Driver">
       </property>
       <property name="url"
           value="jdbc:mysql://localhost:3306/customer">
       </property>
       <property name="username" value="root"></property> 
       <property name="password" value="123456"></property>
       <property name="maxActive" value="100"></property>
       <property name="maxWait" value="500"></property>
       <property name="defaultAutoCommit" value="true"></property>
       </bean>

从上图可以看到,<value="jdbc:mysql://localhost:3306/customer">这个是链接数据库的,其中包括数据库的端口,最后一个则是数据库名。

由于系统问题,还需要改正连接数据库的Cust.hbm.xml文件的开头

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC     
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"    
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 

 上图中的最后一行原本是

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"

然后我改成了上面的内容,经调试,成功。

问题3:

运行程序后出现异常1Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

翻译是:不推荐在没有服务器的身份验证的情况下建立SSL连接。根据MySQL 5.5.45 +5.6.26 +5.7.6 +的要求,如果不设置显式选项,则必须建立默认的SSL连接,因为不使用SSL的现有应用程序的验证,验证服务器证书属性将被设置为“false”。您需要通过设置useSSL = false来显式禁用SSL,或者设置useSSL = true,并为服务器证书验证提供信任存储。

异常2A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

一个web应用程序注册了JBDC驱动程序[com.mysql . jdbc。但是当web应用程序被停止时,无法将其注销。为了防止内存泄漏,JDBC驱动程序被强制取消注册。

看到网上的说法就是tomcat的版本问题,可以通过换版本来解决问题,但不是根本解决方法,对于我的来说也不一定有用,所以我就没有实践这个方法。而且这个问题之前运行服务起来的时候是没有出现的,估计是我后来改了一些东西所以导致异常错误。

因为我的数据库名及其表名都是customer的,而我Cust类建的对象名是cust,在jsp操作文件,struts.xml,libapplicationContext.xml以及那些包中有些用到的是对象,有些用到的是数据库和表名,对于初学者的我记忆性又不太好的我来说有些地方容易混乱,所以我就把所有的对象名也都改成customer了,这个其实只是一个快速解决问题的方法,并不是根本解决问题的方法。最好的方法应该是理解那些文件中对象与对象,数据库与数据库,表与表等名词的对应关系,即找准它们的位置,知道哪里是指对象,哪里指数据库表名...通过以上方法,可以看到如下结果:

Web Browser中:

数据库中:

选择删除后可以看到出现如下结果:

说明删除操作是完成的了。

原文地址:https://www.cnblogs.com/lytmy7/p/7105985.html