Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Not using JNDI but get JNDI lookup failed error!

  1. #1

    Question Not using JNDI but get JNDI lookup failed error!

    I am using Spring 3 with EclipseLink... I am in test phase with Junit testing and do not have any AS yet.

    The problem is I will connect to DB and everything was allright when I did it with Hibernate/SessionFactory, but since I am trying to use EclipseLink/EntityManagerFactory ... get strange JNDI Lookup failed error. And I am sure that I do not use any JNDI right now.

    my persistence unit in my persistence.xml file:
    HTML Code:
    <persistence-unit name="milins-domain"
    		transaction-type="RESOURCE_LOCAL">
    		<provider>
                org.eclipse.persistence.jpa.PersistenceProvider
            </provider>		<class>se.lantmateriet.milins.domain.inskrivning.IrFastighet</class>
    		<class>se.lantmateriet.milins.domain.inskrivning.GroupInfo</class>
    		<class>se.lantmateriet.milins.domain.inskrivning.FastighetUUID</class>
    	</persistence-unit>
    and my dataSource info
    HTML Code:
    	 <bean id="milinsDataSource" 
    	 class="org.springframework.jdbc.datasource.SingleConnectionDataSource" 
    	 p:driverClassName="${jdbc.driverclassname}" 
    	 p:url="${milins.jdbc.url}" 
    	 p:suppressClose="true" 
    	 p:username="${milins.jdbc.username}" 
    	 p:password="${milins.jdbc.password}"/> 
    and my EntityManagerFactory settings
    HTML Code:
    	<!-- Milins Hibernate EntityManagerFactory -->
    	<bean id="milinsEntityManagerFactory"
    		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
    		p:persistenceXmlLocation="classpath*:META-INF/persistence.xml"
    		p:dataSource-ref="milinsDataSource" p:jpaVendorAdapter-ref="jpaVendorAdapter"
    		p:persistenceUnitName="milins-domain">
    
    		<property name="jpaDialect">
    			<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />
    		</property>
    		<property name="jpaProperties">
    			<props>
    				<prop key="eclipselink.weaving">false</prop><!-- <prop key="eclipselink.ddl-generation">drop-and-create-tables</prop> 
    					<prop key="eclipselink.ddl-generation.output-mode">sql-script</prop> -->
    				<prop key="eclipselink.application-location">src/test/resources/</prop>
    				<!-- Make us participate in JBoss JTA transactions -->
    				<!-- <prop key="eclipselink.target-server">org.eclipse.persistence.platform.server.jboss.JBossPlatform</prop> -->
    			</props>
    		</property>
    	</bean>
    
    	<bean id="milinsEntityManager"
    		class="org.springframework.orm.jpa.support.SharedEntityManagerBean"
    		p:entityManagerFactory-ref="milinsEntityManagerFactory" />
    
    	<bean id="milinsTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
    		p:entityManagerFactory-ref="milinsEntityManagerFactory" />
    when I am trying to start testing .... the following error message appears
    Code:
    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
    and with more details:
    Code:
    ......
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:117)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:400)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
    	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
    	... 56 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:104)
    	at org.springframework.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:107)
    	... 61 more
    It is almost 48 hours that I have been stopped with this stupid error!
    Hope some one can help me.

  2. #2
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    286

    Default

    Can you post a single test class (that fails) with required configurations
    Amila Domingo

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Why do you use the sharedentitymanagerbean, you have the LocalEntityManagerFactoryBean and don't need the shared one... Remove it, that is the source of your problem (that is also what your stacktrace is indicating).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Maybe a bit quick to respond, can you post the FULL stacktrace... In general that is quite informative and I have the feeling that there is something missing from the stacktrace you posted.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5

    Arrow

    Quote Originally Posted by Marten Deinum View Post
    Maybe a bit quick to respond, can you post the FULL stacktrace... In general that is quite informative and I have the feeling that there is something missing from the stacktrace you posted.
    If I remove SharedEntityManager class ... the stacktrace is (i will attach the rest later ... cannot insert more than 10000 characters!)

    Code:
    2011-01-12 14:37:05,307 [main] ERROR Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@ea5461] to prepare test instance [se.lantmateriet.milins.dao.eclipselink.TestIrFastighetDaoEclipseLink@82d210] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:324)
    java.lang.IllegalStateException: Failed to load ApplicationContext
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    	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:220)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
    	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
    	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
    	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
    	at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
    	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:597)
    	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
    	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'irFastighetServices' defined in file [D:\workspace\milins\milins-data-access-layer\target\classes\se\lantmateriet\milins\servicesImpl\IrFastighetServicesImpl.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [se.lantmateriet.milins.dao.IrFastighetDao]: : Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    	... 28 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    	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:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
    	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
    	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
    	... 44 more
    ......

  6. #6

    Default

    Quote Originally Posted by Marten Deinum View Post
    Maybe a bit quick to respond, can you post the FULL stacktrace... In general that is quite informative and I have the feeling that there is something missing from the stacktrace you posted.
    and the rest without SharedEntityManager

    Code:
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:117)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:400)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
    	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
    	... 56 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:104)
    	at org.springframework.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:107)
    	... 61 more

  7. #7

    Default

    Quote Originally Posted by Marten Deinum View Post
    Maybe a bit quick to ...
    And with SharedEntityManager class:

    Code:
    java.lang.IllegalStateException: Failed to load ApplicationContext
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    	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:220)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    	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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
    	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
    	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
    	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
    	at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
    	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:597)
    	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
    	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'irFastighetServices' defined in file [D:\workspace\milins\milins-data-access-layer\target\classes\se\lantmateriet\milins\servicesImpl\IrFastighetServicesImpl.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [se.lantmateriet.milins.dao.IrFastighetDao]: : Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    	... 28 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'irFastighetDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    	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:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
    	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
    	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
    	... 44 more
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'milinsEntityManager' defined in JNDI environment: JNDI lookup 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.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:117)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:400)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
    	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
    	... 56 more
    
    ....
    the rest of stack trace comes in next post.

  8. #8

    Default

    Quote Originally Posted by Marten Deinum View Post
    Maybe a bit quick to respond, can you post the FULL stacktrace... In general that is quite informative and I have the feeling that there is something missing from the stacktrace you posted.
    Code:
    ...
    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:104)
    	at org.springframework.jndi.support.SimpleJndiBeanFactory.getBean(SimpleJndiBeanFactory.java:107)
    	... 61 more

  9. #9

    Default

    Quote Originally Posted by amiladomingo View Post
    Can you post a single test class (that fails) with required configurations
    I have send all configuration that needed. The test class for example

    Code:
    @TransactionConfiguration(transactionManager = "levfrTransactionManager", defaultRollback = false)
    @Transactional
    public class TestLevfrFastighetUuidDaoEclipseLink extends AbstractBaseTest {
    
    	@Autowired
    	LevfrFastighetUuidDao levfrFastighetUuidDao;
    
    	@Test
    	public void testGetAll() {
    
    		assertNotNull(levfrFastighetUuidDao);
    		List<LevfrFastighetUuid> fastighetUuids = levfrFastighetUuidDao
    				.getAllFastighetUUIDs();
    
    		assertNotNull(fastighetUuids);
    
    	}
    
    }
    And I am using annotation in my Daos to tel spring. As I told u before, all my codes worked with Hibernate and Session Factory .... so I guess something is wrong with my new settings with EclipseLink and EntityManagerFactory.

    Thanks for helping

  10. #10
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Can you post your full configuration and your dao...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •