You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by laredotornado <la...@gmail.com> on 2012/08/31 16:35:12 UTC

Confusion about InitialContexts with my Spring JUnit test

Hi,

I'm using OpenEJB 4.0.0, Spring 3.1.0.RELEASE, and JUnit 4.8.1.  I'm trying
to test a Spring controller that attempts to get an EJB from JNDI …

		final Context context = new InitialContext();
		Object myprojectStandardMgrHomeObj = context.lookup(
"MyProjectStandardManager" );
		final Object remoteObj =
PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
MyProjectStandardManagerHome.class );
		final MyProjectStandardManagerHome myprojectStdMgrHome =
(MyProjectStandardManagerHome)
PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
MyProjectStandardManagerHome.class );
		        
but I'm confused about InitialContexts.  In JUnit, I've added the JAR files
that contain my ejb-jar.xml's to OpenEJB …

	@BeforeClass
	public static void setupBeforeClass() throws NamingException,
CreateException, IOException {
		final Properties p = new Properties();
		p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
		p.setProperty("openejb.deployments.classpath.include", ".*\\.jar");
		final InitialContext initialContext = new InitialContext(p);
		Enumeration<URL> ejbJars =
AbstractCorrelationsTest.class.getClassLoader().getResources("META-INF/ejb-jar.xml");
		while (ejbJars.hasMoreElements()) {
			URL url = ejbJars.nextElement();
			System.out.println("app = " + url);
		}	// while
	} // setupBeforeClass

but Spring doesn't seem to see them when it tries to initialize its context. 
It dies with the exception, "Error creating bean with name 'standardManager'
defined in URL [jar:file:/path/to/xml/file.xml]: Invocation of init method
failed; nested exception is javax.naming.NoInitialContextException: Need to
specify class name in environment or system property, or as an applet
parameter, or in an application resource file: 
java.naming.factory.initial".  How do I make OpenEJB create the EJBs in the
same context as which Spring is looking?

Thanks, - Dave


ps - The complete exception I'm seeing is …

ERROR [main] (TestContextManager.java:324) - Caught exception while allowing
TestExecutionListener
[org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1901b54e]
to prepare test instance
[org.mainco.correlations.controller.StandardsUploadControllerTest@3f2620b5]
java.lang.IllegalStateException: Failed to load ApplicationContext
	at
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
	at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
	at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at
