Saturday, August 28, 2010

Spring IDE "Build is incomplete" and commons-logging.properties

I use sts 2.3.2 and always got "Build path is incomplete" issues. And I found this was caused by this exception:

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AspectDefinitionMatcher.initAspectJE xpressionPointcut(AspectDefinitionMatcher.java:229 )
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AspectDefinitionMatcher.createAspect JPointcutExpression(AspectDefinitionMatcher.java:1 86)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AspectDefinitionMatcher.internalMatc hes(AspectDefinitionMatcher.java:262)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AspectDefinitionMatcher.matches(Aspe ctDefinitionMatcher.java:92)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob$1.doWith ActiveProjectClassLoader(AopReferenceModelBuilderJ ob.java:253)
at org.springframework.ide.eclipse.core.java.JdtUtils $DefaultProjectClassLoaderSupport.executeCallback( JdtUtils.java:850)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop ReferencesForBean(AopReferenceModelBuilderJob.java :209)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop ReferencesForBeans(AopReferenceModelBuilderJob.jav a:281)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop ReferencesForBeansConfig(AopReferenceModelBuilderJ ob.java:307)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop ReferencesFromBeansConfigSets(AopReferenceModelBui lderJob.java:395)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop ReferencesForFile(AopReferenceModelBuilderJob.java :353)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.buildAop Model(AopReferenceModelBuilderJob.java:448)
at org.springframework.ide.eclipse.aop.core.internal. model.builder.AopReferenceModelBuilderJob.run(AopR eferenceModelBuilderJob.java:157)
at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:55)
Caused by: org.apache.commons.logging.LogConfigurationExcepti on: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
at org.apache.commons.logging.impl.LogFactoryImpl.dis coverLogImplementation(LogFactoryImpl.java:874)
at org.apache.commons.logging.impl.LogFactoryImpl.new Instance(LogFactoryImpl.java:604)
at org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:336)
at org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:310)
at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:685)
at org.springframework.ide.eclipse.springframework.ao p.aspectj.AspectJExpressionPointcut.(Aspec tJExpressionPointcut.java:96)
... 20 more

Even upgrading to 2.3.3.M3 didn't help.

And I found org.apache.commons.logging.impl.Log4JLogger was not in
.metadata/.plugins/org.springframework.ide.eclipse.osgi.targetdefinition/2.5.0.201008251000-M3/target/com.springsource.slf4j.org.apache.commons.logging-1.5.6.jar. That explains why the exception happens.

My project uses common-logging.properties to config log4j with this line,

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

I tried to remove the dependency of common-logging, and common-logging.properties from my maven project, and cleaned all maven projects to remove common-logging.properties from target/classes and target/test-classes.

Then everything become ok. No "Build path is incomplete" any more.

Unfortunately, I couldn't reproduce it when I put common-logging.properties back to the project, and built the maven project.

I guess common-logging.properties somehow was picked by SPRING IDE.

No comments:

Post a Comment