Ant Design ‘cross env’ is not an internal or external command, nor is it an error reporting problem for a runnable program

1. Phenomenon

D:\open_source\worker\ant_design>npm start
> [email protected] start D:\open_source\worker\ant_design
> cross-env APP_TYPE=site umi dev
‘cross-env’ is not an internal or external command, nor is it a runnable program
or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `cross-env APP_TYPE=site umi dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2019-07-10T07_25_09_552Z-debug.log
2. run as administrator, execute the npm install command

How to Solve Error: IncompleteElementException: Could not find result map…

Encountered such an error today, record it:

org.apache.ibatis.builder.IncompleteElementException: Could not find result map com.xxx.manager.mapper.ItemMapper.Item

    at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:346)
    at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:290)
    at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
    at org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:788)
    at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:758)
    at org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:753)
    at org.apache.ibatis.binding.MapperMethod$SqlCommand.resolveMappedStatement(MapperMethod.java:247)
    at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:217)
    at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
    at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
    at com.sun.proxy.$Proxy22.select(Unknown Source)
    at com.xxxx.manager.service.impl.BaseServiceImpl.getList(BaseServiceImpl.java:97)
    at com.xxxx.manager.service.impl.BaseServiceImpl$$FastClassBySpringCGLIB$$dae8e2b1.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.xxxx.manager.service.impl.ItemServiceImpl$$EnhancerBySpringCGLIB$$5180168e.getList(<generated>)
    at com.xxxx.manager.TestMybaitsMapper.testGetList (TestMybaitsMapper.java: 30 )
    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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    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: java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.xxxx.manager.mapper.ItemMapper.Item
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:888)
    at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:640)
    at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:344)
    ... 48 more

The last finding is: write resultType as resultMap

Maven package error: [WARNING] The POM for xxx is missing, no dependency inform

When maven install or package, execute warning and error:

[WARNING] The POM for com.xx-base:jar:1.0 is missing, no dependency information available

[ERROR] Failed to execute goal on project xx-mobi: Could not resolve dependencies for project com.xx-mobi:jar:1.0: Failed to collect dependencies at xx-base:jar:1.0: Failed to read artifact descriptor for xx- base:jar:1.0: Could not find artifact xx-root:pom:1.0 in geotoolrepo…

 

This is because the sub-modules of the maven project did not execute the public modules first when performing installation and packaging related operations. That is, the project has a public module xx-base; the current module that needs to be executed is xx-mobi, then you should install xx-base first, and then perform xx-mobi related operations.

Scenes

As shown in the following figure, a multi-module project created using Maven, a wa-servicemodule, a wa-appmodule, the wa-appmodule depends on the wa-servicemodule, and they are all WebAppDemosub-modules.

Error reporting and analysis

  • Perform packaging for the wa-app module and report [WARNING] The POM for com.mxc:wa-service:jar:1.0-SNAPSHOT is missing, no dependency information available , and the packaging fails.
  • According to the above error message, the preliminary analysis is that the jar package of the dependent wa-service module is not found in the warehouse . So I thought of installing the wa-service module first , and then packaging the wa-app module, but the result is still [WARNING] The POM for com.mxc:wa-service:jar:1.0-SNAPSHOT is missing, no dependency information available , the reason is unknown.

solve

Solution: first execute the install package installation on the parent module WebAppDemo , and then package the wa-app module.
Note: Pack and install the parent module, and all the sub-modules under it will be packaged and installed at the same time. For the above project, after the parent module is packaged and installed, the files of the three modules after packaged and installed can be found in the local warehouse.

Weblogic Start Error: weblogic.management.DeploymentException: weblogic.management.DeploymentException:

After restarting the linux server once, weblogic started inexplicably reporting an error. After checking the log, it was found that a bean class in the deployed project could not be loaded.

1. Then manually delete the deployed project, first

domais/servers/AdminServer/upload

Delete the uploaded project; start an error

<Jul 13, 2016 10:01:47 AM CST> <Error> <Deployer> <BEA-149605> <Failed to create App/Comp mbeans for AppDeploymentMBean mmp. Error - weblogic.management.DeploymentException: .
weblogic.management.DeploymentException: 
    at weblogic.servlet.internal.WarDeploymentFactory.findOrCreateComponentMBeans(WarDeploymentFactory.java:69)
    at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
    at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
    at weblogic.application.internal.MBeanFactoryImpl.initializeMBeans(MBeanFactoryImpl.java:76)
    at weblogic.management.deploy.internal.MBeanConverter.createApplicationMBean(MBeanConverter.java:89)
    Truncated. see log file for complete stacktrace
Caused By: java.util.zip.ZipException: Error opening file - /domains/borzmmp/servers/AdminServer/upload/mmp.war Message - error in opening zip file
    at weblogic.servlet.utils.WarUtils.existsInWar(WarUtils.java:87)
    at weblogic.servlet.utils.WarUtils.isWebServices(WarUtils.java:76)
    at weblogic.servlet.internal.WarDeploymentFactory.findOrCreateComponentMBeans(WarDeploymentFactory.java:61)
    at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
    at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
    Truncated. see log file for complete stacktrace
>

2. Modify the configuration file

/soft/Oracle/Middleware/user_projects/domains/borzmmp/config 

Delete the following code in this file

  <app-deployment>
    <name>yitong-mmc</name>
    <target>AdminServer</target>
    <module-type>war</module-type>
    <source-path>servers/AdminServer/upload/yitong-mmc.war</source-path>
    <security-dd-model>DDOnly</security-dd-model>
  </app-deployment>

3. An error is reported when starting up

<Jul 13, 2016 10:05:22 AM CST> <Emergency> <Security> <BEA-090087> <Server failed to bind to the configured Admin port. The port may already be used by another process.> 
<Jul 13, 2016 10:05:22 AM CST> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[2]". The address 127.0.0.1 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.> 
<Jul 13, 2016 10:05:22 AM CST> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[3]". The address 0:0:0:0:0:0:0:1 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.> 
<Jul 13, 2016 10:05:22 AM CST> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[1]". The address fe80:0:0:0:20c:29ff:fe93:a0f1 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.> 
<Jul 13, 2016 10:05:22 AM CST> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: Server failed to bind to any usable port. See preceeding log message for details.> 
<Jul 13, 2016 10:05:22 AM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED> 
<Jul 13, 2016 10:05:22 AM CST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down> 
<Jul 13, 2016 10:05:22 AM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>

Haha

It turns out that the port is occupied

4. Solve port occupation

[root @ localhost bin] # netstat - apn | grep 7001        
tcp         0       0 ::: 7001                      ::: * LISTEN       22458 / java          

I found it at a glance among thousands of people, let me take a look at what the hell it is

[root@localhost bin]# ps -aux|grep 22458
root     13517  0.0  0.0 103252   840 pts/1    S+   10:10   0:00 grep 22458
root     22458  0.0  8.7 8759556 1425968 ?     Sl   Jun27  19:09 /usr/java/jdk1.8.0_66/bin/java -Djava.util.logging.config.file=/root/.IntelliJIdea2016.1/system/tomcat/Unnamed_mmp-sdk/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:37150,suspend=y,server=n -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1098 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.endorsed.dirs=/soft/apache-tomcat-7.0.67/endorsed -classpath /soft/apache-tomcat-7.0.67/bin/bootstrap.jar:/soft/apache-tomcat-7.0.67/bin/tomcat-juli.jar -Dcatalina.base=/root/.IntelliJIdea2016.1/system/tomcat/Unnamed_mmp-sdk -Dcatalina.home=/soft/apache-tomcat-7.0.67 -Djava.io.tmpdir=/soft/apache-tomcat-7.0.67/temp org.apache.catalina.startup.Bootstrap start

It turns out that Intellij was installed on the server before, and I forgot to turn it off after startup.

Anger

kill -9

Restart everything is ok

UserMapper.selectByPrimaryKey-Inline error solution

The reason for the error, and the solution:

 @Id is added to the id attribute of the entity class, and mybatis doesn’t know which is the primary key anymore.

I wrote a demo

public interface UserMapper extends Mapper<User>

Note that it inherits Mapper, which already has a selectByPrimaryKey method
Then I call

User u = userMapper.selectByPrimaryKey(1);

Gave me an error and cried

The error message is as follows

DEBUG - Fetching JDBC Connection from DataSource

DEBUG - JDBC Connection [jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8, UserName=root@localhost , MySQL Connector Java] will not be managed by Spring

DEBUG - ==>  Preparing: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? ) 

DEBUG - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3b71d667]

DEBUG - Returning JDBC Connection to DataSource

DEBUG - Resolving exception from handler [public java.lang.String com.zqws.app.trade.controller.TestController.test(org.springframework.ui.Model,com.github.pagehelper.PageInfo)]: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.

selectByPrimaryKeyInline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE

(id = ? AND name = ? AND age = ?

 )

### Cause: java.lang.ClassCastException:

java.lang.Integer cannot be cast to java.lang.String

DEBUG - Resolving exception from handler [public java.lang.String com.zqws.app.trade.controller.TestController.test(org.springframework.ui.Model,com.github.pagehelper.PageInfo)]: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.selectByPrimaryKey-Inline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? )

### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

DEBUG - Resolving exception from handler [public java.lang.String com.zqws.app.trade.controller.TestController.test(org.springframework.ui.Model,com.github.pagehelper.PageInfo)]: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.selectByPrimaryKey-Inline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? )

### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

DEBUG - Could not complete request

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.selectByPrimaryKey-Inline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? )

### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)

at com.sun.proxy.$Proxy86.selectOne(Unknown Source)

at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)

at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)

at com.sun.proxy.$Proxy92.selectByPrimaryKey(Unknown Source)

at com.zqws.app.trade.controller.TestController.test(TestController.java:25)

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:483)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java: 1736 )

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.selectByPrimaryKey-Inline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? )

### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66)

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:483)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

... 52 more

Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:26)

at org.apache.ibatis.type.BaseTypeHandler.setParameter (BaseTypeHandler.java: 50 )

at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:81)

at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80)

at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61)

at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:74)

at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59)

at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)

at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)

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:483)

at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)

at com.github.pagehelper.SqlUtil._processPage(SqlUtil.java:351)

at com.github.pagehelper.SqlUtil.processPage(SqlUtil.java:329)

at com.github.pagehelper.PageHelper.intercept(PageHelper.java:150)

at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)

at com.sun.proxy.$Proxy93.query(Unknown Source)

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:483)

at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)

at tk.mybatis.mapper.mapperhelper.MapperOnceInterceptor.intercept(MapperOnceInterceptor.java:81)

at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)

at com.sun.proxy.$Proxy93.query(Unknown Source)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)

... 59 more

DEBUG - Returning cached instance of singleton bean 'sqlSessionFactory'

August 01, 2015 5:02:43 PM org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

### The error may exist in com/zqws/app/trade/mapper/UserMapper.java (best guess)

### The error may involve com.zqws.app.trade.mapper.UserMapper.selectByPrimaryKey-Inline

### The error occurred while setting parameters

### SQL: SELECT id,name,age FROM User WHERE (id = ? AND name = ? AND age = ? )

### Cause: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String] with root cause

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:26)

at org.apache.ibatis.type.BaseTypeHandler.setParameter (BaseTypeHandler.java: 50 )

at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:81)

at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80)

at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61)

at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:74)

at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59)

at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)

at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)

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:483)

at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)

at com.github.pagehelper.SqlUtil._processPage(SqlUtil.java:351)

at com.github.pagehelper.SqlUtil.processPage(SqlUtil.java:329)

at com.github.pagehelper.PageHelper.intercept(PageHelper.java:150)

at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)

at com.sun.proxy.$Proxy93.query(Unknown Source)

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:483)

at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)

at tk.mybatis.mapper.mapperhelper.MapperOnceInterceptor.intercept(MapperOnceInterceptor.java:81)

at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)

at com.sun.proxy.$Proxy93.query(Unknown Source)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66)

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:483)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

at com.sun.proxy.$Proxy86.selectOne(Unknown Source)

at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)

at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)

at com.sun.proxy.$Proxy92.selectByPrimaryKey(Unknown Source)

at com.zqws.app.trade.controller.TestController.test(TestController.java:25)

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:483)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java: 1736 )

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.r

un (NioEndpoint.java: 1695 )

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

How to Solve Hbase Error: Master is initializing

Error log

ERROR: org.apache.hadoop.hbase.PleaseHoldException: Master is initializing 
        at org.apache.hadoop.hbase.master.HMaster.checkInitialized(HMaster.java:2977) 
        at org.apache.hadoop.hbase.master.HMaster.disableTable (HMaster.java:2524) 
        at org.apache.hadoop.hbase.master.MasterRpcServices.disableTable(MasterRpcServices.java:726) 
        at org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod( MasterProtos.java) 
        at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:413) 
        at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:130) 
        at org.apache .hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:324)
        at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:304)

Cause Analysis

Solution:

<!-- Enter zk client --> 
ZK_HOME/zkCli.sh 
<!-- Empty hbase --> 
rmr /hbase 
<!-- Restart hbase --> 
stop-hbase.sh  
start-hbase.sh

verification

<!-- Enter shell command --> 
hbase shell 
<!-- View table --> 
list 

<!-- disable table --> disable'test 
'

[Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”

When using the VUE filter, I encountered an error from the console: vue.esm.js?efeb:628 [Vue warn]: Error in render: "TypeError: Cannot read property 'toFixed' of undefined"

It is found that undefined is an error in the filtermoneyFilters.js

The reason for the error is because the filter is executed twice.

The first time is when no data is passed in the background, the filter function is executed once. And there is no data at this time, and the filter function passed into the filter function is undefined. The error is generated at this time

The second time is to pass data in the background.After rendering the data, the filter function is executed once.

The solution is to make a judgment in the filter to pass in the parameters. If the passed parameter is undefined or other values ​​that are implicitly converted to false, the function will jump out and no longer be executed.

Code

export  function  toMoney ( money ) {

    if (!money) { //A data transfer judgment is performed here. If the passed in is a null value, return its empty string. Solve its problem
        return  '' ;
    }
    return money.toFixed( 2 );
}

Mongoose: How to delete all documents in collection

I just started to check on the Internet how to use momgoose to delete all documents in the collection. But I didn’t find it. I just blogged it down. It’s convenient for myself and others.

It is also possible to use the native statements in mongoDB. But in line with the requirements of the code to be written, it is really unwilling to write this way.

How to use the methods provided by mongoose to delete all documents in the collection in mongoose is listed below.

 

Code:

They are: Model.remove(Delete document condition, callback function).

Example:

    // delete all documents

    // Student is a Model.
    Student.remove((), function ( err ) { // If the filter condition is empty, it means all
        console .log( "success" );
    });

It can also be like this:

    // delete all documents
    // Student is a Model.
    Student.remove( function ( err ) {
        console .log( "success" );
    });

The above two methods are related use cases can be found in the official documentation and StackOverFlow.

But my Mongoose version is 5.9.Officially, the above method is a deprecated method. Do not use it anymore. We recommend using another method instead.

Method after 5.9: Model.deleteMany()

    // Student is a Model.
    Student.deleteMany({}, function ( err ) {
        console .log( "success" );
    });

 

Report Duplicate keys detected: ‘0’. This may cause an update error in VUE and the solution

vue version: 2.x

First, Duplicate keys detected: ‘0’. This may cause an update error is an error caused by Vue finding that the key is not unique.

Translated into Chinese is probably: Duplicate key detected: ‘0’. ‘0’ may cause an update error.

There are also some other solutions found on the Internet. It is solved by manual modification :key, such as concatenating strings. Because in order to solve the problem, the data is manually modified. Personally, it should not be like this.

The last problem I found: On the same layer of DOM node, vue found that the key is not unique. It will report an error. But if you are not using the v-for loop in the same layer of DOM, you will not report an error. So, if it is not in the same layer of DOM The for loop on the above can ensure the uniqueness of the key. (The role of the key has not been touched yet.)

And the solution:

What I think of is to add an extra layer of html tags, but this will create more non-semantic tags, just to ensure the uniqueness of the key and add tags, but I prefer to do this instead of manually splicing strings.

Or manual splicing recommended on the Internet. But: the key is manually modified. If you forget: the key data is different from the original data. It is not so convenient to maintain in the later stage.

Sample Code

    < script  type = "text/javascript"  src = "./vue_localtion/vue.js" > </ script >
</ head >

< body >
    < div  id = "app" >
        < p  v-for = '(item,index) in cyclicData'  :key = 'index' > {{item}} </ p >
        < hr >
        < div > <!--If you remove this layer of div, an error will be reported. Because on the same layer of DOM node: the value of the key is repeated -->
            < p  v-for = '(item,index) in sortCyclicData'  :key = 'index' > {{item}} </ p >
        </ div >
    </ div >

    < script >
        let app = new Vue({
            el : '#app' ,
            data : {
                cyclicData : [ 1 , 8 , 3 , 7 , 5 , 6 ],
            },
            computed : {
                sortCyclicData : function () {
                    return  this .cyclicData.sort( function ( num1, num2 ) {
                        return num1-num2;
                    })
                }
            },
        })
    </ script >

 

Mac opens Terminal and reports an error -bash:: command not found

Problem Description:  

When opening Terminal on Mac system, an error -bash:: command not found was reported.

problem analysis:

The error does not affect the use of Terminal, so it is ignored. But after modifying the .bash_profile file, in order to make the configuration effective, using the source command also reported an error -bash:: command not found.

At first I thought it was because the source command could not be found, and I added /bin to the environment variable, but still reported this error.

The problem is in trouble.

Searching on the Internet, I found that most of the problems are similar to -bash:nginx: command not found, that is to say, there is a command between the two ::, but the specific command cannot be found. But the current error report did not see this command, but a space, which means that the space is also regarded as a command, which means that a space is written in .bash_profile, which is considered as a command to be executed by the system.

Open .bash_profile, and no spaces are seen. Copy the contents of the file to a text editor, and no spaces are seen.

In order to troubleshoot, I plan to comment out all the commands, let go of the commands line by line, and then execute the source command to see which line is reporting the error. Found that the workload is too large.

I accidentally opened .bash_profile with VS Code, and found an exception, as follows:

Remove this special character, source again, and no more errors will be reported.

It can be seen that the system executes this special character as a command, but cannot find this command, and this command is displayed as a space in the terminal, which leads to the above error.

UnknownHostException error when connecting to Mongo cluster Java

Today, a timeout error was reported when connecting to the Mongo cluster in Java, but it was able to connect when the local client was connected to a single node. The specific error reported is as follows:

Caused by: com.mongodb.MongoTimeoutException:
Timed out after 60000 ms while waiting for a server that matches
{serverSelectors=[ReadPreferenceServerSelector{readPreference=primaryPreferred}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]}.
Client view of cluster state is {type=ReplicaSet, servers=[{address=mongo.50:27017, type=Unknown,state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket},
caused by {java.net.UnknownHostException: mongo.50}},
{address=mongo.66:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket},
caused by {java.net.UnknownHostException: mongo.66}},
{address=mongo.67:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused
by {java.net.UnknownHostException: mongo.67}}]

 

I checked the IP address in the configuration file and there is no problem, but why does the error that mongo.50, mongo.66 and mongo.67 can’t resolve the three addresses appear in the error report? How did these three addresses come from? The Mongo cluster consists of 3 machines, and the last IPs are 50, 66, and 67 respectively. I guess it might be a problem with the cluster configuration.

There is a similar question on StackOverflow: (https://stackoverflow.com/questions/27607773/com-mongodb-mongotimeoutexception-when-using-mongoclient-with-list-serveraddress)

In fact, because of Mongo’s replica set method, the client decides which Mongo server to connect to. Each Mongo service listens to each other. If the main service is found to be down, it will elect a new master. The client will be notified when the new master is confirmed. The domain name is used when creating the replica set, so the primary address obtained by the client is also the domain name.
Therefore, the address configured in the mongo.50 cluster configured by the Java client cannot be resolved.
Then you only need to do one more step below to configure the hosts file of the machine. Corresponding to the corresponding IP and mongo.50 address can be resolved.

Or remove?replicaSet=rs0,The following is a summary of the main node, i.e., only the master node is connected, not the replica.

Springboot connects to the database error: testWhileIdle is true, validationQuery not set

Problem Description:

  Use springboot to connect to the database, an error is reported when starting: testWhileIdle is true, validationQuery not set. But it does not affect the use of the system, and all access to the database is normal.

  The application.properties data source configuration is as follows:

  spring.datasource.username=root
  spring.datasource.password=
  spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
  spring.datasource.initial-size=1
  spring.datasource.maximum-pool-size=10
  spring.datasource.connection-timeout=5000

 

Solution:

springboot1.4 cancel spring.datasource.type

  In the new version, the validationQuery is not automatically injected, so you need to manually declare the datasource bean. As for how to write, you can read the above article.

  It is mainly to manually inject DruidDataSource, declare a configuration class, inject all values ​​of the data source into it, and return to DruidDataSource.

  Restart, the system does not report an error!

  Finally, I checked the DruidDataSource source code,

  public static final String DEFAULT_VALIDATION_QUERY = null;

  Sure enough, the DruidDataSource default testWhileIdle=true, and the validationQuery is set to empty.