org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'skillUrlMappings' defined in class path resource
[myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'myprojectGetAvailableStandardSetsForProductController' defined in
class path resource
[myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
resolve reference to bean 'standardManager' while setting bean property
'standardManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'standardManager' defined in URL
[jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
Invocation of init method failed; nested exception is
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
	at
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
	at
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
	at
org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
	at
org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
	at
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
	... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'myprojectGetAvailableStandardSetsForProductController' defined in class
path resource
[myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
resolve reference to bean 'standardManager' while setting bean property
'standardManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'standardManager' defined in URL
[jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
Invocation of init method failed; nested exception is
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
	at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
	at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
	at
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:286)
	at
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
	at
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
	at
org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
	at
org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
	at
org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
	at
org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
	at
org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	... 38 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'standardManager' defined in URL
[jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
Invocation of init method failed; nested exception is
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 59 more
Caused by: javax.naming.NoInitialContextException: Need to specify class
name in environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at
org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
	at
org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
	at
org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
	at
org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:100)
	at
org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122)
	at
org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.refreshHome(SimpleRemoteSlsbInvokerInterceptor.java:163)
	at
org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109)
	at
org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean.afterPropertiesSet(SimpleRemoteStatelessSessionProxyFactoryBean.java:100)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
	... 66 more




--
View this message in context: http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Do you have a short example to share (kinda Hello Worldline)?
I already made that working few month ago so it should a matter of
configuration.

Jean-Louis

2012/8/31 laredotornado <la...@gmail.com>

> Hi,
>
> I'm using OpenEJB 4.0.0, Spring 3.1.0.RELEASE, and JUnit 4.8.1.  I'm trying
> to test a Spring controller that attempts to get an EJB from JNDI …
>
>                 final Context context = new InitialContext();
>                 Object myprojectStandardMgrHomeObj = context.lookup(
> "MyProjectStandardManager" );
>                 final Object remoteObj =
> PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
> MyProjectStandardManagerHome.class );
>                 final MyProjectStandardManagerHome myprojectStdMgrHome =
> (MyProjectStandardManagerHome)
> PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
> MyProjectStandardManagerHome.class );
>
> but I'm confused about InitialContexts.  In JUnit, I've added the JAR files
> that contain my ejb-jar.xml's to OpenEJB …
>
>         @BeforeClass
>         public static void setupBeforeClass() throws NamingException,
> CreateException, IOException {
>                 final Properties p = new Properties();
>                 p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
>                 p.setProperty("openejb.deployments.classpath.include",
> ".*\\.jar");
>                 final InitialContext initialContext = new
> InitialContext(p);
>                 Enumeration<URL> ejbJars =
>
> AbstractCorrelationsTest.class.getClassLoader().getResources("META-INF/ejb-jar.xml");
>                 while (ejbJars.hasMoreElements()) {
>                         URL url = ejbJars.nextElement();
>                         System.out.println("app = " + url);
>                 }       // while
>         } // setupBeforeClass
>
> but Spring doesn't seem to see them when it tries to initialize its
> context.
> It dies with the exception, "Error creating bean with name
> 'standardManager'
> defined in URL [jar:file:/path/to/xml/file.xml]: Invocation of init method
> failed; nested exception is javax.naming.NoInitialContextException: Need to
> specify class name in environment or system property, or as an applet
> parameter, or in an application resource file:
> java.naming.factory.initial".  How do I make OpenEJB create the EJBs in the
> same context as which Spring is looking?
>
> Thanks, - Dave
>
>
> ps - The complete exception I'm seeing is …
>
> ERROR [main] (TestContextManager.java:324) - Caught exception while
> allowing
> TestExecutionListener
>
> [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1901b54e
> ]
> to prepare test instance
> [org.mainco.correlations.controller.StandardsUploadControllerTest@3f2620b5
> ]
> java.lang.IllegalStateException: Failed to load ApplicationContext
>         at
>
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
>         at
>
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
>         at
>
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
>         at
>
> org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
>         at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
>         at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>         at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>         at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>         at
>
> org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>         at
>
> org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
>         at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>         at
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'skillUrlMappings' defined in class path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]:
> Initialization of bean failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'myprojectGetAvailableStandardSetsForProductController' defined
> in
> class path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
> resolve reference to bean 'standardManager' while setting bean property
> 'standardManager'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
>         at
>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
>         at
>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
>         at
>
> org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
>         at
>
> org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
>         at
>
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
>         ... 25 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name
> 'myprojectGetAvailableStandardSetsForProductController' defined in class
> path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
> resolve reference to bean 'standardManager' while setting bean property
> 'standardManager'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
>         at
>
> org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:286)
>         at
>
> org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
>         at
>
> org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
>         at
>
> org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
>         at
>
> org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
>         at
>
> org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
>         at
>
> org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
>         at
>
> org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>         ... 38 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
>         ... 59 more
> Caused by: javax.naming.NoInitialContextException: Need to specify class
> name in environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
>         at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at
> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
>         at javax.naming.InitialContext.lookup(InitialContext.java:392)
>         at
> org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
>         at
> org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
>         at
> org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
>         at
> org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
>         at
>
> org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
>         at
>
> org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
>         at
>
> org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:100)
>         at
>
> org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122)
>         at
>
> org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.refreshHome(SimpleRemoteSlsbInvokerInterceptor.java:163)
>         at
>
> org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109)
>         at
>
> org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean.afterPropertiesSet(SimpleRemoteStatelessSessionProxyFactoryBean.java:100)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
>         ... 66 more
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by laredotornado <la...@gmail.com>.
Thanks, that solved it. - Dave



