PDA

View Full Version : Jndi binding error



suddal72
Jan 24th, 2005, 08:48 AM
i am developing in weblogic 8.1 and i wrote like this;

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" >
<property name="jndiName">
<value>java:comp/env/jdbc/OracleDS</value>
</property>
</bean>

but it happens

situations.......

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at junit.framework.TestSuite.createTest(TestSuite.jav a:131)
at junit.framework.TestSuite.addTestMethod(TestSuite. java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.getTest(RemoteTestRunner.java:360)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:398)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in class path resource [applicationContext-datasource.xml]: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: No object bound for java:comp/jdbc/OracleDS
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:288)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:193)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:163)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:230)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:304)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:80)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at com.disc.jcf.service.BaseServiceTestCase.<clinit>(BaseServiceTestCase.java:27)
... 11 more
Caused by: javax.naming.NameNotFoundException: No object bound for java:comp/jdbc/OracleDS
at com.sun.enterprise.naming.java.javaURLContext.look up(javaURLContext.java:116)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:85)
at org.springframework.jndi.JndiObjectFactoryBean.aft erPropertiesSet(JndiObjectFactoryBean.java:59)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:275)
... 19 more

Alef Arendsen
Jan 24th, 2005, 09:20 AM
Have you correctly defined the java:comp/env/jdbc/OracleDS as a resource reference in the EJB/servlet you're using (web.xml)?