2015年传智播客JavaEE 第168期就业班视频教程11-导入配置文件

资源文件放在Source Folder目录下面,这个目录同样会编译到classes目录下
web.xml的
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
在服务器启动的同时加载Spring的ApplicationContext对象到ServletContext范围,回头你到处都可以用了。这句话简单的意思是在服务器启动的时候把Spring环境启动起来。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext*.xml</param-value>
</context-param>
这句话是配置你的Spring读哪个配置文件的。
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
每次它都是延迟加载,而且延迟加载的东西都能得到。
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这是openSessionInView的过滤器,不说了。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
这是struts2的核心过滤器。
配置文件中openSessionInView和struts2是有顺序之分的。openSessionInView必须写在struts2之前。openSessionInView是延迟加载,用到再说吧。
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这是struts 2的过滤器不说了。
web.xml文件解释过了。
下面解释struts2
<struts> //这是struts 的根
<constant name="struts.devMode" value="true" /> 开发模式开启
<constant name="struts.ui.theme" value="simple" />
<package name="default" namespace="/" extends="struts-default">
</package>
</struts>
你自己写的东西难道依赖编译器帮你检验吗?编译环境只是帮你做格式检验。
启动服务器报错
Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [classpath:cn/itcast/invoice/**/vo/*Model.hbm.xml]: class path resource [cn/itcast/invoice/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.support.ResourceArrayPropertyEditor.setAsText(ResourceArrayPropertyEditor.java:135)
at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:452)
at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:424)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:181)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:450)
... 41 more
2017-1-31 19:51:01 org.apache.catalina.core.StandardContext startInternal
你想用
<property name="mappingLocations">
<value>classpath:cn/itcast/invoice/**/vo/*Model.hbm.xml</value>
</property>
这个格式必须得保证前面的那个包cn/itcast/invoice是存在的。后面既然你写**就意味着有可能有有可能没有。如果删掉cn/itcast/invoice扫描速度太慢了。所以加上cn.itcast.invoice包吧。

仅仅是加上这个包cn.itcast.invoice服务器启动的时候就不报错了。
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.75
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Jan 18 2017 20:54:42 UTC
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.75.0
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows Vista
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 6.1
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Users\ZhongZhenhua\AppData\Local\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.6.0_13-b03
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Sun Microsystems Inc.
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75/common/endorsed
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\temp
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\Users\ZhongZhenhua\AppData\Local\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\bin;F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\bin
2017-1-31 19:57:25 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dsun.io.useCanonCaches=false
2017-1-31 19:57:25 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.2.10 using APR version 1.5.2.
2017-1-31 19:57:25 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2017-1-31 19:57:26 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.2j 26 Sep 2016)
2017-1-31 19:57:26 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
2017-1-31 19:57:26 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
2017-1-31 19:57:26 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1990 ms
2017-1-31 19:57:26 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2017-1-31 19:57:26 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.75
2017-1-31 19:57:26 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\docs
2017-1-31 19:57:27 org.apache.tomcat.websocket.server.WsSci onStartup
信息: JSR 356 WebSocket (Java WebSocket 1.1) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
2017-1-31 19:57:27 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\docs has finished in 689 ms
2017-1-31 19:57:27 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\ERP
2017-1-31 19:57:31 org.apache.catalina.startup.TldConfig execute
信息: 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.
2017-1-31 19:57:31 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
2017-1-31 19:57:31 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2017-1-31 19:57:36 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\ERP has finished in 9,624 ms
2017-1-31 19:57:36 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\examples
2017-1-31 19:57:37 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2017-1-31 19:57:37 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2017-1-31 19:57:37 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@758c3b7')
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\examples has finished in 579 ms
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\host-manager
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\host-manager has finished in 132 ms
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\manager
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\manager has finished in 147 ms
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\ROOT
2017-1-31 19:57:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory F:\apache-tomcat-7.0.75-windows-x64\apache-tomcat-7.0.75\webapps\ROOT has finished in 114 ms
2017-1-31 19:57:37 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
2017-1-31 19:57:37 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
2017-1-31 19:57:37 org.apache.catalina.startup.Catalina start
信息: Server startup in 11455 ms
2015年传智播客JavaEE 第168期就业班视频教程11-导入配置文件的更多相关文章
- 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-01 10-类图结构分析设计
运行astah-pro.bat,这是windows下运行的.astah-run.sh是Linux下运行的. 类结构视图的作用是描述类模型和模型与模型之间的关系,也就是说我们在这要把这个一对多和多对多的 ...
- 2015年传智播客JavaEE 第168期就业班视频教程14-登录功能需求分析+模块结构命名规范
得先造一个模块,来封装我们的员工模型.登录的就是我们的员工嘛.员工模块属于权限校验系列的,校验叫做auth.进销存模块叫做cn.itcast.erp.invoice.权限模块叫做cn.itcast.e ...
- 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-0107-其他子系统
一套ERP系统中一定会有CRM,不可能说我所有数据都是散着放的,你想用就随便写一个.你出去和人聊,一定得说我这里有什么有什么,然后你就可以和人说你做的是进销存.人家要问CRM或者说财务系统你就说那不是 ...
- 2015年传智播客JavaEE 第168期就业班视频教程06-权限校验子系统介绍
没整过论坛你也整过淘宝,其实淘宝登录的也分商家和个人,卖家和买家,不同的人登录显示的东西是不一样的.权限系统要分两大过程,第四天上午下午分开,分为授权与校验.我把某一个职务给你叫做授权,例如封你为征西 ...
- 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-01 05-主线流程
采购管理 销售管理 采购退货管理 销售退货管理 老师的采购单的审核是分三级审核的,如果这个单子是个普通单子,那么审核一下就完了,如果这个单子超过100万,需要二级领导审核,如果这个单子超过500万, ...
- 2015年传智播客JavaEE 第168期就业班视频教程day38-SSH综合案例-1
为什么需要划分模块呢?因为需要知道一些大致的功能,其次呢需要知道我们后台需不需要对它进行维护.如果需要呢那它肯定是一个单独的模块, 1.1 网上商城需求分析: 1.1.1 前台:用户模块 注册: ...
- 2015年传智播客JavaEE 第168期就业班视频教程03-ERP简介(2)
资源管理这块的东西大家基本上能够猜个差不多了.下面描述描述计划.计划这个东西把企业资源这个东西提升了不只十倍二十倍了.ERP的核心是计划,但是这次我们做是不做计划的.今年我们是一个生产型企业,我们要开 ...
- 2015年传智播客JavaEE 第168期就业班视频教程 02-ERP简介
其实ERP描述的是管理一个企业的整体的所有的资源.ERP是帮你管整个企业的运行.那它是管哪一类企业呢?比如说帮光线传媒.ERP更多是用在生产制造企业,这是最好的,其次的就是这种销售型企业,二道贩子那种 ...
- 2015年传智播客JavaEE 第168期就业班视频教程17-登录功能业务逻辑实现(代码)
点击红色在业务层接口EmpEbi创建方法login 按F4弹出类继承层次视图 这些快捷键是条件反射了. 业务层做MD5数据加密,不能放在表现层也不能放在数据层必须放在业务层.它属于业务操作. 数据层的 ...
随机推荐
- Eclipse 项目有红惊叹号
Eclipse 项目有红感叹号原因:显示红色感叹号是因为jar包的路径不对 解决:在项目上右击Build Path -> Configure Build Paht...(或Propertise- ...
- CentOS6下源码安装mysql-5.6.25
1.1.系统环境检查 1)检查系统版本 mkdir -p /server/tools/ cd /server/tools/ cat /etc/redhat-release 2)配置域名解析 vim / ...
- WCF WS-Security and WSE Nonce Authentication【转】
原文:http://weblog.west-wind.com/posts/2012/Nov/24/WCF-WSSecurity-and-WSE-Nonce-Authentication?utm_sou ...
- Linux内核gpiolib注册建立过程
1.相关的数据结构 struct s3c_gpio_chip { // 这个结构体是三星在移植gpiolib时封装的一个结构体 用来描述一组gpio端口信息 struct gpio_chip chip ...
- Python中定时任务框架APScheduler
前言 大家应该都知道在编程语言中,定时任务是常用的一种调度形式,在Python中也涌现了非常多的调度模块,本文将简要介绍APScheduler的基本使用方法. 一.APScheduler介绍 APSc ...
- (精华)将json数组和对象转换成List和Map(小龙哥和牛徳鹤的对话)
将java标准的数据结构ArrayList和HashMap转换成json对象和数组很简单 只需要JSONArray.fromObject(obj);或者JSONObject.fromObject(ob ...
- 使用graphql-code-generator 生成graphql 代码
类似的工具比较多,比如prisma .qloo.golang 的gqlgen.apollo-codegen graphql-code-generator 也是一个不错的工具(灵活.模版自定义...) ...
- linux之 CentOS/RHEL/Scientific Linux 6 & 7上安装Telnet
声明: 在安装和使用Telnet之前,需要记住以下几点. 在公网(WAN)中使用Telnet是非常不好的想法.它会以明文的格式传输登入数据.每个人都可以看到明文.如果你还是需要Telnet,强烈建议你 ...
- win7 安装redis服务
Redis官方是不支持windows的,只是 Microsoft Open Tech group 在 GitHub上开发了一个Win64的版本,项目地址是: https://github.com/MS ...
- MyEclipse下Tomcat无法部署项目 finish按钮无法点击
问题描述:MyEclipse环境下,使用Tomcat进行项目部署时,无法部署项目,finish按钮无法点击. 问题原因:Context-root丢失 解决办法:右击项目->properties- ...