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.