配置开发环境(JDK1.5+Tomcat5.5.4+Eclipse3.1)时碰到的3个问

1/5/2008来源:Java教程人气:5464


  我在配置开发环境(JDK1.5+Tomcat5.5.4+Eclipse3.1)时碰到的3个问

1、问题:用打开带java小程序的页面,在Java小程序的地方显示一灰色区块,
当鼠标移动到该区块时,状态栏提示:
load:class XXXXX not found

解答:参考http://www.cryer.co.uk/brian/java/help_classnotfound.htm

2、问题:在Eclipse中执行,报Could not find the main class.PRogram will exit.
console窗口:
java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:53)
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstrUCtor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 4 more
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
... 5 more
Exception in thread "main"

解答:
Possible solution:
I edited the file "tomcat50x.server" under
C:\eclipse\plugins\com.objectlearn.jdt.j2ee_3.0.1\servers
and changed
-Djava.endorsed.dirs="${serverRootDirectory}/bin;${serverRootDirectory}/common/endorsed"
to
-Djava.endorsed.dirs="${serverRootDirectory}/common/endorsed"
in the following ´tags´:
<startVmParameters>-DJAVA_HOME="${jrePath}" -Dcatalina.base="${serverRootDirectory}" -Dcatalina.home="${serverRootDirectory}" -Djava.io.tmpdir="${serverRootDirectory}/temp" -Djava.endorsed.dirs="${serverRootDirectory}/bin;${serverRootDirectory}/common/endorsed"</startVmParameters>
and
<stopVmParameters>-DJAVA_HOME="${jrePath}" -Dcatalina.base="${serverRootDirectory}" -Dcatalina.home="${serverRootDirectory}" -Djava.io.tmpdir="${serverRootDirectory}/temp" -Djava.endorsed.dirs="${serverRootDirectory}/bin;${serverRootDirectory}/common/endorsed"</stopVmParameters>