最近玩用重新用了下ssh,跟以前相比無非是版本上有些不一樣,也就stuts2和struts1有些不一樣其他的都差不多。
進入正題:
工程正常運行以後,出現很多諸如Could not find property [templateDir]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [org.apache.catalina.jsp_file]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [struts.valueStack]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [templateDir]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [templateDir]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [theme]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [theme]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [templateDir]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [templateDir]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [theme]
2008-9-1 12:16:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [theme]
2008-9-1 12:16:03 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [.freemarker.Request]
2008-9-1 12:16:03 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [.freemarker.RequestParameters]
2008-9-1 12:16:03 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [actionErrors]
2008-9-1 12:16:03 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: Could not find property [actionErrors]
......
等警告資訊。
搜了一下,都問的人不少,解決方案幾乎沒有,於是乎來到apache官網搜了一把,貌似有提到這個。
參考地址:http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-MissingProperties
主要內容如下: Missing Properties
This message states that the framework searched for a property in the value stack and failed to find it.
2008-04-19 14:21:08,177 WARN [http-8443-Processor25] [OgnlValueStack] Could not find property [templateDir]2008-04-19 14:21:08,177 WARN [http-8443-Processor25] [OgnlValueStack] Could not find property [templateDir]2008-04-19 14:21:08,177 WARN [http-8443-Processor25] [OgnlValueStack] Could not find property [templateDir]2008-04-19 14:21:08,178 WARN [http-8443-Processor25] [OgnlValueStack] Could not find property [org.apache.catalina.jsp_file]
To hide these messages, turn off the WARN level logging for OgnlValueStack.
eg. Include a new limit category in your log4j.xml file (only log errors or worse):
(個人習慣而已),考慮到有些朋友對log4j不太熟悉
貼一下代碼
log4j.properties 放在src目錄下就好了,記得在系統硬碟上建立 log4j.appender.logfile.File對應的檔案。
# For JBoss: Avoid to setup log4j outside $JBOSS_HOME/server/default/deploy/log4j.xml
# For all other servers: Comment out the Log4J listener in web.xml too
log4j.rootLogger=ERROR, console, logfile
#console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %p [%c] - <%m>%n
#log4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#logfile
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=C:/ask/logs/ask.log
# Log4j Max File Size
# log4j.appender.logfile.MaxFileSize=10MB
# Log4j BackUp File Index
# log4j.appender.logfile.MaxBackupIndex=10
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
# Pattern to output: date priority [category] - <message>line_separator
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
#log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug
### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug
### log just the SQL
#log4j.logger.org.hibernate.SQL=info
### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug
### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug
### log HQL parse trees
#log4j.logger.org.hibernate.hql=info
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug
### log transaction activity
#log4j.logger.org.hibernate.transaction=debug
### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
打完收工,繼續寫代碼。。。 正在模仿www.javaeye.com/ask做ssh練手。