eclipse中启动tomcat不产生日志文件

eclipse中启动tomcat不产生日志文件,但是在tomcat文件夹中启动startup.bat就会有,是什么问题

1个回答

Console打开了没?

plok61
闷_ 回复Therad: window-show View - console
接近 4 年之前 回复
u013019338
薛定谔的小猫咪 Console怎么打开,我是小白,请多指导
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Tomcat启动闪退且不报错
首先先给大家看看startup.bat的效果 ![图片说明](https://img-ask.csdn.net/upload/201911/03/1572761838_130755.jpg) </br>可以看到没有任何报错,并且log日志文件夹也是空的。所以不知道该怎么排查...(可以百分百确定jdk和jre都是好的,因为在cmd中java、javac、java -version都能显示正确的信息),还有环境变量那些CATALINA_HOME、CATALINA_BASE,path都是已经配置好了的,但是就是启动闪退。</br> 之前也有看很多的博客,他们启动的时候要么有报错信息但是闪退(显然我这个没这么轻松),有的可以通过log查看到是jre的问题(我没有log信息输出),基本的环境变量问题就不谈了。。。大家有没有解决启动闪退不报错的办法呢?因为以前一直是用eclipse,他里面自带了tomcat插件,最近转IDEA所以要配置了QAQ(以前留下的问题终将要解决的呐.....)
tomcat 启动失败该怎么办?
![图片说明](https://img-ask.csdn.net/upload/201810/24/1540392958_805663.png) JSP软件安装过程中把Tomcat以及JDK更改了原始路径。 导致教师所给的eclipse无法安装成功。 但在Java老师给的eclipse中tomcat启动成功, 并在默认页面打开成功。 此时新建web文件无果, 于是在eclipse中下载了web插件。 遂tomcat页面报出404错误。 发现原始页面笼罩在了404错误之下。 tomcat启动日志如图。
tomcat启动报错。提示server.keystore (系统找不到指定的文件。)
2016-11-20 15:08:03 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\app\Administrator\product\11.2.0\dbhome_2\bin;C:\Program Files\TortoiseSVN\bin;D:\My_Work\Java dpem\jdk1.7.0_13\bin\bin;D:\My_Work\Java dpem\jdk1.7.0_13\bin\jre\bin;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell ;D:\My_Work\Java dpem\jdk1.7.0_13\bin\bin;%CATALINA_HOME%\bin;C:\windows\system32\;F:\搜狐影音\5.0.3.21;. 2016-11-20 15:08:03 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8095 2016-11-20 15:08:03 org.apache.tomcat.util.net.jsse.JSSESocketFactory getStore 严重: Failed to load keystore type JKS with path server.keystore due to E:\Study\aaa\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\server.keystore (系统找不到指定的文件。) java.io.FileNotFoundException: E:\Study\aaa\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\server.keystore (系统找不到指定的文件。) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:347) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:269) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:482) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:419) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:130) at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538) at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176) at org.apache.catalina.connector.Connector.initialize(Connector.java:1014) at org.apache.catalina.core.StandardService.initialize(StandardService.java:680) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795) at org.apache.catalina.startup.Catalina.load(Catalina.java:524) at org.apache.catalina.startup.Catalina.load(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2016-11-20 15:08:03 org.apache.coyote.http11.Http11Protocol init 严重: Error initializing endpoint java.io.FileNotFoundException: E:\Study\aaa\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\server.keystore (系统找不到指定的文件。) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(JSSESocketFactory.java:347) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(JSSESocketFactory.java:269) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:482) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:419) at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:130) at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538) at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176) at org.apache.catalina.connector.Connector.initialize(Connector.java:1014) at org.apache.catalina.core.StandardService.initialize(StandardService.java:680) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795) at org.apache.catalina.startup.Catalina.load(Catalina.java:524) at org.apache.catalina.startup.Catalina.load(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2016-11-20 15:08:03 org.apache.catalina.startup.Catalina load 这是我tomcat日志。后面还有四个错误。都是提示缺少那个文件大家帮帮忙。
tomcat部署项目报错 工程0 errors了。依赖包也安要求加进去了的
# 问题描述: 首先:自己的新建的简单 maven工程能在tomcat成功部署且可以访问主页。 然后:拷贝的被人的工程放到tomcat上部署后启动报错。困扰几天了,求大神帮帮我~ 有一点说明:tomcat的webapps下有项目文件夹 # _启动日志报错段_: ``` 严重: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/tyLCC]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1142) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1876) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1054) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:428) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1586) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:682) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493) Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2583) at java.lang.Class.getDeclaredFields(Class.java:1916) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:110) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:267) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:87) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:328) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4939) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 38 more Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104) ... 51 more 十一月 20, 2019 5:50:24 下午 org.apache.catalina.startup.HostConfig deployDirectory 严重: Error deploying web application directory [F:\Tomcat\apache-tomcat-9.0.6\webapps\tyLCC] java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/tyLCC]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:746) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1142) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1876) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1054) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:428) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1586) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:682) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493) ```
使用tomcat插件启动maven项目,添加虚拟路径无法访问项目
添加server.xml的配置: ![图片说明](https://img-ask.csdn.net/upload/201808/27/1535335192_956258.png) 配置虚拟路径: ![图片说明](https://img-ask.csdn.net/upload/201808/27/1535335262_712704.png) 启动tomcat之后无法访问项目,日志显示下列信息,: [INFO] --- tomcat7-maven-plugin:2.2:run (default) @ xomy_three --- [INFO] Running war on http://localhost:8080/ [INFO] Creating Tomcat server configuration at E:\xomy_study\webservice\workspace\xomy_three\target\tomcat 八月 27, 2018 9:59:24 上午 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\lanqiao\java\jdk1.7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:/lanqiao/java/jdk1.7/bin/../jre/bin/client;D:/lanqiao/java/jdk1.7/bin/../jre/bin;D:/lanqiao/java/jdk1.7/bin/../jre/lib/i386;D:\lanqiao\java\jdk1.7\bin;D:\lanqiao\java\jdk1.7\jre\bin;C:\ProgramData\Oracle\Java\javapath;D:\Xomy\apache-maven-3.5.2\bin;D:\Xomy\apache-cxf-3.0.16\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\lanqiao\mysql\mysql5.5\bin;D:\lanqiao\oracle11g\oral11\product\11.2.0\dbhome_1\BIN;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;;D:\lanqiao\software\eclipse\eclipse_kepler;;. 八月 27, 2018 9:59:25 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 八月 27, 2018 9:59:25 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 八月 27, 2018 9:59:25 上午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 609 ms 八月 27, 2018 9:59:25 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 八月 27, 2018 9:59:25 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.47 八月 27, 2018 9:59:27 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8080"] 八月 27, 2018 9:59:27 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-bio-8009"] 八月 27, 2018 9:59:27 上午 org.apache.catalina.startup.Catalina start 信息: Server startup in 2044 ms 如果不置入server.xml文件,可以正常启动tomcat并可以正常访问项目。
spring security4在tomcat7下起动卡住了,什么情况,求指点!
准备学习下Spring Security 4,整合spring mvc时正常,加入spring security包后也下常,但是把Spring Security配置文件加入到web.xml启动配置后就有问题了。 spring-4.1.6.RELEASE spring-security-4.0.1.RELEASE tomcat-7.0.28 Ideal 14 整个启动过程如以下及1,2楼回复所示,启动到初始化bean之后就不动了。也不报错,不知道这是什么情况造成的 启动日志: ``` D:\programs\container\tomcat-7.0.28-eclipse\bin\catalina.bat run [2015-04-30 10:58:34,456] Artifact security-war:war exploded: Server is not connected. Deploy is not available. Using CATALINA_BASE: "C:\Users\Administrator\.IntelliJIdea14\system\tomcat\Unnamed_study-spsecurity_2" Using CATALINA_HOME: "D:\programs\container\tomcat-7.0.28-eclipse" Using CATALINA_TMPDIR: "D:\programs\container\tomcat-7.0.28-eclipse\temp" Using JRE_HOME: "C:\Program Files\Java\jdk1.7.0_71" Using CLASSPATH: "D:\programs\container\tomcat-7.0.28-eclipse\bin\bootstrap.jar;D:\programs\container\tomcat-7.0.28-eclipse\bin\tomcat-juli.jar" 四月 30, 2015 10:58:35 下午 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.24 using APR version 1.4.6. 四月 30, 2015 10:58:35 下午 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 四月 30, 2015 10:58:36 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized (OpenSSL 1.0.1c 10 May 2012) 四月 30, 2015 10:58:36 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-apr-8080"] 四月 30, 2015 10:58:36 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-apr-8009"] 四月 30, 2015 10:58:36 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1466 ms 四月 30, 2015 10:58:36 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 四月 30, 2015 10:58:36 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.28 四月 30, 2015 10:58:36 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-apr-8080"] 四月 30, 2015 10:58:36 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-apr-8009"] 四月 30, 2015 10:58:36 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 59 ms [2015-04-30 10:58:37,115] Artifact security-war:war exploded: Artifact is being deployed, please wait... Connected to server ```
zookeeper 注册接口速度很慢。每一个接口越5秒,请教
首先是平台为macOS 10.12 ide为eclipse,项目搭载到tomcat7.0 项目为java-web zookeeper使用为 3.4.6 (尝试过最新3.5.2) zoo.cfg配置为 The number of milliseconds of each tick _tickTime=2000_ The number of ticks that the initial synchronization phase can take _initLimit=10_ The number of ticks that can pass between sending a request and getting an acknowledgement _syncLimit=5_ the directory where the snapshot is stored. do not use /tmp for storage, /tmp here is just example sakes. _dataDir=/Users/yukaiji/Documents/tmp/ttehui_ the port at which the clients will connect _clientPort=2181_ the maximum number of client connections. increase this if you need to handle more clients _maxClientCnxns=60_ Be sure to read the maintenance section of the administrator guide before turning on autopurge. http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance The number of snapshots to retain in dataDir _autopurge.snapRetainCount=3_ Purge task interval in hours Set to "0" to disable auto purge feature _autopurge.purgeInterval=1_ hosts 设置为本机 ip 本机名称 zkSever.sh. 启动正常。 日志文件 无错误,jps查看端口正常。 **zkCli.sh. 启动 约 5 秒** 目前认为是重点,配置文件反复看了很多次了。 2181 端口正常 启动java-web项目,在注册dubbo接口(managerService)的时候,一个大约5秒钟。 ![图片说明](https://img-ask.csdn.net/upload/201612/20/1482234464_970971.png) 在win环境下 启动项目整体约30秒,现在启动是两分钟多点。排查了一天半,不清楚因为什么。 日志信息就是在dubbo接口注册的时候非常慢。 这里还有个问题需要请教,每一个接口的注册,都需要重新连接zookeeper吗?因为每一个接口间隔5s 很均匀。 在这里向各位请教。不胜感激。新入门没有币
springboot 配置多库之后,mybatis在控制台不打印sql语句了
springboot项目 单库下,mybatis只需要添加如下配置,就可以打印sql语句 ```xml <!-- 打印查询语句 --> <setting name="logImpl" value="STDOUT_LOGGING" /> ``` 但是多库环境下,mybatis不论怎么设置,都无法打印sql语句..... ---- ---- 项目中的相关配置: mybatis配置: ```xml <!-- 设置运行参数 --> <settings> <!-- 全局映射器启用缓存 --> <setting name="cacheEnabled" value="true" /> <!-- 查询时,关闭关联对象及时加载以提高性能 --> <setting name="lazyLoadingEnabled" value="false" /> <!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指定),不会加载关联表的所有字段,以提高性能 --> <setting name="aggressiveLazyLoading" value="false" /> <!-- 对于位置的SQL查询,允许返回不同的结果集以达到通用的效果 --> <setting name="multipleResultSetsEnabled" value="true" /> <!-- 允许使用列标签代替列明 --> <setting name="useColumnLabel" value="true" /> <!-- 允许使用自定义的主键值(比如由程序生成的UUID 32位编码作为键值), 数据表的pk生成策略将被覆盖 --> <setting name="useGeneratedKeys" value="true" /> <!-- 给予被嵌套的resultMap以字段-属性的映射支持 --> <setting name="autoMappingBehavior" value="PARTIAL" /> <!-- 对于批量更新操作缓存SQL以提高性能 --> <setting name="defaultExecutorType" value="REUSE" /> <!-- 数据库超过25000秒仍未响应则超时 --> <!--<setting name="defaultStatementTimeout" value="25000" />--> <!-- 打印查询语句 --> <setting name="logImpl" value="STDOUT_LOGGING" /> <!-- 开启驼峰--> <setting name="mapUnderscoreToCamelCase" value="true" /> </settings> ``` logback配置: ```xml <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true"> <!-- 属性1:每个logger都关联到logger上下文,默认上下文名称为“default”。 但可以使用设置成其他名字,用于区分不同应用程序的记录。一旦设置,不能修改,可以通过%contextName来打印日志上下文名称。 --> <contextName>logback</contextName> <!--属性2:定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <!-- <springProfile name="dev"> <property name="LOG_PATH" value="D://care-management-statisticserver-logs"/> </springProfile> <springProfile name="test"> <property name="LOG_PATH" value="/data/tomcat_jar/taixin_care/care-management-statisticserver/logs"/> </springProfile> <springProfile name="prod"> <property name="LOG_PATH" value="/data1/logs/care-management-statisticserver"/> </springProfile> --> <property name="LOG_PATH" value="${LOG_FILE}"/> <!--appender用来格式化日志输出节点,有俩个属性name和class,class用来指定哪种输出策略,常用就是控制台输出策略和文件输出策略。--> <!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>info</level> </filter> <encoder> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> </encoder> </appender> <!--<include resource="org/springframework/boot/logging/logback/base.xml"/>--> <!-- 说明: 1、日志级别及文件 日志记录采用分级记录,级别与日志文件名相对应,不同级别的日志信息记录到不同的日志文件中 例如:error级别记录到log_error_xxx.log或log_error.log(该文件为当前记录的日志文件),而log_error_xxx.log为归档日志, 日志文件按日期记录,同一天内,若日志文件大小等于或大于2M,则按0、1、2...顺序分别命名 例如log-level-2013-12-21.0.log 其它级别的日志也是如此。 2、文件路径 若开发、测试用,在Eclipse中运行项目,则到Eclipse的安装路径查找logs文件夹,以相对路径../logs。 若部署到Tomcat下,则在Tomcat下的logs文件中 3、Appender FILEERROR对应error级别,文件名以log-error-xxx.log形式命名 FILEWARN对应warn级别,文件名以log-warn-xxx.log形式命名 FILEINFO对应info级别,文件名以log-info-xxx.log形式命名 FILEDEBUG对应debug级别,文件名以log-debug-xxx.log形式命名 CONSOLE将日志信息输出到控制上,为方便开发测试使用 --> <!-- 日志记录器,日期滚动记录 --> <appender name="FILEERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 正在记录的日志文件的路径及文件名 --> <file>${LOG_PATH}/error_statisticserver.log</file> <!-- 日志记录器的滚动策略,按日期,按大小记录 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> <fileNamePattern>${LOG_PATH}/error-statisticserver-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- 表示只保留最近30天的日志,以防止日志填满整个磁盘空间。--> <maxHistory>30</maxHistory> <!--用来指定日志文件的上限大小,例如设置为1GB的话,那么到了这个值,就会删除旧的日志。--> <totalSizeCap>1GB</totalSizeCap> <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, 命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>100MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <!-- 追加方式记录日志 --> <append>true</append> <!-- 日志文件的格式 --> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> <charset>utf-8</charset> </encoder> <!-- 此日志文件只记录error级别的 --> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> </appender> <!-- 日志记录器,日期滚动记录 --> <appender name="FILEINFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 正在记录的日志文件的路径及文件名 --> <file>${LOG_PATH}/info_statisticserver.log</file> <!-- 日志记录器的滚动策略,按日期,按大小记录 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> <fileNamePattern>${LOG_PATH}/info-statisticserver-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- 表示只保留最近30天的日志,以防止日志填满整个磁盘空间。--> <maxHistory>30</maxHistory> <!--用来指定日志文件的上限大小,例如设置为1GB的话,那么到了这个值,就会删除旧的日志。--> <totalSizeCap>1GB</totalSizeCap> <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>100MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <!-- 追加方式记录日志 --> <append>true</append> <!-- 日志文件的格式 --> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> <charset>utf-8</charset> </encoder> <!-- 此日志文件只记录info级别的 --> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> </appender> <!-- <logger>用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。<logger>仅有一个name属性,一个可选的level和一个可选的addtivity属性。 --> <logger name="org.springframework" level="INFO"/> <logger name="org.apache" level="ERROR"/> <logger name="org.hibernate.validator" level="ERROR"/> <!--<logger name="org.thymeleaf" level="ERROR"/>--> <logger name="org.springframework.context.annotation" level="ERROR"/> <!-- springProfile多环境日志输出,据不同环境(prod:生产环境,test:测试环境,dev:开发环境)来定义不同的日志输出--> <springProfile name="dev" /> <root level="INFO"> <appender-ref ref="FILEERROR"/> <appender-ref ref="FILEINFO"/> <appender-ref ref="STDOUT"/> </root> <!-- 可以启动服务的时候指定 profile (如不指定使用默认),如指定prod 的方式为: java -jar xxx.jar –spring.profiles.active=prod--> </configuration> ``` application.properties部分配置: ```properties #配置文件 logging.level.tk.mybatis=TRACE spring.freemarker.cache=false spring.freemarker.request-context-attribute=request mybatis.type-aliases-package=com.mtpf.domain mybatis.mapper-locations=classpath:mapper/*.xml mapper.mappers=com.mtpf.util.MyMapper mapper.not-empty=false mapper.identity=MYSQL pagehelper.helperDialect=mysql #true 是超出最大页码返回数据 false超出最大页码不返回数据 pagehelper.reasonable=${PAGEHELPER_REASONABLE} pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql ```
JavaTomcat部署远程web启动错误-本地部署远程web启动错误
JavaTomcat启动错误 关键错误日志如下: 28-Jun-2019 07:54:44.034 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 28-Jun-2019 07:54:44.147 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\WebServer\apache-tomcat-8.0.35\webapps\DaysToDie] 28-Jun-2019 07:54:44.173 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/DaysToDie]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@aaca5bc] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@77cfd824] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140) at Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file at Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at 放到远程之后无法启动,本地正常 1.看了报错之后,这边第一时间是去删tomcat-catalina缓存,然后进行开启 2.仔细检查过web.xml没有问题,甚至删除了后面添加的一部分进行测试,也就是之前这个在远程能正常访问的 3.继续看下面的日志,他说无法打开zip文件后面还报了一些jar资源文件错误 jar文件可以确保是没错误的,刚开始这些放到远程正常启动 我是直接把本地tomcat-webapps放到远程上面的tomcat-webapps的,远程的访问加载路径这些都在第一次使用时改过,后面一段时间也正常使用 后面改了一些代码,然后重新部署时出现该错误
Springboot启动报错 一个是找不到url 一个是找不到dao
## 之前一直启动都没有问题,今天突然发现启动不了 ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570671612_490949.jpg) ## 然后我把启动的位置改成@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) ``` package com.mall.shopping.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; /*@SpringBootApplication*/ @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } ``` ## 然后会报新的错: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570671806_766601.jpg) # 到现在没找到新错误的原因 还是在报找不到dao的错误。 ## 实体类代码: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570672651_585106.jpg) ## controller代码: ``` package com.mall.shopping.demo.controller; import com.mall.shopping.demo.services.UserService; import com.mall.shopping.demo.vo.Huser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Iterator; import java.util.List; @Controller public class UserController { @Autowired private UserService userService; @RequestMapping("/tiao") public ModelAndView zhuan() { ModelAndView modelAndView = new ModelAndView("loginindex"); return modelAndView; } @RequestMapping("/tiao1") public ModelAndView zhuan1() { ModelAndView modelAndView = new ModelAndView("adminindex"); return modelAndView; } @RequestMapping("/Userlogin") public String userlogin(HttpServletRequest request, HttpServletResponse response) { String username = (String) request.getParameter("username"); String userpwd = (String)request.getParameter("userpwd"); List<Huser> huser = userService.userlogin(); Iterator iter = huser.iterator(); while(iter.hasNext()){ Huser ha = (Huser) iter.next(); if(username.equals(ha.getHuser())) { if(userpwd.equals(ha.getHpwd())) { return "redirect:/tiao1"; } else { return "redirect:/tiao"; } } } return "redirect:/tiao"; } } ``` ## services代码: ``` package com.mall.shopping.demo.services; import com.mall.shopping.demo.dao.UserDao; import com.mall.shopping.demo.vo.Huser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserService { @Autowired private UserDao userDao; public List<Huser> userlogin(){ return userDao.userlogin();} } ``` ## daoceng代码: ``` package com.mall.shopping.demo.dao; import com.mall.shopping.demo.vo.Huser; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; import java.util.List; @Repository @Mapper public interface UserDao { List<Huser>userlogin(); } ``` ## mybatitsconfig: ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 开启驼蜂标识:last_name lastName --> <settings> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings> <!-- 实体Bean别名 --> <typeAliases> <package name="com.mall.shopping.demo.vo.Huser"/> <package name="com.mall.shopping.demo.vo.Hdaohang"/> </typeAliases> <mappers> <mapper resource="mapper/select-login.xml"/> <mapper resource="mapper/select-hdaohang.xml"/> </mappers> </configuration> ``` ## xml代码: ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.mall.shopping.demo.dao.UserDao"> <resultMap id="SelectLogin" type="com.mall.shopping.demo.vo.Huser"> <id property="hid" column="HID"></id> <result property="huser" column="HUSER"></result> <result property="hpwd" column="HPWD"></result> </resultMap> <select id="userlogin" resultMap="SelectLogin"> select * from huser </select> </mapper> ``` ## application.properties ``` server.port=8083 server.address=127.0.0.1 #server.session-timeout=60 spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl spring.datasource.username=scott spring.datasource.password=tiger spring.datasource.driver-class-name=oracle.jdbc.OracleDriver mybatis.mapperLocations=classpath:mapper/*.xml mybatis.config-locations=classpath:mybatis/mybatis-config.xml spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.suffix=.jsp ``` ## pom文件: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.mall.shopping</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>demo</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <spring.version>5.1.5.RELEASE</spring.version> <!-- mybatis版本号 --> <mybatis.version>3.4.5</mybatis.version> <!-- oracle驱动版本号 --> <oracle-driver.version>11.2.0</oracle-driver.version> <!-- log4j日志包版本号 --> <slf4j.version>1.7.18</slf4j.version> <log4j.version>1.2.17</log4j.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.projectreactor</groupId> <artifactId>reactor-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <!-- 添加spring核心库 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> <!-- 添加mybatis依赖 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${mybatis.version}</version> </dependency> <!-- mybatis/spring包 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.3.0</version> </dependency> <!-- oracle驱动依赖 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${oracle-driver.version}</version> </dependency> <!-- dbcp,用来在spring-mybatis.xml中配置数据库 --> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> </dependency> <!-- <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency>--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <!--用于编译jsp --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <!--添加热部署--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!--热部署配置--> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!--fork:如果没有该项配置,整个devtools不会起作用--> <fork>true</fork> </configuration> </plugin> <!-- <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <versionRange>[1.2,)</versionRange> <goals> <goal>enforce</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin>--> <!--mybatis 逆向工程插件--> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.5</version> <configuration> <configurationFile>src/main/resources/mybatis-generator/generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <executions> <execution> <id>Generate MyBatis Artifacts</id> <goals> <goal>generate</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${oracle-driver.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> </dependencies> </plugin> </plugins> <!-- <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources>--> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> ``` ## 目录结构: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570672730_102043.jpg)
这种错怎么解决突然报的404 导入之前的项目或者都复制过来都不报错 新建一个jsp页面就报404
7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.服务器版本: Apache Tomcat/9.0.19 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.构建: Apr 12 2019 14:22:48 UTC 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version number: 9.0.19.0 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 10 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS.版本: 10.0 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: 结.造: amd64 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java 环境变量: C:\Program Files\Java\jre-9.0.4 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM 版本: 9.0.4+11 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM.供应商: Oracle Corporation 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: E:\mybatis\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: E:\mytomcat\apache-tomcat-9.0.19 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=E:\mybatis\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=E:\mytomcat\apache-tomcat-9.0.19 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=E:\mybatis\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 7月 24, 2019 9:10:26 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=UTF-8 7月 24, 2019 9:10:26 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5]. 7月 24, 2019 9:10:26 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 7月 24, 2019 9:10:26 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 7月 24, 2019 9:10:26 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018] 7月 24, 2019 9:10:26 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["http-nio-8080"] 7月 24, 2019 9:10:27 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["ajp-nio-8009"] 7月 24, 2019 9:10:27 下午 org.apache.catalina.startup.Catalina load 信息: 服务器在[1,274]毫秒内初始化 7月 24, 2019 9:10:27 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Catalina] 7月 24, 2019 9:10:27 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet engine: [Apache Tomcat/9.0.19] 7月 24, 2019 9:10:27 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [171] milliseconds. 7月 24, 2019 9:10:32 下午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 7月 24, 2019 9:10:33 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 7月 24, 2019 9:10:33 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 7月 24, 2019 9:13:04 下午 org.apache.ibatis.mapping.VendorDatabaseIdProvider getDatabaseId 严重: Could not get a databaseId from dataSource java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseProductName(VendorDatabaseIdProvider.java:76) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseName(VendorDatabaseIdProvider.java:61) at org.apache.ibatis.mapping.VendorDatabaseIdProvider.getDatabaseId(VendorDatabaseIdProvider.java:49) at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:395) at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:295) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4682) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492) Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 50 more WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/E:/mybatis/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/aa/WEB-INF/lib/mybatis-3.2.2.jar) to method java.lang.Object.finalize() WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 7月 24, 2019 9:13:05 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring FrameworkServlet 'springmvc' 7月 24, 2019 9:13:06 下午 org.apache.coyote.AbstractProtocol start 信息: 开始协议处理句柄["http-nio-8080"] 7月 24, 2019 9:13:06 下午 org.apache.coyote.AbstractProtocol start 信息: 开始协议处理句柄["ajp-nio-8009"] 7月 24, 2019 9:13:06 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in [159,538] milliseconds web配置文件 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>SpringMybatisOa</display-name> <!-- dwr --> <servlet> <servlet-name>dwr_invoker</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>crossDomainSessionSecurity</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr_invoker</servlet-name> <url-pattern>/dwre/*</url-pattern> </servlet-mapping> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:springconfig/*.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.action</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> springmvc配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <mvc:annotation-driven/><!-- 启动注解方式的mvc --> <context:component-scan base-package="action"/><!-- 扫描该包下所有类加载到容器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/"/> <property name="suffix" value=".jsp"/> </bean> </beans> spring配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations" value="classpath:jdbc.properties"></property> </bean> <bean id="ds" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${driverClass}" /> <property name="jdbcUrl" value="${url}" /> <property name="user" value="${userName}" /> <property name="password" value="${passWord}" /> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="ds" /> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="ds" /> <!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath:dao/*.xml"></property> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <property name="basePackage" value="dao" /> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> <context:component-scan base-package="biz.impl"/> </beans> 在线等 急!!!
SSH项目发布启动后报错
一个SSH的项目,用Eclipse新建了一个工程,把原有的项目的.settings、src、web、java_test 四个文件覆盖了进去,项目没有报错,然后发布启动后404无法访问,日志如下,\web\WEB-INF\lib下的jar包我已经全部导入了,我查好像是说spring-web这个包没找到,但是我已经导进去了,刚参加工作不久经验太少了,求大神帮忙看看是什么问题 ``` 八月 03, 2015 10:31:23 上午 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_45\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_45/bin/server;C:/Program Files/Java/jre1.8.0_45/bin;C:/Program Files/Java/jre1.8.0_45/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Java\jdk1.8.0_45\bin;C:\Program Files (x86)\Java\jdk1.8.0_45\db\bin;D:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;D:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.8.0_45\bin;D:\Maven\apache-maven-3.3.3\bin;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;D:\Eclipse;;. 八月 03, 2015 10:31:23 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CasJob' did not find a matching property. 八月 03, 2015 10:31:23 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 八月 03, 2015 10:31:23 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-8009"] 八月 03, 2015 10:31:23 上午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 722 ms 八月 03, 2015 10:31:23 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 八月 03, 2015 10:31:23 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.42 八月 03, 2015 10:31:28 上午 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http://www.extremecomponents.org is already defined 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@601ba7cb java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@730287da java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Error configuring application listener of class org.apache.catalina.deploy.ApplicationListener@478f3763 java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Skipped installing application listeners due to previous error(s) 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext startInternal 严重: Error listenerStart 八月 03, 2015 10:31:28 上午 org.apache.catalina.util.SessionIdGenerator createSecureRandom 信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [205] milliseconds. 八月 03, 2015 10:31:28 上午 org.apache.catalina.core.StandardContext startInternal 严重: Context [/CasJob] startup failed due to previous errors 八月 03, 2015 10:31:28 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory C:\xampp\tomcat\webapps\docs 八月 03, 2015 10:31:28 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory C:\xampp\tomcat\webapps\examples 八月 03, 2015 10:31:29 上午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 八月 03, 2015 10:31:29 上午 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 八月 03, 2015 10:31:29 上午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1221e05a') 八月 03, 2015 10:31:29 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory C:\xampp\tomcat\webapps\host-manager 八月 03, 2015 10:31:29 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory C:\xampp\tomcat\webapps\manager 八月 03, 2015 10:31:29 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory C:\xampp\tomcat\webapps\ROOT 八月 03, 2015 10:31:29 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8080"] 八月 03, 2015 10:31:29 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-bio-8009"] 八月 03, 2015 10:31:29 上午 org.apache.catalina.startup.Catalina start 信息: Server startup in 5474 ms ```
Spring boot controller类加入@Autowired注解启动报错
![图片说明](https://img-ask.csdn.net/upload/201904/11/1554974904_886024.png) 工程结构 ``` //下面是全部的代码,最下面时错误日志。第一次提问,不知道插入代码片的格式是不是这样的,跪求大神指导,已经看了很多解决方案,但都无法解决我的问题,注释掉Autowired或者@注释掉Autowired(required=false)虽然可以启动项目,但是程序执行时又会发生错误,问题是逃避不了的。再次跪求大神指导。 //controller package controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import bean.AppMessage; import service.AppMessageService; @RestController @RequestMapping("/appmessage") public class AppMessageController { @Autowired/*(required=false)*/ private AppMessageService service; @RequestMapping("/getThree") public List<AppMessage> getThreeForMessage(){ List<AppMessage> list = service.getMessage(); return list; } @RequestMapping("/getAll") public List<AppMessage> getAllMessage(){ List<AppMessage> list = service.getAllMessage(); int num = list.size(); if(null!=list && num>3){ for (int i = 0; i < num-3; i++) { list.remove(0); } } return list; } @RequestMapping("/getByID") public List<AppMessage> getMessageById(@RequestParam("id") String id){ List<AppMessage> list = service.getMessageById(id); int num = list.size(); if(null!=list && num>5){ for (int i = 0; i < num-5; i++) { list.remove(0); } } return list; } @RequestMapping(value = "/add",method = RequestMethod.POST) public int addMessage(@RequestBody AppMessage appMessage){ return service.addMessage(appMessage); } @RequestMapping(value="/delMessageById",method=RequestMethod.POST) public int delMessageById(@RequestParam("id") String id){ return service.delMessage(id); } } ``` ``` //Service package service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import bean.AppMessage; import mapper.AppMessageMapper; @Transactional @Service("appMessageService") public class AppMessageService { @Autowired private AppMessageMapper mapper; public List<AppMessage> getMessage(){ List<AppMessage> list = new ArrayList<AppMessage>(); list.add(mapper.selectByPrimaryKey("xtt")); //list = mapper.selectAll(); return list; } public List<AppMessage> getAllMessage(){ List<AppMessage> list = new ArrayList<AppMessage>(); list = mapper.selectAll(); return list; } public int addMessage(AppMessage appMessage) { return mapper.insert(appMessage); } public List<AppMessage> getMessageById(String id) { return mapper.getMessById(id); } public int delMessage(String id) { return mapper.deleteByPrimaryKey(id); } } ``` ``` //Mapper 接口,映射到mapper.xml package mapper; import java.util.List; import bean.AppMessage; public interface AppMessageMapper { int deleteByPrimaryKey(String id); int insert(AppMessage record); int insertSelective(AppMessage record); AppMessage selectByPrimaryKey(String id); int updateByPrimaryKeySelective(AppMessage record); int updateByPrimaryKey(AppMessage record); List<AppMessage> selectAll(); List<AppMessage> getMessById(String id); } ``` ``` <!-- Mapper.xml文件 --> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="mapper.AppMessageMapper" > <!-- 对应mapper接口的位置 --> <resultMap id="BaseResultMap" type="bean.AppMessage" > <id column="id" property="id" jdbcType="VARCHAR" /> <result column="message" property="message" jdbcType="VARCHAR" /> <result column="senddate" property="senddate" jdbcType="TIMESTAMP" /> </resultMap> <sql id="Base_Column_List" > id, message, senddate </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > select <include refid="Base_Column_List" /> from appuser_message where id = #{id,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > delete from appuser_message where id = #{id,jdbcType=VARCHAR} </delete> <insert id="insert" parameterType="bean.AppMessage" > insert into appuser_message (id, message, senddate ) values (#{id,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR}, #{senddate,jdbcType=TIMESTAMP} ) </insert> <insert id="insertSelective" parameterType="bean.AppMessage" > insert into appuser_message <trim prefix="(" suffix=")" suffixOverrides="," > <if test="id != null" > id, </if> <if test="message != null" > message, </if> <if test="senddate != null" > senddate, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="id != null" > #{id,jdbcType=VARCHAR}, </if> <if test="message != null" > #{message,jdbcType=VARCHAR}, </if> <if test="senddate != null" > #{senddate,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="bean.AppMessage" > update appuser_message <set > <if test="message != null" > message = #{message,jdbcType=VARCHAR}, </if> <if test="senddate != null" > senddate = #{senddate,jdbcType=TIMESTAMP}, </if> </set> where id = #{id,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="bean.AppMessage" > update appuser_message set message = #{message,jdbcType=VARCHAR}, senddate = #{senddate,jdbcType=TIMESTAMP} where id = #{id,jdbcType=VARCHAR} </update> <select id="selectAll" resultMap="BaseResultMap"> select id, message, senddate from appuser_message order by senddate </select> <select id="getMessById" resultMap="BaseResultMap" parameterType="java.lang.String"> select id, message, senddate from appuser_message where id = #{id,jdbcType=VARCHAR} order by senddate asc </select> </mapper> ``` ``` //实体类 package bean; import java.util.Date; public class AppMessage { private String id; private String message; private Date senddate; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message == null ? null : message.trim(); } public Date getSenddate() { return senddate; } public void setSenddate(Date senddate) { this.senddate = senddate; } } ``` ``` //启动类 package com.shuai.spring_boot_1; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; /** * Hello world! * */ @ComponentScan(basePackages="controller") @SpringBootApplication public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } } ``` ``` pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <groupId>com.shuai</groupId> <artifactId>spring-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>spring-boot-1</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <!--web应用基本环境配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version>1.3.5.RELEASE</version> </dependency> --> </dependencies> <build> <plugins> <!-- spring-boot-maven-plugin插件就是打包spring boot应用的 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` ``` #properties文件 spring.datasource.url=jdbc:mysql://localhost:3306/world spring.datasource.username=root spring.datasource.password=000000 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.max-idle=10 spring.datasource.max-wait=10000 spring.datasource.min-idle=5 spring.datasource.initial-size=5 server.port=8012 server.session.timeout=10 server.tomcat.uri-encoding=UTF-8 # mybatis.config= classpath:mybatis-config.xml mybatis.mapperLocations=classpath:mappers/*.xml # domain object's package #mybatis.typeAliasesPackage=com.lgp.SpringBoot.bean mybatis.typeAliasesPackage=bean # handler's package # mybatis.typeHandlersPackage= # check the mybatis configuration exists # mybatis.check-config-location= # mode of execution. Default is SIMPLE # mybatis.executorType= ``` ![图片说明](https://img-ask.csdn.net/upload/201904/11/1554976465_217387.png) 错误日志
org.apache.ibatis.exceptions.PersistenceException怎么解决?
调试一个开源项目出现报错,项目所有sql都会报空指针异常 ``` 严重: Servlet.service() for servlet [springMvc] in context with path [/mallapp] 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.NullPointerException ### The error may exist in file [H:\WorksSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\mallapp\WEB-INF\classes\mybatis\category\CategoryMapper.xml] ### The error may involve CategoryMapper.listAll-Inline ### The error occurred while setting parameters ### SQL: select category_name, category_img, sort, category_id, super_id from shop_category where super_id =? order by sort ### Cause: java.lang.NullPointerException] with root cause java.lang.NullPointerException at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:43) 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62) at com.sun.proxy.$Proxy84.parameterize(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:79) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:56) 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 org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) at com.sun.proxy.$Proxy74.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) at com.yq.dao.DaoSupport.findForList(DaoSupport.java:118) at com.yq.service.category.impl.CategoryService.listAll(CategoryService.java:62) at com.yq.service.category.impl.CategoryService$$FastClassBySpringCGLIB$$51d95cd7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:711) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) 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:644) at com.yq.service.category.impl.CategoryService$$EnhancerBySpringCGLIB$$c2253a36.listAll(<generated>) at com.yq.controller.category.CategoryController.list(CategoryController.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 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 com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) 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:108) 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:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) ``` CategoryMapper.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="CategoryMapper"> <!--表名 --> <sql id="tableName"> shop_category </sql> <!-- 字段 --> <sql id="Field"> category_name, category_img, sort, category_id, super_id </sql> <!-- 字段值 --> <sql id="FieldValue"> #{category_name}, #{category_img}, #{sort}, #{category_id}, #{super_id} </sql> <!-- 新增--> <insert id="save" parameterType="pd"> insert into <include refid="tableName"></include> ( <include refid="Field"></include> ) values ( <include refid="FieldValue"></include> ) </insert> <!-- 删除--> <delete id="delete" parameterType="pd"> delete from <include refid="tableName"></include> where category_id = #{category_id} </delete> <!-- 修改 --> <update id="edit" parameterType="pd"> update <include refid="tableName"></include> set category_name = #{category_name}, category_img = #{category_img}, sort = #{sort} where category_id = #{category_id} </update> <!-- 通过ID获取数据 --> <select id="findById" parameterType="pd" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where category_id = #{category_id} </select> <!-- 列表 --> <select id="datalistPage" parameterType="page" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where 1=1 and super_id =#{pd.super_id} order by sort </select> <!-- 列表(全部) --> <select id="listAll" parameterType="pd" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where super_id =#{super_id} order by sort </select> <!-- 批量删除 --> <delete id="deleteAll" parameterType="String"> delete from <include refid="tableName"></include> where category_id in <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> #{item} </foreach> </delete> </mapper> ``` mybatis-config.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="cacheEnabled" value="true" /><!-- 全局映射器启用缓存 --> <setting name="useGeneratedKeys" value="true" /> <setting name="defaultExecutorType" value="REUSE" /> <!-- 打印查询语句 --> <setting name="logImpl" value="LOG4J" /> </settings> <typeAliases> <typeAlias type="org.change.entity.system.User" alias="User"/> <typeAlias type="org.change.entity.system.Role" alias="Role"/> <typeAlias type="org.change.entity.system.Menu" alias="Menu"/> <typeAlias type="org.change.entity.system.Dictionaries" alias="Dictionaries"/> <typeAlias type="org.change.entity.system.Department" alias="Department"/> <typeAlias type="org.change.util.PageData" alias="pd"/> <!-- 分页 --> <typeAlias type="org.change.entity.Page" alias="Page"/> </typeAliases> <plugins> <plugin interceptor="org.change.plugin.PagePlugin"> <property name="dialect" value="mysql"/> <property name="pageSqlId" value=".*listPage.*"/> </plugin> </plugins> </configuration> ``` DAO.java ``` public interface DAO { /** * 保存对象 * @param str * @param obj * @return * @throws Exception */ public Object save(String str, Object obj) throws Exception; /** * 修改对象 * @param str * @param obj * @return * @throws Exception */ public Object update(String str, Object obj) throws Exception; /** * 删除对象 * @param str * @param obj * @return * @throws Exception */ public Object delete(String str, Object obj) throws Exception; /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForObject(String str, Object obj) throws Exception; /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForList(String str, Object obj) throws Exception; /** * 查找对象封装成Map * @param s * @param obj * @return * @throws Exception */ public Object findForMap(String sql, Object obj, String key , String value) throws Exception; } ``` DaoSupport.java ``` @Repository("daoSupport") public class DaoSupport implements DAO { @Resource(name = "sqlSessionTemplate") private SqlSessionTemplate sqlSessionTemplate; /** * 保存对象 * @param str * @param obj * @return * @throws Exception */ public Object save(String str, Object obj) throws Exception { return sqlSessionTemplate.insert(str, obj); } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public Object batchSave(String str, List objs )throws Exception{ return sqlSessionTemplate.insert(str, objs); } /** * 修改对象 * @param str * @param obj * @return * @throws Exception */ public Object update(String str, Object obj) throws Exception { return sqlSessionTemplate.update(str, obj); } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public void batchUpdate(String str, List objs )throws Exception{ SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory(); //批量执行器 SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false); try{ if(objs!=null){ for(int i=0,size=objs.size();i<size;i++){ sqlSession.update(str, objs.get(i)); } sqlSession.flushStatements(); sqlSession.commit(); sqlSession.clearCache(); } }finally{ sqlSession.close(); } } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public Object batchDelete(String str, List objs )throws Exception{ return sqlSessionTemplate.delete(str, objs); } /** * 删除对象 * @param str * @param obj * @return * @throws Exception */ public Object delete(String str, Object obj) throws Exception { return sqlSessionTemplate.delete(str, obj); } /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForObject(String str, Object obj) throws Exception { return sqlSessionTemplate.selectOne(str, obj); } /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForList(String str, Object obj) throws Exception { return sqlSessionTemplate.selectList(str, obj); } public Object findForMap(String str, Object obj, String key, String value) throws Exception { return sqlSessionTemplate.selectMap(str, obj, key); } } ``` spring.xml ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "> <!-- 配置事务管理器 --> <bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:jdbc.properties"/> </bean> <!-- 阿里 druid数据库连接池 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <!-- 数据库基本信息配置 --> <property name="driverClassName" value="${driverClassName}" /> <property name="url" value="${url}" /> <property name="username" value="${username}" /> <property name="password" value="${password}" /> <property name="filters" value="${filters}" /> <!-- 最大并发连接数 --> <property name="maxActive" value="${maxActive}" /> <!-- 初始化连接数量 --> <property name="initialSize" value="${initialSize}" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="${maxWait}" /> <!-- 最小空闲连接数 --> <property name="minIdle" value="${minIdle}" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="${timeBetweenEvictionRunsMillis}" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="${minEvictableIdleTimeMillis}" /> <property name="validationQuery" value="${validationQuery}" /> <property name="testWhileIdle" value="${testWhileIdle}" /> <property name="testOnBorrow" value="${testOnBorrow}" /> <property name="testOnReturn" value="${testOnReturn}" /> <property name="maxOpenPreparedStatements" value="${maxOpenPreparedStatements}" /> <!-- 打开removeAbandoned功能 --> <property name="removeAbandoned" value="${removeAbandoned}" /> <!-- 1800秒,也就是30分钟 --> <property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}" /> <!-- 关闭abanded连接时输出错误日志 --> <property name="logAbandoned" value="${logAbandoned}" /> </bean> <!-- 启用注解 --> <context:annotation-config /> <!-- 启动组件扫描,排除@Controller组件,该组件由SpringMVC配置文件扫描 --> <context:component-scan base-package="com"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> <!-- 注解方式配置事务--> <!-- <tx:annotation-driven transaction-manager="transactionManager" /> --> <!-- 拦截器方式配置事务 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="delete*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception"/> <tx:method name="insert*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="save*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="*" propagation="SUPPORTS"/> </tx:attributes> </tx:advice> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 事物处理 --> <aop:config> <aop:pointcut id="pc" expression="execution(* com.*.service..*(..))" /> <aop:advisor pointcut-ref="pc" advice-ref="txAdvice" /> </aop:config> <!-- 配置mybatis --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:mybatis-config.xml"></property> <!-- mapper扫描 --> <property name="mapperLocations" value="classpath:mybatis/*/*.xml"></property> </bean> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg ref="sqlSessionFactory" /> </bean> </beans> ```
hibernate映射表报错 unknown Oracle major version [0]
我在MyEclipse中通过hibernate映射表的时候总是报错 在“Generating Artifacts”期间发生了内部错误。 unknown Oracle major version [0] 我查看了MyEclipse的日志文件信息如下: !ENTRY org.eclipse.core.jobs 4 2 2008-11-08 09:56:42.031 !MESSAGE 在“Generating Artifacts”期间发生了内部错误。 !STACK 0 org.hibernate.HibernateException: unknown Oracle major version [0] at org.hibernate.dialect.DialectFactory$1.getDialectClass(DialectFactory.java:135) at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:65) at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2005) at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:72) at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:877) at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:91) at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:858) at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:405) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) IDE:MyEclipse 7.0 我查了网上的资料,有的说是在spring中添加方言,但还是出了问题, 我的数据库是Oracle9i2,有的说是把驱动换成ojdbc14.jar,但是问题还是没有解决。 这个问题困扰了我很久 :cry: ,不知道哪位前辈能帮我解决一下,谢谢。 [b]问题补充:[/b] 我spring原来的配置是 <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> 我改成了 <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop> 问题还是没有解决。 [b]问题补充:[/b] 我只是想用IDE通过hibernate映射表,自动生成dao和hbm.xml文件,不用启动服务器吧。 补充一下,我的tomcat是版本是5.5. [b]问题补充:[/b] 我做的是ssh。我把hibernate放在了spring中进行管理。 以下是我的spring配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"> </property> <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:db"> </property> <property name="username" value="test"></property> <property name="password" value="admin"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="DataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</prop> </props> </property> </bean></beans>
Hibernate一对一报错了。。。
tomcat启动报错,hibernate一对一问题。 主要错误日志: ``` Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\import\WEB-INF\classes\spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: com.bean.web.Attribute, at table: profile, for columns: [org.hibernate.mapping.Column(attribute)] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] ... 37 common frames omitted Caused by: org.hibernate.MappingException: Could not determine type for: com.bean.web.Attribute, at table: profile, for columns: [org.hibernate.mapping.Column(attribute)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:349) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:322) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.mapping.Property.isValid(Property.java:241) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.mapping.RootClass.validate(RootClass.java:270) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.cfg.Configuration.validate(Configuration.java:1360) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1851) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930) ~[hibernate-core-4.3.11.Final.jar:4.3.11.Final] at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:343) ~[spring-orm-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:431) ~[spring-orm-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:416) ~[spring-orm-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ~[spring-beans-4.0.4.RELEASE.jar:4.0.4.RELEASE] ... 44 common frames omitted ``` Profile实体类: ``` @Entity @Table(name = "profile") public class Profile { private Long user_id; private Long gid; private String real_name = ""; @OneToOne(mappedBy = "gid", cascade = CascadeType.ALL) private Attribute attribute; @Id @GeneratedValue public Long getUser_id() { return user_id; } public void setUser_id(Long user_id) { this.user_id = user_id; } public Long getGid() { return gid; } public void setGid(Long gid) { this.gid = gid; } public String getReal_name() { return real_name; } public void setReal_name(String real_name) { this.real_name = real_name; } public Attribute getAttribute() { return attribute; } public void setAttribute(Attribute attribute) { this.attribute = attribute; } ``` Attribute实体类: ``` @Entity @Table(name = "attribute") public class Attribute { private transient Profile gid; private Long id; private String cert_number; @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = id; } @OneToOne(cascade = CascadeType.DETACH) @JoinColumn(name = "gid") public Profile getGid() { return gid; } public void setGid(Profile gid) { this.gid = gid; } public String getCert_number() { return cert_number; } public void setCert_number(String cert_number) { this.cert_number = cert_number; } ``` spring-hibernate.xml配的扫描: ``` <!-- 配置hibernate session工厂 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.hbm2ddl.auto">none</prop> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext </prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">false</prop> </props> </property> <!-- 自动扫描注解方式配置的hibernate类文件 --> <property name="packagesToScan"> <list> <value>com.bean..</value> <value>com.bean</value> </list> </property> </bean> ``` 我能怎么办?我也很绝望啊~~~~试过很多方法,把一对一关系注掉就可以。开了就报错。。。
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
MyBatis研习录(01)——MyBatis概述与入门
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis原本是apache的一个开源项目iBatis, 2010年该项目由apache software foundation 迁移到了google code并改名为MyBatis 。2013年11月MyBatis又迁移到Github。
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
Python爬虫精简步骤1 获取数据
爬虫,从本质上来说,就是利用程序在网上拿到对我们有价值的数据。 爬虫能做很多事,能做商业分析,也能做生活助手,比如:分析北京近两年二手房成交均价是多少?广州的Python工程师平均薪资是多少?北京哪家餐厅粤菜最好吃?等等。 这是个人利用爬虫所做到的事情,而公司,同样可以利用爬虫来实现巨大的商业价值。比如你所熟悉的搜索引擎——百度和谷歌,它们的核心技术之一也是爬虫,而且是超级爬虫。 从搜索巨头到人工...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
web前端javascript+jquery知识点总结
1.Javascript 语法.用途 javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序...
Python:爬取疫情每日数据
前言 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 以全国、湖北和上海为例,分别为以下三个网站: 国家卫健委官网:http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml 湖北卫健委官网:http://wjw.hubei.gov.cn/bmdt/ztzl/fkxxgzbdgrfyyq/xxfb...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧???? 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升自...
粒子群算法求解物流配送路线问题(python)
1.Matlab实现粒子群算法的程序代码:https://www.cnblogs.com/kexinxin/p/9858664.html matlab代码求解函数最优值:https://blog.csdn.net/zyqblog/article/details/80829043 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/...
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang....
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
情人节来了,教你个用 Python 表白的技巧
作者:@明哥 公众号:Python编程时光 2020年,这个看起来如此浪漫的年份,你还是一个人吗? 难不成我还能是一条狗? 18年的时候,写过一篇介绍如何使用 Python 来表白的文章。 虽然创意和使用效果都不错,但有一缺点,这是那个exe文件,女神需要打开电脑,才有可能参与进来,进而被你成功"调戏”。 由于是很早期的文章了,应该有很多人没有看过。 没有看过的,你可以点击这里查看:用Pyt...
用Python开发实用程序 – 计算器
作者:隋顺意 一段时间前,自己制作了一个库 “sui-math”。这其实是math的翻版。做完后,python既然可以轻易的完成任何的数学计算,何不用python开发一个小程序专门用以计算呢? 现在我们越来越依赖于计算器,很多复杂的计算都离不开它。我们使用过各式各样的计算器,无论是电脑自带的,还是网也上的计算器,却都没有自己动手编写属于自己计算器。今天就让我们走进计算器的世界,用python来编写...
经典算法(19)教你两分钟学会【选择排序】
这篇博客使用图文并茂的方式讲解选择排序算法,并有完整的算法逻辑以及代码实现。
相关热词 c#开发的dll注册 c#的反射 c# grid绑定数据源 c#多线程怎么循环 c# 鼠标左键 c# char占位符 c# 日期比较 c#16进制转换为int c#用递归求顺序表中最大 c#小型erp源代码
立即提问