Dear List,
I have a cocoon project that I am building with Maven 2. The project
consists of a parent project, a sub-project containing the content, a
sub-project for Cocoon-specific classes, and a sub-project containing
Spring Framework DAO's. All tests pass using the Eclipse JUnit test
runner. The Spring tests also pass when run from the command line with
'mvn test'. The tests for the Cocoon-specific classes fail with the
following error when run from the command line:
<error type="java.lang.IllegalStateException" message="Cannot activate
SimpleNamingContextBuilder: there is already a JNDI provider registered.
Note that JNDI is a JVM-wide service, shared at the JVM system class loader
level, with no reset option. As a consequence, a JNDI provider must only be
registered once per JVM.">java.lang.IllegalStateException: Cannot activate
SimpleNamingContextBuilder: there is already a JNDI provider registered.
Note that JNDI is a JVM-wide service, shared at the JVM system class loader
level, with no reset option. As a consequence, a JNDI provider must only be
registered once per JVM. at
org.springframework.mock.jndi.SimpleNamingContextBuilder.activate(SimpleNamingContextBuilder.java:135)
at
org.springframework.mock.jndi.SimpleNamingContextBuilder.emptyActivatedContextBuilder(SimpleNamingContextBuilder.java:113)
at
com.jpmchase.dcs.sarc.cocoon.actions.ReadChildOrganizationsActionTestCase.setUp(ReadChildOrganizationsActionTestCase.java:24)
at junit.framework.TestCase.runBare(TestCase.java:125) at
junit.framework.TestResult$1.protect(TestResult.java:106) at
junit.framework.TestResult.runProtected(TestResult.java:124) at
junit.framework.TestResult.run(TestResult.java:109) at
junit.framework.TestCase.run(TestCase.java:118) at
junit.framework.TestSuite.runTest(TestSuite.java:208) at
junit.framework.TestSuite.run(TestSuite.java:203) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at
org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:242)
at
org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:216)
at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:215) at
org.apache.maven.surefire.Surefire.run(Surefire.java:163) at
org.apache.maven.surefire.Surefire.run(Surefire.java:87) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at
org.apache.maven.surefire.SurefireBooter.runTestsInProcess(SurefireBooter.java:285)
at org.apache.maven.surefire.SurefireBooter.run(SurefireBooter.java:201)
at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:366) at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:249) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585) at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at
org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at
org.codehaus.classworlds.Launcher.main(Launcher.java:375)</error>
This is the code that appears to be triggering the error:
protected void setUp() throws Exception {
super.setUp();
// setup JNDI data source
SimpleNamingContextBuilder builder =
SimpleNamingContextBuilder.emptyActivatedContextBuilder();
DataSource ds =
new SingleConnectionDataSource(
"oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@//hostname:1521/serviceName",
"xxx", "xxx", true);
builder.bind("java:comp/env/jdbc/serviceName", ds);
}
Note that this same code is executed within the tests for the Spring
Framework DAO's without issue.
Has anyone else run into this (or a similiar) problem?
Thanks,
Ian
It's better to be hated for who you are
than loved for who you are not
Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]