--
View this message in context: http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657246.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Something like that ...

<jee:jndi-lookup id="myBean"  jndi-name="MyProjectStandardManager">
    <jee:environment>
        java.naming.factory.initial = org.apache.openejb.....
    </jee:environment>
</jee:jndi-lookup>

2012/9/3 Romain Manni-Bucau <rm...@gmail.com>

>
> http://static.springsource.org/spring/docs/2.0.x/reference/xsd-config.htmljee:jndi-lookup
> with environment or specify A jnditemplate with custom
> properties in the proxy
> Le 3 sept. 2012 16:18, "laredotornado" <la...@gmail.com> a écrit :
>
> > Could you provide an example of what you're talking about?  I'm not quite
> > grasping what you're saying.
> >
> > Thanks, - Dave
> >
> >
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657240.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Romain Manni-Bucau <rm...@gmail.com>.
http://static.springsource.org/spring/docs/2.0.x/reference/xsd-config.htmljee:jndi-lookup
with environment or specify A jnditemplate with custom
properties in the proxy
Le 3 sept. 2012 16:18, "laredotornado" <la...@gmail.com> a écrit :

> Could you provide an example of what you're talking about?  I'm not quite
> grasping what you're saying.
>
> Thanks, - Dave
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657240.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by laredotornado <la...@gmail.com>.
Could you provide an example of what you're talking about?  I'm not quite
grasping what you're saying.

Thanks, - Dave



--
View this message in context: http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657240.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I think you need to set a custom jnditemplate. Personally i used jee
namespace, thats easier
Le 31 août 2012 22:22, "laredotornado" <la...@gmail.com> a écrit :

> Hi,
>
> I am using jee:lookup, at least I think so.  We use a "jndiName" property
> in
> the Spring application context file.  Here's the declaration in that file
> ...
>
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE beans PUBLIC &quot;-//SPRING//DTD BEAN//EN&quot;
> &quot;http://www.springframework.org/dtd/spring-beans.dtd&quot;>
>
> ===================== Begin spring context snippet
> ===========================
> <beans>
>         …
>         <bean
>
> class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"
> lazy-init="true" singleton="true" id="standardManager">
>                 <property name="jndiName">
>                         <value>MyProjectStandardManager</value>
>                 </property>
>                 <property name="businessInterface">
>
> <value>myprojectx.skills.MyProjectStandardManager_IF</value>
>                 </property>
>         </bean>
>         <alias alias="MyProjectStandardManager" name="standardManager"/>
> </beans>
> ===================== End Spring context snippet
> ===========================
>
>
> And here's how we declare the bean in the ejb-jar.xml file.  I have
> verified
> through debugging that OpenEJB is including this file in the classpath.  So
> I'm not sure what to troubleshoot next, other than the fact that maybe
> OpenEJB is inserting things in a context that Spring isn't using:
>
>
> ===================== Begin ejb-jar.xml file ===========================
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE ejb-jar PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Enterprise
> JavaBeans 2.0//EN&quot; &quot;http://java.sun.com/dtd/ejb-jar_2_0.dtd&quot
> ;>
>
> <ejb-jar id="ejb-jar_1">
>    <description></description>
>    <display-name>Generated by XDoclet</display-name>
>    <enterprise-beans>
>
>
>       <session id="Session_MyProjectStandardManager">
>          <description></description>
>          <ejb-name>MyProjectStandardManager</ejb-name>
>          <home>myprojectx.skills.MyProjectStandardManagerHome</home>
>          <remote>myprojectx.skills.MyProjectStandardManager</remote>
>
>
> <local-home>myprojectx.skills.MyProjectStandardManagerLocalHome</local-home>
>          <local>myprojectx.skills.MyProjectStandardManagerLocal</local>
>
> <ejb-class>myprojectx.skills.MyProjectStandardManagerEJB</ejb-class>
>          <session-type>Stateless</session-type>
>          <transaction-type>Container</transaction-type>
>       </session>
>         …
> </ejb-jar>
> ===================== End ejb-jar.xml file ===========================
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657204.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by laredotornado <la...@gmail.com>.
Hi,

