The browser is compatible with IE11 “ReferenceError: ‘Promise’ is not defined” “ReferenceError: ‘Promise’ is not defined”

ReferenceError: “Promise” is not defined””

IE does not support promise solutions

//import
<script src = "https://cdn.polyfill.io/v2/polyfill.min.js"> </script> 
//or 
<script type="text/javascript" src ="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>

Promise does not support iE

VUE project

(1) cnpm install –save babel-polyfill

(2) Add code require(“babel-polyfill”) in webpack.base.conf.js

(3) Add the code import “babel-polyfill” in main.js;

React project

(1) cnpm install –save babel-polyfill

(2) Add the code import “babel-polyfill” in the entry file (app.js/router.js);

During the development of vue, v-for reported an error [vue/require-v-for-key] Elements in iteration expect to have’v-bind:key’ directives.

I used the VS Code tool, installed the vetur plug-in, and the error was reported as follows

 

 

[eslint-plugin-vue] [vue/require-v-for-key] Elements in iteration expect to have’v-bind:key’ directives.eslint-plugin-vue

In the Vue version, when using v-for in a component, the key is necessary.

Solution: 

 

In File -> Preferences -> Settings -> Enter in the search box: vetur.validation.template-“Find vetur.validation.template: true-“

Reset vetur.validation.template: true to false in the right frame and it is ok.

If there is no code for this game, add a sentence: “vetur.validation.template”: false

Solve the VUE startup problem (You may use special comments to disable some warnings)

Run: “npm run dev” reports an
error: As shown in the figure below, “”You may use special comments to disable some warnings.”
Reason: Eslint’s detection mechanism.

 

 

There are two solutions
Method 1:
is to comment out the 43rd line of code in the build/webpack.base.conf.js file, as shown in the figure below, and then restart npm run dev

 

 

Method 2:
Change the value true of useEslint in line 26 of the config/index.js file to false, as shown in the figure below, and then restart npm run dev

Solve the use of declaration transactions in spring java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable

The declarative transaction configuration used in spring is as follows:

<!– ================================Transaction related control=========== ============= –>
<bean name=”transactionManager”
class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”>
<property name=”dataSource” ref=”dataSource”> </property>
</bean>
<tx:advice id=”txAdvice” transaction-manager=”transactionManager”>
<tx:attributes>
<tx:method name=”delete*” propagation=”REQUIRED” read-only=” false”
rollback-for=”java.lang.Exception” no-rollback-for=”java.lang.RuntimeException” />
<tx:method name=”insert*” propagation=”REQUIRED” read-only=”false”
rollback-for=”java.lang.RuntimeException” />
<tx:method name=”update*” propagation=”REQUIRED” read-only=”false”
rollback-for=”java.lang.Exception” />
<tx:method name=”find*” propagation=”SUPPORTS” />
<tx:method name=”get*” propagation=”SUPPORTS” />
<tx: method name=”select*” propagation=”SUPPORTS” />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id=”pc”
expression=”execution(public * com.framework ..*.*(..))” />
<aop:advisor pointcut-ref=”pc” advice-ref=”txAdvice” />
</aop:config>

The console reports an error when starting the program: java.lang. NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable.
Reason for error: missing jar package, aspectjweaver-1.5.2.jar

Tomcat Error: because there was insufficient free space available after evicting expired cache entries

When Tomcat is running, it warns

The version is Tomcat 8.5.15

The alarm information keywords are as follows

because there was insufficient free space available after evicting expired cache entries

 

 

 

Just increase the maximum cacheable size of the resource in $CATALINA_BASE/conf/context.xml, and the size can be defined according to your needs

Resources
cachingAllowed= “true”
cacheMaxSize= “100000”
/>

 After adding it is as follows

 

 

Restart Tomcat

Adjusted frame length exceeds 4096: 5637-discarded server solution

Solve the server-side Adjusted frame length exceeds 4096: 5637-discarded problem
1. Specific error
2. Error reason
2.1 Length format problem
2.2 Length size problem
3. Solution
1. Specific error
The following shows some error details.

io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 4096: 18247-discarded
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:503)
at io.netty.handler.codec.LengthFieldIfNecessary (LengthFieldBasedFrameDecoder.java:489)
AT io.netty.handler.codec.LengthFieldBasedFrameDecoder.exceededFrameLength (LengthFieldBasedFrameDecoder.java:376)
AT io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode (LengthFieldBasedFrameDecoder.java:419)
AT io.netty. handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:332)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext .java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext. channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel .java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel. nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989 )
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread. java:748)

