aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Spring MVC JNDI Connection pool error please help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Spring MVC JNDI Connection pool error please help me" Watch "Spring MVC JNDI Connection pool error please help me" New topic
Author

Spring MVC JNDI Connection pool error please help me

Srihari Goud
Greenhorn

Joined: Mar 11, 2014
Posts: 2
please please help me.. am getting error while creating JNDI connection pool..
my error is:
SEVERE: Servlet /empSearch_id_name threw load() exception
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context


my code:

server.xml
--------------------
<Resource name="jdbc/practice"
global="jdbc/practice"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/practice"
username="root"
password="root123"

maxActive="100"
maxIdle="20"
minIdle="5"
maxWait="10000"/>

contex.xml
----------------------
<ResourceLink name="jdbc/practice"
global="jdbc/practice"
auth="Container"
type="javax.sql.DataSource" />

applicationContex.xml
--------------------
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dbDataSource" ref="dbDataSource" />
</bean>
------------------------
daoImpl

public class EmpDAOImpl implements EmpDAO{

@Autowired
private SessionFactory sessionfactory;

@Autowired
@Qualifier("dbDataSource")
private DataSource dataSource;
public void addEmp(Employee e) {

this.sessionfactory.getCurrentSession().save(e);

}

web.xml
--------------
<resource-ref>
<description>MySQL Datasource example</description>
<res-ref-name>java:comp/env/jdbc/practice</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

Your resource link is not properly set up for your webapp context. What jndi resources have you defined in your application server ? What app server are you using ?

Srihari Goud
Greenhorn

Joined: Mar 11, 2014
Posts: 2
could you please tell me where to change code?
Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

What jndi resources have you defined in your application server ? What app server are you using ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring MVC JNDI Connection pool error please help me