资源文件放在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-导入配置文件的更多相关文章

  1. 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-01 10-类图结构分析设计

    运行astah-pro.bat,这是windows下运行的.astah-run.sh是Linux下运行的. 类结构视图的作用是描述类模型和模型与模型之间的关系,也就是说我们在这要把这个一对多和多对多的 ...

  2. 2015年传智播客JavaEE 第168期就业班视频教程14-登录功能需求分析+模块结构命名规范

    得先造一个模块,来封装我们的员工模型.登录的就是我们的员工嘛.员工模块属于权限校验系列的,校验叫做auth.进销存模块叫做cn.itcast.erp.invoice.权限模块叫做cn.itcast.e ...

  3. 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-0107-其他子系统

    一套ERP系统中一定会有CRM,不可能说我所有数据都是散着放的,你想用就随便写一个.你出去和人聊,一定得说我这里有什么有什么,然后你就可以和人说你做的是进销存.人家要问CRM或者说财务系统你就说那不是 ...

  4. 2015年传智播客JavaEE 第168期就业班视频教程06-权限校验子系统介绍

    没整过论坛你也整过淘宝,其实淘宝登录的也分商家和个人,卖家和买家,不同的人登录显示的东西是不一样的.权限系统要分两大过程,第四天上午下午分开,分为授权与校验.我把某一个职务给你叫做授权,例如封你为征西 ...

  5. 2015年传智播客JavaEE 第168期就业班视频教程day45-ERP项目-01 05-主线流程

    采购管理 销售管理 采购退货管理  销售退货管理 老师的采购单的审核是分三级审核的,如果这个单子是个普通单子,那么审核一下就完了,如果这个单子超过100万,需要二级领导审核,如果这个单子超过500万, ...

  6. 2015年传智播客JavaEE 第168期就业班视频教程day38-SSH综合案例-1

    为什么需要划分模块呢?因为需要知道一些大致的功能,其次呢需要知道我们后台需不需要对它进行维护.如果需要呢那它肯定是一个单独的模块, 1.1    网上商城需求分析: 1.1.1 前台:用户模块 注册: ...

  7. 2015年传智播客JavaEE 第168期就业班视频教程03-ERP简介(2)

    资源管理这块的东西大家基本上能够猜个差不多了.下面描述描述计划.计划这个东西把企业资源这个东西提升了不只十倍二十倍了.ERP的核心是计划,但是这次我们做是不做计划的.今年我们是一个生产型企业,我们要开 ...

  8. 2015年传智播客JavaEE 第168期就业班视频教程 02-ERP简介

    其实ERP描述的是管理一个企业的整体的所有的资源.ERP是帮你管整个企业的运行.那它是管哪一类企业呢?比如说帮光线传媒.ERP更多是用在生产制造企业,这是最好的,其次的就是这种销售型企业,二道贩子那种 ...

  9. 2015年传智播客JavaEE 第168期就业班视频教程17-登录功能业务逻辑实现(代码)

    点击红色在业务层接口EmpEbi创建方法login 按F4弹出类继承层次视图 这些快捷键是条件反射了. 业务层做MD5数据加密,不能放在表现层也不能放在数据层必须放在业务层.它属于业务操作. 数据层的 ...

随机推荐

  1. U盘安装linix

    首先制作u盘启动器. 然后在电脑上使用UltraISO将你的安装的linix系统刻录到u盘上 在放入一份linix系统在u盘更目录 boot页面u盘启动.选择 第二次没有放入系统在u盘根目录出现这个: ...

  2. c++类成员函数重载常量与非常量版本时避免代码重复的一种方法

    c++有时候需要为类的某个成员函数重载常量与非常量的版本,定义常量版本是为了保证该函数可作用于常量类对象上,并防止函数改动对象内容.但有时两个版本的函数仅仅是在返回的类型不同,而在返回前做了大量相同的 ...

  3. VirtualBox只能生成32位虚拟机

    /************************************************************************* * VirtualBox只能生成32位虚拟机 * ...

  4. Windows10解决无法访问其他机器共享的问题

    你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问.这些策略可帮助保护你的电脑免受网络上不安全设备或恶意设备的威胁. 管理员身份执行sc.exe config lanmanwork ...

  5. Redis学习笔记-事务控制篇(Centos7)

    一.事务控制 1.简单事务控制 redis可以使用mult命令将之后的命令都存放在队列中,只有使用exec命令时才全部执行. 127.0.0.1:6379> multi OK 127.0.0.1 ...

  6. fusionjs uber开源的通用web插件化开发框架

    fusionjs uber开源的web 插件化开发框架 核心特性: 基于插件的开发,依赖注入开发 开箱即用的服务器端渲染,构建结果拆分,模块热加载 Tree-shaking 支持 集成的插件 redu ...

  7. list_for_each与list_for_each_entry具体解释

    一.list_for_each 1.list_for_each原型#define list_for_each(pos, head) \     for (pos = (head)->next, ...

  8. RabbitMq + Spring 实现ACK机制

    概念性解读(Ack的灵活) 首先啊,有的人不是太理解这个Ack是什么,讲的接地气一点,其实就是一个通知,怎么说呢,当我监听消费者,正常情况下,不会出异常,但是如果是出现了异常,甚至是没有获取的异常,那 ...

  9. thinkphp 模型验证

    <?php class FormModel extends Model { // 自动验证设置 /* * 一:自动验证 自动验证的定义是这样的:array(field,rule,message, ...

  10. USACO 2016 US Open Contest, Gold解题报告

    1.Splitting the Field http://usaco.org/index.php?page=viewproblem2&cpid=645 给二维坐标系中的n个点,求ans=用一个 ...