Tag Archives: index

[Solved] Springboot Error: swagger-UI/index.html Access Error 404

Springboot solves swagger UI/index HTML Access Error 404

Recently, I was working on a project to adopt swagger 3.0. After the project is started, access the swagger path: http://localhost:8880/vdmpess -web/swagger-ui/index. HTML reports 404 because webmvcconfig inherits webmvcconfigurationsupport. After inheriting this class, the relevant contents configured in the configuration file will become invalid and the static resource needs to be re specified
the swagger static resource needs to be re specified.

Swagger address in project

Solution:

Adds the address of the specified static resource

@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.
                addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
                .resourceChain(false);
    }
}

Mysql cannot allocate memory for the buffer pool solution

Further optimize the reference documentation for problem cause resolution

Cause of the problem
Last night, I modified the database and added a “FULLTEXT” index for the field. However, this morning, I found that the database could not be connected and could not be restarted. So I checked the log file:

cat /var/log/mysqld.log

The following error log was found:

130728  6:50:14 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130728  6:50:14 InnoDB: Completed initialization of buffer pool
130728  6:50:14 InnoDB: Fatal error: cannot allocate memory for the buffer pool

The short answer is that there is no way to allocate 128M memory for mysql’s Buffer pool.
reason is obvious, the lack of memory, after looking up data found that the original parameter is mainly used to cache innodb table index, data, the buffer when inserting data. My server only has 1 gb of memory, so this parameter crashed mysql when it started allocating the cache for the index.
The solution
The configurations for mysql are inside /ect/ mysqlt.cnf (the Ubuntu directory is slightly different, where you can find it using whereis my.cnf).

vim /etc/my.cnf

You can see the fourth line:

#innodb_buffer_pool_size = 128M

The default configuration shown here is 128M, which is the annotation status. We just need to remove the annotation and change 128 to a smaller size (depending on your personal situation). I will change it to:

innodb_buffer_pool_size = 50M

That’s about it.
Further optimization
Generally appear this kind of problem students, the memory is certainly not large, so we can set swap partition, which is often said virtual memory.
is illustrated the role of the swap here won’t do, simply means can assist Mem points of memory.
direct code:

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

Finally, add the code /swapfile swap swap defaults 0 0 to the /etc/fstab file.

free

If you can see Mem and SWAP, it’s successful.
and finally restart mysql.
Reference documentation
http://hongjiang.info/aliyun-vps-mysql-aborting/

[Oracle] when inserting data, “ora-00001: unique constraint” appears

background:

background service testing found an error unique constraint on inserting data into the oracle database table, as follows:

### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated
### The error may exist in class path resource [sqlmapper/ACMClaimMapper.xml]
### The error may involve com.las.core.dal.dao.ACMClaimMapper.insert-Inline
### The error occurred while setting parameters
### SQL: insert into TBL_ACM_CLAIM ( SEQ_NO, ACCT_NO, FUND_CHANNEL,STATUS,CREATE_DATE,CSM_NAME,CSM_CARD,LOAN_DATE,LOAN_AMT ) values ( ?,?,?,?,?,?,?,?,?)
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated
; SQL []; ORA-00001: unique constraint (TEST53.SYS_C0032604) violated
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (TEST53.SYS_C0032604) violated

cause:

according to the tip of the index number, found in the table field “SEQ_NO”, found that is because the test database is by another database synchronization, automatic sequence number in the table were disrupted, lead to the next when inserting data, automatically generates SQL serial number in the table has data, so the error led to the only constraints. Of course, data deletion errors and human error operations can cause this problem.

resolved:

first, we can query where the sequence number of this table is located (my table is TBL_ACM_CLAIM) :

select SEQ_ACM_CLAIM.NEXTVAL  from DUAL

do not execute this SQL, because if it is not executed once, the index will increase by +1. If the value of SEQ_NO in the table is greater than the value of the query, the index value will be updated. Set the sequence step size to 100 (usually 1). Execute the following SQL:

alter sequence SEQ_ACM_CLAIM increment by 100

note: SEQ_ACM_CLAIM is not a table name, and the index value cannot modify the current value, but can only be modified to increase, not decrease.

hint:

query all indexes:

select * from user_sequences;

delete index:

drop sequence SEQ_ACM_CLAIM;

Create indexes:

CREATE UNIQUE INDEX SEQ_ACM_CLAIM ON TBL_ACM_CLAIM(SEQ_NO);

summary:

delete library to run road, one second is enough.