SSH框架发布的应用,修改config.properties文件后,只有*.jsp路径可以访问,*.action路径就不能访问了,即使修改的是config.properties中的注释也不行。后台没有任何错误输出,而把项目从tomcat删除了,再重新用myeclipse部署一下又可以了。到底是为什么呢?求解答!
tomcat版本为:apache-tomcat-6.0.39
jdk的版本为:1.6
strus.xml内容如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- 指定由spring负责action对象的创建 -->
<constant name="struts.objectFactory" value="spring" />
<!-- 所有匹配*.action的请求都由struts2处理 -->
<constant name="struts.action.extension" value="action" />
<!-- 是否启用开发模式 -->
<constant name="struts.devMode" value="true" />
<!-- 每次HTTP请求系统都重新加载资源文件,有助于开发 -->
<constant name="struts.i18n.reload" value="true" />
<!-- struts配置文件改动后,是否重新加载 -->
<constant name="struts.configuration.xml.reload" value="true" />
<!-- 设置浏览器是否缓存静态内容 -->
<constant name="struts.serve.static.browserCache" value="false" />
<!-- 请求参数的编码方式 -->
<constant name="struts.i18n.encoding" value="utf-8" />
<!-- 国际化-->
<constant name="struts.custom.i18n.resources" value="message" />
<!-- 文件上传最大值 -->
<constant name="struts.multipart.maxSize" value="104857600" />
<!-- 让struts2支持动态方法调用 -->
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<!-- 让struts2支持静态方法调用 -->
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
<!-- Action名称中是否还是用斜线 -->
<constant name="struts.enable.SlashesInActionNames" value="false" />
<!-- 允许标签中使用表达式语法 -->
<constant name="struts.tag.altSyntax" value="true" />
<!-- 对于WebLogic,Orion,OC4J此属性应该设置成true -->
<constant name="struts.dispatcher.parametersWorkaround" value="false" />
<!-- 定义struts注解 解析action包 -->
<constant name="struts.convention.package.locators" value="action"/>
<!-- 定义struts注解 内容的父类包 -->
<constant name="struts.convention.default.parent.package" value="basePackage"/>
<!-- 定义临时文件存放位置-->
<constant name="struts.multipart.saveDir" value="/tmp"/>
<include file="struts-default.xml"></include>
<package name="basePackage" extends="struts-default">
<interceptors>
<!-- i18n拦截器 -->
<interceptor name="languageInterceptor" class="debt.framework.i18n.LanguageInterceptor" />
<!--token防重复提交拦截器 -->
<interceptor name="tokenInterceptor" class="debt.framework.authority.TokenInterceptor" />
<interceptor-stack name="languageStack">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="tokenInterceptor"></interceptor-ref>
<interceptor-ref name="languageInterceptor"></interceptor-ref>
</interceptor-stack>
<!-- 权限拦截器 -->
<interceptor name="authorityInterceptor" class="debt.framework.authority.AuthorityInterceptor" />
<interceptor-stack name="authorityStack">
<interceptor-ref name="languageStack"></interceptor-ref>
<interceptor-ref name="authorityInterceptor"></interceptor-ref>
</interceptor-stack>
</interceptors>
<!-- 全局拦截器栈 -->
<default-interceptor-ref name="authorityStack" />
<global-results>
<result name="login" type="redirect">/login.jsp</result>
<result name="index" type="redirect">/index.jsp</result>
<result name="noAuthority">/error/noAuthority.jsp</result>
<result name="noSession" >/error/noSession.jsp</result>
<result name="strutsException">/error/strutsException.jsp</result>
<result name="processNext" >/platform/processNext.jsp</result>
<result name="processLog" >/platform/processLog.jsp</result>
<result name="chartMain" >/platform/chartMain.jsp</result>
<result name="processInstanceChart" >/platform/processInstanceChart.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="strutsException"
exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
</package>
</struts>
spring的配置文件如下:
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
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.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd " default-autowire="byName">
<!-- 开启定时器 任务
<task:annotation-driven/>
-->
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
<!-- 引入属性文件 -->
<context:property-placeholder location="classpath:config.properties" />
<!-- 自动扫描dao和service包(自动注入) -->
<context:component-scan base-package="debt.**.dao,debt.**.service,debt.**.action,debt.springtask" />
<bean id="ftpUtil" class="debt.framework.util.FtpUtil">
<constructor-arg value="${ftp_ip}"/>
<constructor-arg value="${ftp_port}"/>
<constructor-arg value="${ftp_username}"/>
<constructor-arg value="${ftp_password}"/>
<constructor-arg value="${ftp_defaultPath}"/>
</bean>
<import resource="applicationContext-datasource.xml"/>
</beans>
applicationContext-datasource.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
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.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
" default-autowire="byName">
<!-- 数据源 c3p0连接池 配置 -->
<bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<property name="url" value="${jdbc_url}" />
<property name="username" value="${jdbc_username}" />
<property name="password" value="${jdbc_password}" />
<!-- 初始化连接大小 -->
<property name="initialSize" value="10" />
<!-- 连接池最大使用连接数量 -->
<property name="maxActive" value="100" />
<!-- 连接池最大空闲 -->
<property name="maxIdle" value="0" />
<!-- 连接池最小空闲 -->
<property name="minIdle" value="0" />
<!-- 获取连接最大等待时间 -1为无限制 -->
<property name="maxWait" value="60000" />
<!-- <property name="poolPreparedStatements" value="true" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="33" /> -->
<property name="validationQuery" value="${validationQuery}" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="testWhileIdle" value="true" />
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="25200000" />
<!-- 打开removeAbandoned功能 -->
<property name="removeAbandoned" value="true" />
<!-- 1800秒,也就是30分钟 -->
<property name="removeAbandonedTimeout" value="1800" />
<!-- 关闭abanded连接时输出错误日志 -->
<property name="logAbandoned" value="true" />
<!-- 监控数据库 -->
<!-- <property name="filters" value="stat" /> -->
<property name="filters" value="mergeStat" />
</bean>
<!-- sessionFactory -->
<bean name="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>debt.**.domain</value><!-- 扫描实体类,也就是平时所说的model -->
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
</props>
</property>
</bean>
<!-- 事务管理器 -->
<bean name="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 事务代理 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED" />
<tx:method name="new*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="edit*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 织入事物代理 -->
<aop:config proxy-target-class="true">
<aop:pointcut id="ServiceMethod" expression="execution(* debt.*.service.*.*(..))||execution(* debt.springtask.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="ServiceMethod" />
</aop:config>
<!-- 配置druid监控spring jdbc -->
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor">
</bean>
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
<property name="patterns">
<list>
<value>debt.*.service.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut" />
</aop:config>
</beans>
web.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>debt</description>
<display-name>debt</display-name>
<!-- WebApp Root -->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webDagongCredit.root</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>600000</param-value>
</context-param>
<!-- spring配置文件位置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
<!-- druid数据源Web监控配置 -->
<filter>
<filter-name>druidWebStatFilter</filter-name>
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
<init-param>
<param-name>exclusions</param-name>
<param-value>/css/*,/style/*,/jslib/*,*.js,*.css,/druid*,/attached/*,*.jsp</param-value>
</init-param>
<init-param>
<param-name>principalSessionName</param-name>
<param-value>sessionInfo</param-value>
</init-param>
<init-param>
<param-name>profileEnable</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<servlet>
<!-- druid监控页面 -->
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>
<!-- openSessionInView配置 -->
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<!-- Struts2配置 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- 字符集编码配置 -->
<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>openSessionInViewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- spring监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 防止spring内存溢出监听器 -->
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<listener>
<listener-class>debt.framework.base.SysInitListener</listener-class>
</listener>
<!-- 配置session超时时间,单位分钟 -->
<session-config>
<session-timeout>120</session-timeout>
</session-config>
<!-- 配置错误页面 -->
<error-page>
<error-code>404</error-code>
<location>/error/404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/500.jsp</location>
</error-page>
<!-- 项目起始页面 -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
修改的那个config.properties:
sessionInfoName=sessionInfo
#方言
hibernate.dialect=org.hibernate.dialect.OracleDialect
#与库表同步方式 update
hibernate.hbm2ddl.auto=none
validationQuery=SELECT 1
#控制台打印sql
hibernate.show_sql=true
#格式化sql
hibernate.format_sql=true
#数据库连接驱动
driverClassName=oracle.jdbc.driver.OracleDriver
jdbc_url=jdbc:oracle:thin:@localhost:1521:orcl
jdbc_username=admin
jdbc_password=password
#超级系统管理员
ADMIN_ROLE_ID =admin
ftp_ip=localhost
ftp_port=21
ftp_username=username
ftp_password=password
ftp_defaultPath=myFTP
uploadFieldName=filedata
uploadFileMaxSize=20971520
uploadFileExts=txt,rar,zip,doc,docx,xls,xlsx,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid
pjbguploadFileExts=.doc
uploadDirectory=attached
相关推荐
dbcpconfig.properties java dbcp数据库连接配置文件。
config.properties
配置项含义danmu%弹幕文件弹幕数下限,默认0表示下载弹幕数量不为0的弹幕文件,设置1-100则表示根据当前弹幕池上限(例如24分钟番剧3000条的百分之多少
执行此文件会生成config.h文件,需要改下路径
今天小编就为大家分享一篇关于Java语言读取配置文件config.properties的方法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
从路由器备份config.bin文件里查看并找回宽带密码
itest.config.properties
config.properties:数据库配置文件 log4j.properties:mybatis日志文件 spring-mvc.xml:spring-MVC配置文件 spring-mybatis.xml:mybatis的配置文件 spring.xml
server-config.wsdd文件下载
蜗牛笔记ueditor config.json文件
最新的config.sub和config.guess(2012-02-10)
seata nacos 配置内容 config.txt,这个文件用于上传至nacos配置中心,dataId为seataServer.properties,group为SEATA_GROUP
router.config.js
Struts框架中struts-config.xml文件配置小结
config.guess和config.sub文件,自己亲测,可以使用。
linux jenkins 原始配置config.xml
Weblogic中MIME的默认配置文件 文件名称:domain/config/mimemappings.properties 格式如下: js=text/javascript 个人觉得设置完后,Weblogic可能要重启一下。
用于servlet+jsp开发时连接数据库,必须要配置文件。该配置文件已经设置了时区和页面的编码问题。只要改数据库名即可用。
Java属性文件 如何在Java中读取config.properties值? 主跑 java crunchify / com / tutorial / CrunchifyReadConfigMain 参考