I am using jee:lookup, at least I think so.  We use a "jndiName" property in
the Spring application context file.  Here's the declaration in that file
...


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE beans PUBLIC &quot;-//SPRING//DTD BEAN//EN&quot;
&quot;http://www.springframework.org/dtd/spring-beans.dtd&quot;>

===================== Begin spring context snippet
===========================
<beans>
	…
	<bean
class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"
lazy-init="true" singleton="true" id="standardManager">
		<property name="jndiName">
			<value>MyProjectStandardManager</value>
		</property>
		<property name="businessInterface">
			<value>myprojectx.skills.MyProjectStandardManager_IF</value>
		</property>
	</bean>
	<alias alias="MyProjectStandardManager" name="standardManager"/>
</beans>
===================== End Spring context snippet ===========================


And here's how we declare the bean in the ejb-jar.xml file.  I have verified
through debugging that OpenEJB is including this file in the classpath.  So
I'm not sure what to troubleshoot next, other than the fact that maybe
OpenEJB is inserting things in a context that Spring isn't using:


===================== Begin ejb-jar.xml file ===========================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN&quot; &quot;http://java.sun.com/dtd/ejb-jar_2_0.dtd&quot;>

<ejb-jar id="ejb-jar_1">
   <description></description>
   <display-name>Generated by XDoclet</display-name>
   <enterprise-beans>

      
      <session id="Session_MyProjectStandardManager">
         <description></description>
         <ejb-name>MyProjectStandardManager</ejb-name>
         <home>myprojectx.skills.MyProjectStandardManagerHome</home>
         <remote>myprojectx.skills.MyProjectStandardManager</remote>
        
<local-home>myprojectx.skills.MyProjectStandardManagerLocalHome</local-home>
         <local>myprojectx.skills.MyProjectStandardManagerLocal</local>
        
<ejb-class>myprojectx.skills.MyProjectStandardManagerEJB</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
      </session>
	…
</ejb-jar>
===================== End ejb-jar.xml file ===========================




--
View this message in context: http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657204.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Romain Manni-Bucau <rm...@gmail.com>.
You dont use jee:lookup of speing?
Le 31 août 2012 20:41, "laredotornado" <la...@gmail.com> a écrit :

> Hi, To what properties are you referring?  Also where am I adding
> properties?
> - Dave
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657198.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by laredotornado <la...@gmail.com>.
Hi, To what properties are you referring?  Also where am I adding properties?
- Dave



--
View this message in context: http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188p4657198.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Confusion about InitialContexts with my Spring JUnit test

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Add these properties in spring lookup (only needed in embedded, not tomee)
Le 31 août 2012 16:38, "laredotornado" <la...@gmail.com> a écrit :

