Announcement Announcement Module
Collapse
No announcement yet.
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • javax.naming.NameNotFoundException: Name java:comp is not bound in this Context

    hi all

    I have deployed my application on tomcat 5.5 and the IDE is eclipse with myeclipse plugin. when I try to start the tomcat server I get the following error:
    ERROR - ContextLoader.initWebApplicationContext(219) | Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/xaconfig/daoJPAConfig.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1412)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:546)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:871)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:423)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3669)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4104)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1012)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1012)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:450)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:409)
    Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingConte xt.java:778)
    at org.apache.naming.NamingContext.lookup(NamingConte xt.java:161)
    at javax.naming.InitialContext.lookup(InitialContext. java:392)
    at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:154)
    at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:87)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:152)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:178)
    at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:95)
    at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:105)
    at org.springframework.jndi.JndiObjectFactoryBean.loo kupWithFallback(JndiObjectFactoryBean.java:201)
    at org.springframework.jndi.JndiObjectFactoryBean.aft erPropertiesSet(JndiObjectFactoryBean.java:187)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1469)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1409)
    ... 27 more
    I have configured the datasource in Apache Software Foundation\Tomcat 5.5\conf as:
    <GlobalNamingResources>
    <Environment
    name="simpleValue"
    type="java.lang.Integer"
    value="30"/>
    <Resource
    name="jdbc/Paymentsdb"
    type="javax.sql.DataSource"
    maxActive="20"
    maxIdle="10"
    username="root"
    maxWait="20000"
    validationQuery="SELECT=1"
    driverClassName="com.mysql.jdbc.Driver"
    password="root"
    url="jdbc\:mysql\://devserver\:3306/payhub"/>
    <Resource
    auth="Container"
    description="User database that can be updated and saved"
    name="UserDatabase"
    type="org.apache.catalina.UserDatabase"
    factory="org.apache.catalina.users.MemoryUserDatab aseFactory"
    pathname="conf/tomcat-users.xml"/>
    </GlobalNamingResources>
    and i added Apache Software Foundation\Tomcat 5.5\conf\ context.xml page
    <ResourceLink global="jdbc/Paymentsdb" name="jdbc/Paymentsdb" type="javax.sql.DataSource"/>
    and i added my webInf\web.xml

    <resource-ref>
    <description>PaymentsDatabase</description>
    <res-ref-name>jdbc/Paymentsdb</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    my config.xml file is
    <beans:bean id="dataSource"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <beansroperty name="jndiName">
    <beans:value>java:comp/env/jdbc/Paymentsdb</beans:value>
    </beansroperty>
    </beans:bean>
    I am using spring framework,hybernate+jpa . Please let me know, what the problem could be?
    Last edited by maya; Nov 15th, 2010, 11:10 PM.
Working...
X