摘要:这几天在学习中的架构开始搭建时候遇到很多问题经过几天的探索记录一下的搭建一使用创建新项目选择相关相关相关选择完成后二在项目目录下创建和文件夹将相关的包导入项目三依赖包四调整项目依赖路径选择放包的文件夹点击然后四配置五测试修改报错运行项
这几天在学习java web中的SSh架构,开始搭建时候遇到很多问题,经过几天的探索,记录一下SSH 的搭建
一.使用Idea创建新项目
1.选择Spring相关
2.struts2相关
3.hibernate相关
4.选择完成后next->finish
二.在项目web/WEB-INF目录下创建lib 和classe文件夹将相关的jar包导入项目
三.依赖jar包
四调整项目依赖路径
选择放jar包的lib文件夹
点击OK
然后apply->ok
四.配置tomcat
五.测试修改
报错1.运行项目报错,错误如下
21-Aug-2018 14:26:38.160 警告 [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0]. Default version will be used. 21-Aug-2018 14:26:40.003 信息 [RMI TCP Connection(3)-127.0.0.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. 21-Aug-2018 14:26:40.023 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file 21-Aug-2018 14:26:40.023 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
查看log日志
Log中显示错误如下
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:512) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:493) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4591) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1739) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
这个错误是因为web.xml中的structs2 配置错误
修改配置为:
struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter struts2 /*
运行项目 报错2:
Unable to load configuration. - validator - file:///D:/Creator/java/tomcat8.5.23/bin/com/opensymphony/xwork2/validator/validators/default.xml:28:109 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496) at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73) at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:61) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4591) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1739) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: Unable to load validator class com.opensymphony.xwork2.validator.validators.RequiredFieldValidator - validator - file:///D:/Creator/java/tomcat8.5.23/bin/com/opensymphony/xwork2/validator/validators/default.xml:28:109 at com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseValidatorDefinitions(DefaultValidatorFileParser.java:136) at com.opensymphony.xwork2.validator.DefaultValidatorFactory.retrieveValidatorConfiguration(DefaultValidatorFactory.java:194) at com.opensymphony.xwork2.validator.DefaultValidatorFactory.parseValidators(DefaultValidatorFactory.java:179) at com.opensymphony.xwork2.validator.DefaultValidatorFactory.init(DefaultValidatorFactory.java:62) at com.opensymphony.xwork2.inject.ContainerBuilder$8.call(ContainerBuilder.java:594) at com.opensymphony.xwork2.inject.ContainerBuilder$8.call(ContainerBuilder.java:590) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:560) at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:590) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:182) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) ... 53 more Caused by: java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:165) at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:177) at com.opensymphony.xwork2.factory.DefaultValidatorFactory.buildValidator(DefaultValidatorFactory.java:47) at com.opensymphony.xwork2.ObjectFactory.buildValidator(ObjectFactory.java:239) at com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseValidatorDefinitions(DefaultValidatorFileParser.java:133) ... 62 more
这里是需要添加一个xwork-coreXXX.jar的包然后在web.xml中配置
org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:spring-config.xml
启动项目,启动成功,完成ssh的基本配置
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/76826.html
摘要:原文链接一文掌握本地与远程调试很久没写了同样很很久没有用了,近期有个简单的场景要用到,简单记录一下关键步骤。配置与本地调试的配置不一样的地方就是和,其他地方大同小异。 原文链接:一文掌握PHP Xdebug 本地与远程调试 很久没写PHP了、同样很很久没有用XDebug了,近期有个简单的场景要用到,简单记录一下关键步骤。 本地调试 本地环境: $ php -v PHP 7.3.4 (c...
阅读 1207·2021-11-11 16:55
阅读 1484·2021-10-08 10:16
阅读 1118·2021-09-26 10:20
阅读 3511·2021-09-01 10:47
阅读 2417·2019-08-30 15:52
阅读 2648·2019-08-30 13:18
阅读 3170·2019-08-30 13:15
阅读 1086·2019-08-30 10:55