问题
虚拟机
虚拟机与主机Ping不通
虚拟机环境布置成功,但是虚拟机与主机Ping不通,需要在做判断
问题解决:
网段问题:在实体机与虚拟机下需要同一个网段,否则无法ping通,并且网关也需要设置为同一网段下的相关设置。
Oracle数据库学习
Oracle数据库密码忘记
相关内容可以参考一下这篇文章。
https://blog.csdn.net/qq_37171506/article/details/81556780
navicat 登录Oracle数据库 sys登录显示没有sysdba权限
这里我们需要在高级处进行设置,因为我们默认的账户是普通角色,并没有加上sysDBA的角色权限
Oracle通过 表名、列名、字段名、注释 找到所在库 或者所在表
通过表名找到所在库或者所在表
例子:有一张 STUDENT_BASE_INFO 表,但是库太多了,不知道在哪个库。
执行sql:
select * from all_tables where table_name = 'STUDENT_BASE_INFO';
结果如下:
通过列名
例如:知道一个列名age,但是不知道在哪张表里面,执行下面的sql:
select * from all_tab_columns where column_name = 'AGE';
通过注释找到所在表
**
select * from all_tab_comments where comments like '%学生%';
Oracle设置自增id
create sequence s_user_seq
increment by 1
START WITH 1
NOMAXVALUE
NOCYCLE
NOCACHE
create or replace trigger s_user_tr
before insert on SUBSIDIES_INFORMATION
for each row
begin
select s_user_seq.nextval into :new.id from dual;
end s_user_tr;
Oracle复杂条件判断-CASE WHEN
<select id="batchDataQuery" resultMap="batchDataQueryMap">
select
SUBSIDY_INSTITUTION,
SUBSIDY_PROJECT,
BATCH_NO,
COUNT(AMOUNT) as subsidiesTotalNumber,
SUM(AMOUNT) as totalSubsidyAmount,
COUNT(id) as headCount,
COUNT(CASE WHEN s.IS_NORMAL='1' THEN s.ID END) as normalNumber,
SUM(case WHEN s.IS_NORMAL='1' THEN amount else 0 END) as normalAmount,
COUNT(CASE WHEN s.IS_NORMAL='0' THEN s.ID END) as AbnormalNumber,
SUM(case WHEN s.IS_NORMAL='0' THEN AMOUNT else 0 END) as abnormalAmount
FROM
SUBSIDIES_INFORMATION s
<where>
<if test="subsidyInstitution != null and subsidyInstitution != ''">
SUBSIDY_INSTITUTION = #{subsidyInstitution},
</if>
<if test="subsidyProject != null and subsidyProject != ''">
SUBSIDY_PROJECT = #{subsidyProject},
</if>
<if test="batchNo != null and batchNo != ''">
BATCH_NO = #{batchNo},
</if>
</where>
GROUP BY s.SUBSIDY_INSTITUTION,s.SUBSIDY_PROJECT,s.BATCH_NO
</set
Oracle 递归查询
SELECT T.CODE, T.NAME
FROM T_DISTINCT T
START WITH T.DISTINCT_ID = '3604320505'
CONNECT BY T.DISTINCT_ID = PRIOR T.Parent_Id
ORDER BY LEVEL DESC
Oracle批量插入
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into T_EXTERNAL_BATCH(ID,IMPORT_FILE_NAME, IMPORT_TIME, BATCH_NUMBER, AMOUNT, BANK, LEADER_IN_CHARGE, INFORMANT, FILLING_DATE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
select T_EXTERNAL_BATCH_SEQ.nextval,cd.* from
(
<foreach collection="list" item="entity" index="index" close=")" open="(" separator="union">
select
#{entity.importFileName}, #{entity.importTime}, #{entity.batchNumber}, #{entity.amount}, #{entity.bank}, #{entity.leaderInCharge}, #{entity.informant}, #{entity.fillingDate}, #{entity.delFlag}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy}, #{entity.updatedTime}
from dual
</foreach>
) cd
</insert>
Oracle数据迁移
PDManner导出相关PPL
Navicat导出相关数据 SQL语句
DBaver导出相关序列语句
mysql数据库
mybatis-generator 无法链接至数据库
解决方法:
pom引入的mysql-connector-java的版本过低
需要引入新的
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
时间time zone 异常
java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
解决方法:
在连接字符串后面加上?serverTimezone=UTC
Cannot instantiate object of type tk.mybatis.mapper.generator.MapperPlugin
自己的插件错误,后面发现是写入方法出错
Mybatis:逆向工程配合生成报Cannot instantiate object of type tk.mybatis.mapper.generator.
完整的引入代码如下
<?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>TestGenerator</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!--mapper-->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
</configuration>
<dependencies>
<!--MyBatis Generator及工具-->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
generatorConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="MysqlContext" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- 通用mapper所在目录 -->
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.test.my.mapper.MyMapper"/>
</plugin>
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/tecsun?serverTimezone=UTC"
userId="root"
password="123456">
</jdbcConnection>
<!-- 对应生成的pojo所在包 -->
<javaModelGenerator targetPackage="com.imooc.pojo" targetProject="src/main/java"/>
<!-- 对应生成的mapper所在目录 -->
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/>
<!-- 配置mapper对应的java映射 -->
<javaClientGenerator targetPackage="com.imooc.mapper" targetProject="src/main/java" type="XMLMAPPER"/>
<!-- 数据库表 -->
<table tableName="usr"></table>
</context>
</generatorConfiguration>
Swagger2具体问题
在Swagger2的文档中,requestparam与requestbody无法一起使用,需要今晚进行接口查看。
swagger2中并不支持@RequestPrams 和@RequestBody一起使用,然后测试接口。
它会只发送一次json数据,但是我们平时使用的话,如果在url上拼接上requestparam是可以使用的。这是swagger2的局促。
保存评论列表的接口
以及修改用户信息接口
Vue
Post请求和get请求写法
axios({
method: 'POST',
async: false, //false表示同步,true表示异步,默认为异步
url: 'http://localhost:8088/insertUsr',
data: {
"age":"123",
"description":"123",
"name":"123"
}
})
Maven
连接公司私库不成功
改正措施-将公司仓库id剔除mirrorOf
<mirror>
<id>huaweicloud</id>
<mirrorOf>*,!(此处为公司仓库id),!nexus</mirrorOf>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
多个jar包导入本地
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<!-- <extdirs>${basedir}/WebRoot/WEB-INF/lib</extdirs> -->
<extdirs>${basedir}/src/main/webapp/WEB-INF/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
Elasticsearch-访问8080端口,却无法正常启动
安装了elasticSearch之后,经过一段时间之后,tomcat的服务就无法正常启动,进入到log日志中查看,发现说是地址被占用,然后心想杀死占用这个端口的进程就可以了。
01-Jun-2022 16:45:17.926 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8088]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:983)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1059)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:230)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:213)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1137)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:574)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:980)
... 13 more
lsof -i tcp:xxxx(进程号),重启tomcat还是不行。现在开始寻坑之旅
通过百度还有google查询
ps -ef|grep java
root 2659 28686 0 17:18 pts/0 00:00:00 grep --color=auto java
root *********** 明显不是tomcat ******
ps -ef|grep tomcat
root 2821 28686 0 17:18 pts/0 00:00:00 grep --color=auto tomcat
正常启动
ps -ef|grep java
root 2355 1 31 17:18 pts/0 00:00:03 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/bin/java -Djava.util.logging.config.file=/root/apache-tomcat-8.5.65/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /root/apache-tomcat-8.5.65/bin/bootstrap.jar:/root/apache-tomcat-8.5.65/bin/tomcat-juli.jar -Dcatalina.base=/root/apache-tomcat-8.5.65 -Dcatalina.home=/root/apache-tomcat-8.5.65 -Djava.io.tmpdir=/root/apache-tomcat-8.5.65/temp org.apache.catalina.startup.Bootstrap start
root 2659 28686 0 17:18 pts/0 00:00:00 grep --color=auto java
ps -ef|grep tomcat
root 2355 1 19 17:18 pts/0 00:00:03 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/bin/java -Djava.util.logging.config.file=/root/apache-tomcat-8.5.65/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /root/apache-tomcat-8.5.65/bin/bootstrap.jar:/root/apache-tomcat-8.5.65/bin/tomcat-juli.jar -Dcatalina.base=/root/apache-tomcat-8.5.65 -Dcatalina.home=/root/apache-tomcat-8.5.65 -Djava.io.tmpdir=/root/apache-tomcat-8.5.65/temp org.apache.catalina.startup.Bootstrap start
root 2821 28686 0 17:18 pts/0 00:00:00 grep --color=auto tomcat
这就发现异常情况了。
然后尝试关闭tomcat
./shutdown.sh
Using CATALINA_BASE: /root/apache-tomcat-8.5.65
Using CATALINA_HOME: /root/apache-tomcat-8.5.65
Using CATALINA_TMPDIR: /root/apache-tomcat-8.5.65/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64
Using CLASSPATH: /root/apache-tomcat-8.5.65/bin/bootstrap.jar:/root/apache-tomcat-8.5.65/bin/tomcat-juli.jar
Using CATALINA_OPTS: /root/soft/tomcat/apache-tomcat-7.0.57/bin/catalina.sh: line 385: soft/jdk/jdk1.7.0_71/jre/bin/java: 文件或目录不存在
修改环境配置文件
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_191
export CLASSPATH=.:%JAVA_HOME/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_121
export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
重新启动tomcat就可以了
本地从SVN中导入的文件如何在IDEA中加入版本控制
IDEA->File->Version Control->
打开alt+9 查看是否已经加入版本控制
IDEA/@value 没有映射相关数据
yml文件不参与映射文件数据
标签:catalina,记录表,tomcat,java,问题,apache,org,root From: https://www.cnblogs.com/xiaochenNN/p/17071461.html