You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Deepak Chadha <De...@oasistech.us> on 2006/07/17 17:33:02 UTC

Maven 2 Newbie question - trouble running tests with Spring/Log4J

Hi,
I am attempting to set up maven to compile and run my junit tests for me.

Background
- I installed maven2 successfully (meaning that I ran the built in test correctly).
- I have a project which uses Spring and Log4J
- I am able to compile my main source and my test source files
- I am not able to run my tests using "mvn test" and get the following exception.... looks like there is a problem with Spring being able to get to the Log4J configuration.  I have both the commons-logging ang log4j jars defined as dependencies in the parent pom, and have the commons-logging.properties and log4j.properties in my src/main/resources folder.

Any ideas/help would be greatly appreciated.

Regards
Deepak

*************************************************************

C:\IBM_CAIRWorkspace\ebsWebService>mvn test
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven EBS WebServices Project
[INFO]    task-segment: [test]
[INFO] ----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] While downloading springframework:spring:1.2.6
  This artifact has been relocated to org.springframework:spring:1.2.6.


[INFO] [compiler:compile]
Compiling 1 source file to C:\IBM_CAIRWorkspace\ebsWebService\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: C:\IBM_CAIRWorkspace\ebsWebService\target\surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException: com.express_scripts.ebs.model.command.C
heckinWIPCommandTest; nested exception is java.lang.ExceptionInInitializerError: null; nested except
ion is org.apache.maven.surefire.testset.TestSetFailedException: com.express_scripts.ebs.model.comma
nd.CheckinWIPCommandTest; nested exception is java.lang.ExceptionInInitializerError: null
org.apache.maven.surefire.testset.TestSetFailedException: com.express_scripts.ebs.model.command.Chec
kinWIPCommandTest; nested exception is java.lang.ExceptionInInitializerError: null
java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException: java.la
ng.reflect.InvocationTargetException
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
        at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplication
Context.java:134)
        at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplication
Context.java:166)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(Abstract
RefreshableApplicationContext.java:67)
        at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlAppli
cationContext.java:49)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApp
licationContext.java:84)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApp
licationContext.java:72)
        at com.express_scripts.ebs.model.common.EBSBeanFactory.initialize(EBSBeanFactory.java:65)
        at com.express_scripts.ebs.OutofContainerBaseTestCase.<clinit>(OutofContainerBaseTestCase.ja
va:151)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at junit.framework.TestSuite.createTest(TestSuite.java:131)
        at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
        at junit.framework.TestSuite.<init>(TestSuite.java:75)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject(JUnitTestSet.java:148)
        at org.apache.maven.surefire.junit.JUnitTestSet.getTestCount(JUnitTestSet.java:244)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirecto
ryTestSuite.java:101)
        at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:22
5)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Mon Jul 17 10:26:18 CDT 2006
[INFO] Final Memory: 5M/16M
[INFO] ------------------------------------------------------------------------

C:\IBM_CAIRWorkspace\ebsWebService>

Re: Maven 2 Newbie question - trouble running tests with Spring/Log4J

Posted by Deepak Chadha <De...@oasistech.us>.
I tried this without any luck... I am still getting the exact same 
exception.

Any other ideas?

Thanks
Deepak


----- Original Message ----- 
From: <Ma...@ubs.com>
To: <us...@maven.apache.org>; <De...@oasistech.us>
Sent: Monday, July 17, 2006 11:13 AM
Subject: RE: Maven 2 Newbie question - trouble running tests with 
Spring/Log4J


Try putting your log4j.properties in src/test/resources too.

Regards
Max


-----Original Message-----
From: Deepak Chadha [mailto:Deepak@oasistech.us]
Sent: 17 July 2006 16:33
To: users@maven.apache.org
Subject: Maven 2 Newbie question - trouble running tests with
Spring/Log4J


Hi,
I am attempting to set up maven to compile and run my junit tests for
me.

Background
- I installed maven2 successfully (meaning that I ran the built in test
correctly).
- I have a project which uses Spring and Log4J
- I am able to compile my main source and my test source files
- I am not able to run my tests using "mvn test" and get the following
exception.... looks like there is a problem with Spring being able to
get to the Log4J configuration.  I have both the commons-logging ang
log4j jars defined as dependencies in the parent pom, and have the
commons-logging.properties and log4j.properties in my src/main/resources
folder.

Any ideas/help would be greatly appreciated.

Regards
Deepak

*************************************************************

C:\IBM_CAIRWorkspace\ebsWebService>mvn test [INFO] Scanning for
projects...
[INFO]
------------------------------------------------------------------------
----
[INFO] Building Maven EBS WebServices Project
[INFO]    task-segment: [test]
[INFO]
------------------------------------------------------------------------
----
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] While downloading springframework:spring:1.2.6
  This artifact has been relocated to org.springframework:spring:1.2.6.


[INFO] [compiler:compile]
Compiling 1 source file to
C:\IBM_CAIRWorkspace\ebsWebService\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date [INFO]
[surefire:test] [INFO] Surefire report directory:
C:\IBM_CAIRWorkspace\ebsWebService\target\surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException:
com.express_scripts.ebs.model.command.C
heckinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null; nested except ion is
org.apache.maven.surefire.testset.TestSetFailedException:
com.express_scripts.ebs.model.comma
nd.CheckinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null
org.apache.maven.surefire.testset.TestSetFailedException:
com.express_scripts.ebs.model.command.Chec
kinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null
java.lang.ExceptionInInitializerError:
org.apache.commons.logging.LogConfigurationException: java.la
ng.reflect.InvocationTargetException
        at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:532)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:272)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:246)
        at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
        at
