Category Archives: How to Fix

A convenient method to count the total number of query results in MySQL

MYSQL keywords:
SQL_CALC_FOUND_ROWS
to check the manual and found this keyword is used in the query result of statistical filtering conditions when the total number of (not restricted by Limit)
For example:

SELECT SQL_CALC_FOUND_ROWS tid FROM cdb_threads WHERE fid=14 LIMIT 1,10;

Let’s say there are 1,000 that satisfy our condition, and we return 10.

for immediate use

SELECT found_rows() AS rowcount;

Return rowcount = 1000;
this saved a SELECT count (*) AS the rowcount repeat query, can save considerable time.

From: http://ginew.blog.163.com/

Problems that Vue project manager can’t open

Vue UI must version to 3.0.0 or above to use
if you install version below 3.0.0, so the command line (CMD) under arbitrary path input (uninstall current version) : the vue -v
see version 2.9.6 so sure to uninstall:
enter the command: after first CMD where vue
after entering the specified directory delete all of the vue related files,
with a vue delete all

Then type: CNPM install – g @ vue/cli

then find see the latest version of the

in the specified file open visual tools input vue UI

jump out successfully

ValueError: need more than 0 values to unpack

Split () error, valueError: need more than 0 values to unpack

Check the data, it is found that the number of variables on the left and right sides is inconsistent. Carefully check, it is found that there is an empty behavior in the TXT read at the end, so that there is no value after the split at the end, so it cannot be copied to the two variables on the left.

As shown in the figure, delete the last line of space and rerun it.

Therefore, when this error occurs, make sure that the content on both sides is correct.

[solved] error: valueerror: expected 2D array, got scalar array instead

Error code:

new_x = 84610
pre_y = model.predict(new_x)
print(pre_y)

Error result:

ValueError: Expected 2D array, got scalar array instead:
array=84610.
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

Solution:

Reshape data using array
Reshape data using array
Reshape data using array If the data has a single function or array, resize the shape (-1, 1). If the data contains a single example, resize the shape (1, -1).
Solution:
add

new_x = np.array(new_x).reshape(1, -1)

Modified code:

new_x = 84610
new_x = np.array(new_x).reshape(1, -1)
pre_y = model.predict(new_x)
print(pre_y)

Reproduced in: https://www.cnblogs.com/hankleo/p/11310272.html

ValueError: need at least one array to concatenate

keywords
python
Content of the error
ValueError: need at least one array to concatenate
why
Wrong path
Possible places to start
1. Check the path written in the running py file
2. If you are a PyCharm remote connection, it is recommended to check whether “Automatic synchronization to the server” is enabled (open method: Tools — Deployment — Automatic Upload).

When starting Vue project: cannot find module ‘webpack cli/bin/config yargs’ error [How to Fix]

Cannot find module ‘webpack-cli/bin/config-yargs’ :

Webpack is not compatible with the webpack-dev-server version:

Under this vue project, type :
npm uninstall  webpack -g
npm uninstall -g webpack-dev-server
Uninstall and reinstall:
npm install [email protected] --save-dev
npm install [email protected] --save-dev

Restart the project, success!

Spring AOP uses AspectJ to report an exception that ‘the reference to the bean “mypointcut” cannot be resolved’

"C:\Program Files\Java\jdk1.8.0_191\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:E:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar=62844:E:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\bin" -Dfile.encoding=UTF-8 -classpath "E:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\lib\idea_rt.jar;E:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\junit\lib\junit-rt.jar;E:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\plugins\junit\lib\junit5-rt.jar;E:\myReposi\org\junit\platform\junit-platform-launcher\1.5.0-M1\junit-platform-launcher-1.5.0-M1.jar;E:\myReposi\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;E:\myReposi\org\junit\platform\junit-platform-engine\1.5.0-M1\junit-platform-engine-1.5.0-M1.jar;E:\myReposi\org\opentest4j\opentest4j\1.1.1\opentest4j-1.1.1.jar;E:\myReposi\org\junit\platform\junit-platform-commons\1.5.0-M1\junit-platform-commons-1.5.0-M1.jar;E:\myReposi\org\junit\jupiter\junit-jupiter-engine\5.5.0-M1\junit-jupiter-engine-5.5.0-M1.jar;E:\myReposi\org\junit\jupiter\junit-jupiter-api\5.5.0-M1\junit-jupiter-api-5.5.0-M1.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_191\jre\lib\rt.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\out\production\com.springStudy2;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-aop-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-aspects-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-context-support-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-expression-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-instrument-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-instrument-tomcat-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-jdbc-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-jms-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-messaging-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-orm-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-oxm-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-test-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-tx-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\commons-logging-1.2.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\aopalliance-1.0.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-beans-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-core-4.3.18.RELEASE.jar;D:\java_work\IDEA_work\javaSsmStudy_Spring\com.springStudy2\lib\spring-context-4.3.18.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit5 com.spring_aop2.MainTest,testSpringAop
五月 29, 2019 10:03:36 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@29b5cd00: startup date [Wed May 29 22:03:36 CST 2019]; root of context hierarchy
五月 29, 2019 10:03:36 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [com/spring_aop2/applicationContext.xml]

