• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Name is not bound in this context

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai ,,

please help me..i m using JNDI connection.. its working fine
this is working for inserting some records.. after some time i got the exception like this. i m new to this. plz help me

javax.naming.NameNotFoundException: Name java: is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)


my connection code is :..

private static Context ctx;
public static java.sql.Connection getDBConnection() {
DataSource ds;
java.sql.Connection con;

try {
if(ctx==null) ctx=new InitialContext();
ds=(DataSource)ctx.lookup(InfrastructureLayer.DATASOURCENAME);

con=ds.getConnection();
} catch(NamingException ne) {
log("InfrastructureLayer.getConnection(): ERROR: Aborting file processing. while processing header thrown NamingException:"+ne);
ne.printStackTrace();
return null;
} catch(SQLException sqle) {
log("InfrastructureLayer.getConnection(): ERROR: Aborting file processing. while processing header thrown SQLException:"+sqle);
sqle.printStackTrace();
return null;
}

return con;
}
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let us have two pieces of information.

1. What is the value of InfrastructureLayer.DATASOURCENAME.

2. Post the contents of your deployment descriptor file.
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Roger,

InfrastructureLayer.DATASOUCENAME = java:/comp/env/jdbc/mysql

whats thar deployment descriptor file where it is ???
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look for the ejb-jar.xml file. You should find an entry like this.

 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help me
this is my descriptor file....
<Resource name="jdbc/mysql" auth="Container"
type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/mysql">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://ananthan:3306/gotx?autoReconnect=true</value>
</parameter>
<parameter>
<name>username</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>50</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pleas help me roger


THIS IS MY WEB.XML


<resource-ref>
<description>Web DB</description>
<res-ref-name>jdbc/mysql</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
reply
    Bookmark Topic Watch Topic
  • New Topic