郁闷了一上午,运行了myEclipse的clean 后,重新加载我的项目报错了....
2010-1-5 15:05:02 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_15\bin;C:\Program Files\tomcat\apache-tomcat-6.0.16\bin
2010-1-5 15:05:02 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2010-1-5 15:05:02 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 488 ms
2010-1-5 15:05:02 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2010-1-5 15:05:02 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2010-1-5 15:05:03 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "listeners.ContextListener" is already configured for this context. The duplicate definition has been ignored.
2010-1-5 15:05:03 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "listeners.SessionListener" is already configured for this context. The duplicate definition has been ignored.
2010-1-5 15:05:03 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2010-1-5 15:05:03 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "com.ving.xzfw.led.LEDListener" is already configured for this context. The duplicate definition has been ignored.
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "org.springframework.web.context.request.RequestContextListener" is already configured for this context. The duplicate definition has been ignored.
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "org.springframework.web.util.IntrospectorCleanupListener" is already configured for this context. The duplicate definition has been ignored.
Can't rea from property file: bpelConfig.properties.Make sure that the file is under proper path
Please check the property name 'led.TimingRunTime' and try it again
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext listenerStart
严重: Error configuring application listener of class com.ving.xzfw.led.LEDListener
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.ving.xzfw.led.LEDListener.<init>(LEDListener.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
......
(Bootstrap.java:413)
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext listenerStart
严重: Skipped installing application listeners due to previous error(s)
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2010-1-5 15:05:04 org.apache.catalina.core.StandardContext start
严重: Context [/fuNan_web] startup failed due to previous errors
2010-1-5 15:05:04 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2010-1-5 15:05:04 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2010-1-5 15:05:04 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/15 config=null
2010-1-5 15:05:04 org.apache.catalina.startup.Catalina start
信息: Server startup in 2095 ms
从控制台的信息显示
com.ving.xzfw.led.LEDListener
java.lang.NumberFormatException: For input string: ""
得知是读取我的属性文件有错。
com.ving.xzfw.led.LEDListener代码片段
private Timer timer = null;
private Logger log = Logger.getLogger(getClass());
// GetconfigInfor config = new GetconfigInfor();
GetInformation getInfo = new GetInformation("bpelConfig.properties");
Integer runTime = Integer.parseInt(getInfo.getProperty("led.TimingRunTime"));
String fileRealPath = "";
String templePath = "";
public void contextInitialized(ServletContextEvent event) {
// 在这里初始化监听器,在tomcat启动的时候监听器启动,可以在这里实现定时器功能
ServletContext context = event.getServletContext();
fileRealPath = context.getRealPath("")
+ System.getProperty("file.separator") + "LEDFile"
+ System.getProperty("file.separator");
templePath = context.getRealPath("")
+ System.getProperty("file.separator") + "led"
+ System.getProperty("file.separator");
timer = new Timer();
log.info("定时器已启动");// 添加日志,可在tomcat日志中查看到
timer.schedule(new LEDTimerTack(fileRealPath, templePath), 20000, runTime);
log.info("已经添加任务");
}
结合代码可以分析出错代码段
Integer runTime = Integer.parseInt(getInfo.getProperty("led.TimingRunTime"));
很容易才想到,获取配置属性文件 led.TimingRunTime 为空
那看看配置文件
# checkMachine
#192.168.0.130
#192.168.0.92
sql.dbIP=193.168.92
sql.user=sa
sql.password=1
sql.dbName=zktime65
sql.dbPort=1433
# create LED file
led.ledtemplate=ledtemplate.htm
led.LedRunTime=60000
led.TimingRunTime=500000
配置文件时没有问题的,那怎么会出错了。
再看看控制台的信息:
Can't rea from property file: bpelConfig.properties.Make sure that the file is under proper path
Please check the property name 'led.TimingRunTime' and try it again
这里透露很重要的信息:读取属性文件bpelConfig.properties出错了,确保文件路径是否正确....
Ok,let me check and try it again!
呵呵,没有更改任何程序,没有动配置,try ,try ...try several times!
myEclipse 终于肯认错了!哈哈