> Hi,
>
> I'm using OpenEJB 4.0.0, Spring 3.1.0.RELEASE, and JUnit 4.8.1.  I'm trying
> to test a Spring controller that attempts to get an EJB from JNDI …
>
>                 final Context context = new InitialContext();
>                 Object myprojectStandardMgrHomeObj = context.lookup(
> "MyProjectStandardManager" );
>                 final Object remoteObj =
> PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
> MyProjectStandardManagerHome.class );
>                 final MyProjectStandardManagerHome myprojectStdMgrHome =
> (MyProjectStandardManagerHome)
> PortableRemoteObject.narrow(myprojectStandardMgrHomeObj,
> MyProjectStandardManagerHome.class );
>
> but I'm confused about InitialContexts.  In JUnit, I've added the JAR files
> that contain my ejb-jar.xml's to OpenEJB …
>
>         @BeforeClass
>         public static void setupBeforeClass() throws NamingException,
> CreateException, IOException {
>                 final Properties p = new Properties();
>                 p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
>                 p.setProperty("openejb.deployments.classpath.include",
> ".*\\.jar");
>                 final InitialContext initialContext = new
> InitialContext(p);
>                 Enumeration<URL> ejbJars =
>
> AbstractCorrelationsTest.class.getClassLoader().getResources("META-INF/ejb-jar.xml");
>                 while (ejbJars.hasMoreElements()) {
>                         URL url = ejbJars.nextElement();
>                         System.out.println("app = " + url);
>                 }       // while
>         } // setupBeforeClass
>
> but Spring doesn't seem to see them when it tries to initialize its
> context.
> It dies with the exception, "Error creating bean with name
> 'standardManager'
> defined in URL [jar:file:/path/to/xml/file.xml]: Invocation of init method
> failed; nested exception is javax.naming.NoInitialContextException: Need to
> specify class name in environment or system property, or as an applet
> parameter, or in an application resource file:
> java.naming.factory.initial".  How do I make OpenEJB create the EJBs in the
> same context as which Spring is looking?
>
> Thanks, - Dave
>
>
> ps - The complete exception I'm seeing is …
>
> ERROR [main] (TestContextManager.java:324) - Caught exception while
> allowing
> TestExecutionListener
>
> [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1901b54e
> ]
> to prepare test instance
> [org.mainco.correlations.controller.StandardsUploadControllerTest@3f2620b5
> ]
> java.lang.IllegalStateException: Failed to load ApplicationContext
>         at
>
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
>         at
>
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
>         at
>
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
>         at
>
> org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
>         at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
>         at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>         at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>         at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>         at
>
> org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>         at
>
> org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>         at
>
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
>         at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>         at
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>         at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'skillUrlMappings' defined in class path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]:
> Initialization of bean failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'myprojectGetAvailableStandardSetsForProductController' defined
> in
> class path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
> resolve reference to bean 'standardManager' while setting bean property
> 'standardManager'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
>         at
>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
>         at
>
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
>         at
>
> org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
>         at
>
> org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
>         at
>
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
>         ... 25 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name
> 'myprojectGetAvailableStandardSetsForProductController' defined in class
> path resource
> [myprojectx/skills/controller/MyProjectSkillControllers.cfg.xml]: Cannot
> resolve reference to bean 'standardManager' while setting bean property
> 'standardManager'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
>         at
>
> org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:286)
>         at
>
> org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:129)
>         at
>
> org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:104)
>         at
>
> org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
>         at
>
> org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:72)
>         at
>
> org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
>         at
>
> org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:117)
>         at
>
> org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:92)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>         ... 38 more
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'standardManager' defined in URL
>
> [jar:file:/Users/davea/.m2/repository/myproject/jars/myproject-skills-impl/4.2-SNAPSHOT/myproject-skills-impl-4.2-SNAPSHOT.jar!/_module_config/managers/proxies.remote.COMMON.xml]:
> Invocation of init method failed; nested exception is
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
>         at
>
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
>         ... 59 more
> Caused by: javax.naming.NoInitialContextException: Need to specify class
> name in environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>         at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
>         at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at
> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
>         at javax.naming.InitialContext.lookup(InitialContext.java:392)
>         at
> org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
>         at
> org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
>         at
> org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
>         at
> org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
>         at
>
> org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
>         at
>
> org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
>         at
>
> org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:100)
>         at
>
> org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122)
>         at
>
> org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.refreshHome(SimpleRemoteSlsbInvokerInterceptor.java:163)
>         at
>
> org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109)
>         at
>
> org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean.afterPropertiesSet(SimpleRemoteStatelessSessionProxyFactoryBean.java:100)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
>         ... 66 more
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Confusion-about-InitialContexts-with-my-Spring-JUnit-test-tp4657188.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>