Results 1 to 4 of 4

Thread: Datasource in WebSphere 5.1

  1. #1
    Join Date
    Jul 2005
    Location
    Cuiaba/MT - Brazil
    Posts
    41

    Default 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
    Carlos Santiago
    Sun Certified Professional
    my blog: http://macjava.blogspot.com/

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    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

  3. #3
    Join Date
    Jul 2005
    Location
    Cuiaba/MT - Brazil
    Posts
    41

    Default

    OK, Juergen.
    Ok, I go to verify.
    Thank's.
    Carlos
    Carlos Santiago
    Sun Certified Professional
    my blog: http://macjava.blogspot.com/

  4. #4
    Join Date
    Aug 2005
    Posts
    3

    Default

    try to use "jdbc/LINKPECAS" as the jndi name

Similar Threads

  1. Replies: 0
    Last Post: Aug 16th, 2005, 11:23 AM
  2. Odd behaviour when injecting TransactionTemplate
    By damon311 in forum Container
    Replies: 3
    Last Post: Jul 23rd, 2005, 11:21 AM
  3. Replies: 5
    Last Post: May 4th, 2005, 10:49 PM
  4. Replies: 1
    Last Post: Oct 2nd, 2004, 09:57 AM
  5. Replies: 6
    Last Post: Aug 16th, 2004, 09:15 AM

Posting Permissions

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