五月 29, 2019 10:03:38 下午 org.springframework.context.support.ClassPathXmlApplicationContext refresh
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserServiceId' defined in class path resource [com/spring_aop2/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'myPointCut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPointCut': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserServiceId' defined in class path resource [com/spring_aop2/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'myPointCut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPointCut': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:479)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at com.spring_aop2.MainTest.testSpringAop(MainTest.java:20)
	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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:185)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:181)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:128)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'myPointCut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPointCut': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1537)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1284)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:92)
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:102)
	at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:103)
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:248)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1045)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1019)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:473)
	... 61 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myPointCut': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1163)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1107)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
	... 77 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.aop.aspectj.AspectJExpressionPointcut]: No default constructor found; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155)
	... 83 more
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
	at java.lang.Class.getConstructor0(Class.java:3075)
	at java.lang.Class.getDeclaredConstructor(Class.java:2178)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
	... 84 more
Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 89 more


Process finished with exit code -1

Add AspectJWeaver -x.x.x Jar to namespace. Add AspectJWeaver -x.x.x Jar to namespace

shiro Error org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type

Recently I’m working on a small module using Spring MVC + MyBites + Spring Shiro

When making Shiro’s Realm auto-inject, it always gets an error.
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.sam.project.service.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:618)
… 44 more

Entangled for a long time, finally found a solution on the Internet
Shiro’s Realm is a Filte, so when it is loaded in web.xml, it will load Filete before Spring, so @Autowired will never be able to find the bean in the Realm. In fact, after the container is started, the Web.xml configuration load order is
ServletContext – context – param – the listener – filter – servlet
Therefore, simply load the Spring configuration file in advance, i.e., place the Spring configuration file before the Shiro configuration file in web.xml, as shown below:

After the above configuration changes, restart the service!
The rest of the injection configuration remains the same, there is no need to set any @Resource, the previous @Autowired will be used.

Maven project running servlet jump JSP error: HTTP status 500 – unable to compile class for JSP

Runtime environment: JDK1.8 + Tomcat 6.0. x (maven comes with)

1. Error details

exception:
org.apache.jasper. JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type java.io. ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files…


Look at the console error again

2. the cause of the problem:
maven use skeleton to create web projects, the default tomcat is 6.0, tomcat version is too low or jdk version is high.
3. problem solving:
Method 1: Use a high version of tomcat. Method 2: Use a lower version of jdk. I was using jdk1.8, the results reported an error. After replacing jdk1.7, it ran successfully without errors.

Run successfully:

[Fixed]No bean named ‘sqlSessionFactoryBean’ available

SpringBoot integration with mybatis service startup exception log

2019-09-18 19:52:17.270  WARN 8320 — [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory. BeanCreationException: Error creating bean with name ‘testDtoMapper’ defined in file [D:\workspace\xesWorkspace\xes\target\classes\com\xes\www\core\mapper\TestDtoMapper. class]: Cannot resolve reference to bean ‘sqlSessionFactoryBean’ while setting bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory. NoSuchBeanDefinitionException: No bean named ‘sqlSessionFactoryBean’ available

Check the code and the introduction of jar packages no problem, the problem is the database data source and sqlSessionFactory is not integrated into a piece
maven configuration

<!--spring boot Integrating mybatis dependencies-->
<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>2.0.0</version>
</dependency>
<dependency>
   <groupId>org.mybatis</groupId>
   <artifactId>mybatis-spring</artifactId>
   <version>1.3.2</version>
</dependency>
<!-- It is not necessary to refer to the following jar package https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-core -->
<!--<dependency>
   <groupId>org.apache.ibatis</groupId>
   <artifactId>ibatis-core</artifactId>
   <version>3.0</version>
</dependency>-->

Mybatis configuration class

@Configuration
@MapperScan(basePackages = {
        "com.xes.www.core.mapper"
}, sqlSessionFactoryRef = "sqlSessionFactoryBean")
public class MybatisConfiguration {
    // Replaces the traditional datasource binding sqlSessionFactoryBean
    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource dataSource) {
        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
        sqlSessionFactoryBean.setDataSource(dataSource);
        return sqlSessionFactoryBean;
    }
}

So here’s the traditional configuration which is configured through XML

< ! – let Spring manage SQLSessionFactory using MyBatis and Spring integration ->;
<  bean id=”sqlSessionFactory” class=”org.mybatis.spring.SqlSessionFactoryBean”>
< ! — database connection pooling –>;
<  property name=”dataSource” ref=”dataSource” />
< ! — Loading MyBatis global configuration file –>
< property name=”configLocation” value=”classpath:mybatis/SqlMapConfig.xml” />
< /bean>

Error resolution: request execution error. Endpoint = defaultendpoint {serviceurl=‘ http://127.0.0.1 :6668/eureka/}

>
1, confirm the defaultZone wording, yml configuration file named here requires the use of the hump, some people all lowercase, also quote the wrong
2, yml file should not read the configure port 6668, can be the 6668 server and client are replaced by the default of 8761, restart again, no error after the switch back to 6668, restart without error
3, yml file format, strictly abide by the following; If there is any Chinese in the file, make sure the Chinese is UTF-8

Jsoneexception: a jsonobject text must begin with ‘{at character 0


 
JSONException: A JSONObject text must begin with ‘{‘ at character 0
 
You can cache HTTP in HTTPS

 
 
Welcome to pay attention to the public number, receive a variety of free learning videos, learn the relevant Java various technical points interview knowledge, there are relevant learning questions or interview confusion, you can also through the public number private letter bloggers