- This topic has 2 replies, 2 voices, and was last updated 19 years, 3 months ago by mharley.
-
AuthorPosts
-
mharleyMemberHello,
I have installed Eclipse 3.1, My Eclipse 4 M2, JDK 1.5.x.
I have been attempting to play around with the Spring support in ME and have been having some trouble.
I build a very simple stand-alone app (that is app running from a main()) and followed the process to “Add Spring Capabilities” via the MyEclipse menu. I get a clean compile.
Upon running the app, it complains that it cannot find the Apache commons-logging classes when I try to create a ClassPathXmlApplicationContext object. Thus, I added commons-logging.jar to the classpath through Eclipse. The following error ensues:
Exception in thread "main" 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.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:127) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:159) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:66) at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:49) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:56) at Main.main(Main.java:12) 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) ... 11 more Caused by: java.lang.NullPointerException at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374) ... 12 more
Upon searching the commons-logging documentation, I found a reference to a property: org.apache.commons.logging.Log. I set that to three different options also listed in the commons-logging documentation. The behavior was unchanged.
I am very new to Spring (using this effort to learn Spring), so I was unsure if I was doing something stupid or if the IDE was indeed the problem. I did write an ANT script to compile and run the app and it was successful.
Any insights ya’ll could give would be greatly appreciated. My appologies if the problem is my inexperience and not MyEclipse.
Thanks!
Mike Harley
Riyad KallaMemberMike,
This is a straight configuration issue. Do you have a logging confiruation properties file somewhere in your classpath that commons might be picking up?
mharleyMemberThanks for your quick reply.
I did get it working and it was not my code/configuration nor MyEclipse. I completely removed the CLASSPATH settings from my shell environment as well as removing all but the minimum jar files from my Eclipse runtime configuration. (I had previously removed all property files from the classpath as well.) The problem still persisted.
The commons-logging.jar file that I was referencing in the Eclipse runtime configuration was the one included with Spring – that is, installed under $SPRING_HOME/lib/jakarta-commons.
I changed the commons-logging.jar file that I was referencing to use the commons-logging.jar that is included with JBoss 4.x. That solved the problem. Thus, I can only assume that Spring must either include a weird version of commons-logging.jar or they may have changed it/added to it for the standard framework release?
Anyway, the app is working and I am “fat and happy” now. Thanks for your help and sorry to take your time with something that was not your issue.
-M-
-
AuthorPosts