org.springframework.context.support.AbstractApplicationContext.<init>(Ab
stractApplication
Context.java:134)
        at
org.springframework.context.support.AbstractApplicationContext.<init>(Ab
stractApplication
Context.java:166)
        at
org.springframework.context.support.AbstractRefreshableApplicationContex
t.<init>(Abstract
RefreshableApplicationContext.java:67)
        at
org.springframework.context.support.AbstractXmlApplicationContext.<init>
(AbstractXmlAppli
cationContext.java:49)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApp
licationContext.java:84)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApp
licationContext.java:72)
        at
com.express_scripts.ebs.model.common.EBSBeanFactory.initialize(EBSBeanFa
ctory.java:65)
        at
com.express_scripts.ebs.OutofContainerBaseTestCase.<clinit>(OutofContain
erBaseTestCase.ja
va:151)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at junit.framework.TestSuite.createTest(TestSuite.java:131)
        at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
        at junit.framework.TestSuite.<init>(TestSuite.java:75)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at
org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject(JUnitTe
stSet.java:148)
        at
org.apache.maven.surefire.junit.JUnitTestSet.getTestCount(JUnitTestSet.j
ava:244)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSet
s(AbstractDirecto
ryTestSuite.java:101)
        at
org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.ja
va:147)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
ireBooter.java:22
5)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
:747)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch [INFO]
------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Mon Jul 17 10:26:18 CDT 2006 [INFO] Final Memory:
5M/16M [INFO]
------------------------------------------------------------------------

C:\IBM_CAIRWorkspace\ebsWebService>

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Maven 2 Newbie question - trouble running tests with Spring/Log4J

Posted by Ma...@ubs.com.
Try putting your log4j.properties in src/test/resources too.

Regards
Max


-----Original Message-----
From: Deepak Chadha [mailto:Deepak@oasistech.us] 
Sent: 17 July 2006 16:33
To: users@maven.apache.org
Subject: Maven 2 Newbie question - trouble running tests with
Spring/Log4J


Hi,
I am attempting to set up maven to compile and run my junit tests for
me.

Background
- I installed maven2 successfully (meaning that I ran the built in test
correctly).
- I have a project which uses Spring and Log4J
- I am able to compile my main source and my test source files
- I am not able to run my tests using "mvn test" and get the following
exception.... looks like there is a problem with Spring being able to
get to the Log4J configuration.  I have both the commons-logging ang
log4j jars defined as dependencies in the parent pom, and have the
commons-logging.properties and log4j.properties in my src/main/resources
folder.

Any ideas/help would be greatly appreciated.

Regards
Deepak

*************************************************************

C:\IBM_CAIRWorkspace\ebsWebService>mvn test [INFO] Scanning for
projects...
[INFO]
------------------------------------------------------------------------
----
[INFO] Building Maven EBS WebServices Project
[INFO]    task-segment: [test]
[INFO]
------------------------------------------------------------------------
----
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] While downloading springframework:spring:1.2.6
  This artifact has been relocated to org.springframework:spring:1.2.6.


[INFO] [compiler:compile]
Compiling 1 source file to
C:\IBM_CAIRWorkspace\ebsWebService\target\classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date [INFO]
[surefire:test] [INFO] Surefire report directory:
C:\IBM_CAIRWorkspace\ebsWebService\target\surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException:
com.express_scripts.ebs.model.command.C
heckinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null; nested except ion is
org.apache.maven.surefire.testset.TestSetFailedException:
com.express_scripts.ebs.model.comma
nd.CheckinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null
org.apache.maven.surefire.testset.TestSetFailedException:
com.express_scripts.ebs.model.command.Chec
kinWIPCommandTest; nested exception is
java.lang.ExceptionInInitializerError: null
java.lang.ExceptionInInitializerError:
org.apache.commons.logging.LogConfigurationException: java.la
ng.reflect.InvocationTargetException
        at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:532)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:272)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:246)
        at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
        at
org.springframework.context.support.AbstractApplicationContext.<init>(Ab
stractApplication
Context.java:134)
        at
org.springframework.context.support.AbstractApplicationContext.<init>(Ab
stractApplication
Context.java:166)
        at
org.springframework.context.support.AbstractRefreshableApplicationContex
t.<init>(Abstract
RefreshableApplicationContext.java:67)
        at
org.springframework.context.support.AbstractXmlApplicationContext.<init>
(AbstractXmlAppli
cationContext.java:49)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApp
licationContext.java:84)
        at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApp
licationContext.java:72)
        at
com.express_scripts.ebs.model.common.EBSBeanFactory.initialize(EBSBeanFa
ctory.java:65)
        at
com.express_scripts.ebs.OutofContainerBaseTestCase.<clinit>(OutofContain
erBaseTestCase.ja
va:151)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at junit.framework.TestSuite.createTest(TestSuite.java:131)
        at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
        at junit.framework.TestSuite.<init>(TestSuite.java:75)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at
org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject(JUnitTe
stSet.java:148)
        at
org.apache.maven.surefire.junit.JUnitTestSet.getTestCount(JUnitTestSet.j
ava:244)
        at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSet
s(AbstractDirecto
ryTestSuite.java:101)
        at
org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.ja
va:147)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
ireBooter.java:22
5)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
:747)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch [INFO]
------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Mon Jul 17 10:26:18 CDT 2006 [INFO] Final Memory:
5M/16M [INFO]
------------------------------------------------------------------------

C:\IBM_CAIRWorkspace\ebsWebService>

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org