2. Error reason
2.1 Length format problem
Netty’s own LengthFieldBasedFrameDecodr length coding protocol, the length offset value must be expressed in hexadecimal.

new LengthFieldBasedFrameDecoder(4*1024,0,2);
// Length bit: 000C means 12 length
// eg: 000C321453215435413415206753 (byte[] to hexadecimal representation)

2.2 Length size problem The
adjusted frame length exceeds 4096:18247- Has been discarded. I used the LengthFieldBasedFrameDecodr length protocol decoder when processing data packets on the netty server. Part of the code is as follows:

@Override
public void initChannel(SocketChannel ch) {
//Decoder of length protocol
ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(4*1024,0,2));
ch.pipeline().addLast(new SocketServerHandler() );//Control category
}

And the length agreement sets a maximum acceptable length of 4*1024 = 4096. Therefore, after the server receives more than 4096 bytes, the server discards it as a junk packet.

3. Solution
Change the maximum acceptable length of the decoder of the length protocol of the netty server to be long enough according to the needs.

new LengthFieldBasedFrameDecoder(20*1024,0,2);

JAVA Error: package org.apache.commons.codec.binary does not exist

I added commons-codec-1.4.jar in my project file and added 

 

import org.apache.commons.codec.binary.Base64;

But whenever I build it it will give me an error: The package org.apache.commons.codec.binary does not exist.
Why does it not work?

I also faced the same problem.
Solved this problem by adding commons-codec.jar 

You can download it from http://mvnrepository.com/artifact/commons-codec/commons-codec/1.7

[Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource

The error message is as follows:

2020-04-02 15:25:15.549 WARN 4360 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method ‘dataSource’ threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-04-02 15:25:15.549 INFO 4360 — [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2020-04-02 15:25:15.554 INFO 4360 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

Solution:

Method 1:

Add @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) to the startup class

package com.example.securitycore;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class SecurityCoreApplication {

public static void main(String[] args) {
SpringApplication.run(SecurityCoreApplication.class, args);
}

}

Method 2:

Add configuration in application.properties

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/security_demo?characterEncoding=utf-8
spring.datasource.data-username=root
spring .datasource.data-password=root

SpringBoot startup error Failed to determine a suitable driver class

Add a simple controller to a new SpringBoot project from SpringBoot Initializer , and the startup error is as follows:

  . ____ _ __ _ _
 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
(()\___ |'_ |'_| |'_ \/ _` | \ \ \ \
 \\/ ___)| |_)| | | | | || (_| |))))
  '|____| .__|_| |_|_| |_\__, | / / / /
 ==========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.8.RELEASE)

2019-09-09 10:37:16.750  INFO 11232 --- [           main] com.dongdong.demo.DemoApplication        : Starting DemoApplication on PC-20170304VFOZ with PID 11232 (E:\Spring\Projects\demo\target\classes started by Administrator in E:\Spring\Projects\demo)
2019-09-09 10:37:16.752  INFO 11232 --- [           main] com.dongdong.demo.DemoApplication        : No active profile set, falling back to default profiles: default
2019-09-09 10:37:17.711  INFO 11232 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-09 10:37:17.730  INFO 11232 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 repository interfaces.
2019-09-09 10:37:18.023  INFO 11232 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$3d0e1f1a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-09 10:37:18.327  INFO 11232 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-09-09 10:37:18.359  INFO 11232 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-09-09 10:37:18.360  INFO 11232 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.24]
2019-09-09 10:37:18.476  INFO 11232 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-09-09 10:37:18.476  INFO 11232 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1645 ms
2019-09-09 10:37:18.732  INFO 11232 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-09 10:37:18.842  WARN 11232 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-09-09 10:37:18.843  INFO 11232 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2019-09-09 10:37:18.846  INFO 11232 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-09-09 10:37:18.860  INFO 11232 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-09-09 10:37:18.864 ERROR 11232 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1

 

the reason

The application does not use DataSource, but introduces mybatis-spring-boot-starter in pom.xml

 

Problem solution

There are two types:
remove the dependency of mybatis-spring-boot-starter, so that it will not trigger the spring boot related
code    disable the spring boot automatically initialize the DataSource related code

There are two ways to prohibit:

In the @SpringBootApplication of the startup class, add

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class,DataSourceTransactionManagerAutoConfiguration.class })

 

Configure in application.properties:

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration

 

Get it done!