Announcement Announcement Module
Collapse
No announcement yet.
Datasource in WebSphere 5.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Datasource in WebSphere 5.1

    Would like to know as to get one datasource with WebSphere 5,1 sp1? Currently I am using:
    Code:
    	<!-- JNDI DataSource -->
    	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java&#58;comp/env/jdbc/LINKPECAS"/>
    	</bean>
    
    	<!-- associa um template a um data source -->
    	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    		<property name="dataSource">
    			<ref bean="dataSource"/>
    		</property>
    	</bean>
    But it does not function.

    [8/1/05 14:57:42:599 CDT] 79978418 DefaultListab I
    org.springframework.beans.factory.support.DefaultL istableBeanFactory Destr
    oying singletons in factory
    {org.springframework.beans.factory.support.Default ListableBeanFactory
    defining beans [propertyConf
    igurer,dataSource,jdbcTemplate,pedidosDAO,usuarioD AO,trocaSenhaDAO,loginControlador,trocaSenhaContro lador,linkPecasControlador
    ,pedidosAutorizadosControlador,methodNameResolver, urlMapping,messageSource,viewResolver,exceptionRes olver,pedidosAutorizados,usuario,trocaSenha,pedido sAutorizadosValidacao,usuarioValidacao,trocaSenhaV alidacao];
    root of BeanFactory hierarchy}

    [8/1/05 14:57:42:609 CDT] 79978418 ContextLoader E
    org.springframework.web.context.ContextLoader Context initialization
    failed

    [8/1/05 14:57:42:702 CDT] 79978418 ContextLoader E
    org.springframework.web.context.ContextLoader TRAS0014I: The following exc
    eption was logged org.springframework.beans.factory.BeanCreationExce ption:
    Error creating bean with name 'dataSource' defined
    in ServletContext resource [/WEB-INF/linkPecas-configJDBC.xml]:
    Initialization of bean failed; nested exception is javax.namin
    g.NameNotFoundException: Name comp/env/jdbc not found in context
    "java:".javax.naming.NameNotFoundException: Name comp/env/jdbc not found in
    context "java:".
    at
    com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInt ernal(NameSpace.java(Compiled
    Code))
    at
    com.ibm.ws.naming.ipbase.NameSpace.lookupInternal( NameSpace.java(Compiled
    Code))
    at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpac e.java(Inlined
    Compiled Code))
    at
    com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(Ur lContextImpl.java(Compiled
    Code))
    at
    com.ibm.ws.naming.java.javaURLContextRoot.lookup(j avaURLContextRoot.java(Compiled
    Code))
    at
    com.ibm.ws.naming.java.javaURLContextRoot.lookup(j avaURLContextRoot.java(Compiled
    Code))
    at javax.naming.InitialContext.lookup(InitialContext. java(Compiled
    Code))
    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)
    Thank's.
    Carlos

  • #2
    Well, this looks like the JNDI lookup is failing because there is no object bound at the specified JNDI location. Check your JNDI setup and how WebSphere handles JNDI naming.

    Essentially, if you can code a plain "new InitialContext().lookup(...)" call that works, Spring's JndiObjectFactoryBean will work for the same JNDI name too. It's really about a working a JNDI environment.

    Juergen

    Comment


    • #3
      OK, Juergen.
      Ok, I go to verify.
      Thank's.
      Carlos

      Comment


      • #4
        try to use "jdbc/LINKPECAS" as the jndi name

        Comment

        Working...
        X