Resource injection in DAO?

I use a Data Acces Object pattern in a Java EE 5 Web-Tier Application.
The servlets (and JSP) in the front-end call a separate object that that hides the implementation of accessing data in the databases and maintains the connection to databases.
Can I use the new Resource Injection annotations to simplify the JNDI and DataSoucce code in my DAO class?
I have read that Resource Injection only works in Container managed objects like Servlets (but not in JSP which can be complied after deployment).
Can you point me to a runnable sample application that uses Resource Injection to simplify the JNDI and DataSoucre code?

Sample Application Listener
package com.eshop.web;
import com.eshop.biz.DBAccessor;
import com.eshop.biz.ShoppingCart;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
* @author Aliyu Musa
* @version
* Web application lifecycle listener.
public class ShopListener implements ServletContextListener, HttpSessionListener {
@PersistenceUnit(name="e-unit")
private EntityManagerFactory emf;
* ### Method from ServletContextListener ###
* Called when a Web application is first ready to process requests
* (i.e. on Web server startup and when a context is added or reloaded).
* For example, here might be database connections established
* and added to the servlet context attributes.
public void contextInitialized(ServletContextEvent evt) {   
DBAccessor db=new DBAccessor(emf);
evt.getServletContext().setAttribute("db",db);
* ### Method from ServletContextListener ###
* Called when a Web application is about to be shut down
* (i.e. on Web server shutdown or when a context is removed or reloaded).
* Request handling will be stopped before this method is called.
* For example, the database connections can be closed here.
public void contextDestroyed(ServletContextEvent evt) {
// TODO add your code here e.g.:
Connection con = (Connection) e.getServletContext().getAttribute("con");
try { con.close(); } catch (SQLException ignored) { } // close connection
* ### Method from HttpSessionListener ###
* Called when a session is created.
public void sessionCreated(HttpSessionEvent evt) {
ShoppingCart cart=new ShoppingCart();
evt.getSession().setAttribute("cart",cart);
evt.getSession().setMaxInactiveInterval(10*60*60);
* ### Method from HttpSessionListener ###
* Called when a session is destroyed(invalidated).
public void sessionDestroyed(HttpSessionEvent evt) {
evt.getSession().invalidate();
}

Similar Messages

  • Resource Injection Annotation

    Hey All,
    I am experiencing an issue with the @Resource Injection annotation.
    Following is attached my code from my class. QueueConnectionFactory is null.
    Wierdly enough when I copy over this code and @Resource Injection in an MDB it works fine!
    Any ideas of why this might be.
    I am using WLS 10.3.5
    @Stateless
    public class dummysFriend implements dummysFriendRemote, dummysFriendLocal{
         @Resource(name = "ConnectionFactory-0",
         mappedName = "jms/connectionFactory",
         description = "Connection Factory for WLS")
         private QueueConnectionFactory connectionFactory;
         @Resource(name = "DistributedQueue-3",
         mappedName = "jms/provisionASDLQueue",
         description = "Queue which holds tokenized ASDL(s) for provision")
    private Queue provisionASDLQueue;
    private QueueConnection queueConnection = null;
    private QueueSession queueSession = null;
    private QueueSender queueSender = null;
    public dummysFriend() {
    // TODO Auto-generated constructor stub
    @PostConstruct
    public void initialize(){
    try {
              queueConnection = connectionFactory.createQueueConnection();
              queueSession = queueConnection.createQueueSession(true,
                             Session.AUTO_ACKNOWLEDGE);
              queueSender = queueSession.createSender(provisionASDLQueue);
              MapMessage message = queueSession.createMapMessage();
         message.setString("ASDL", "123");
         message.setString("Token", "456");
         // Sending message to queue
         System.out.println("Sending Message");
         queueSender.send(message);
         // Closing connections
         queueSender.close();
         queueSession.close();
         queueConnection.close();
    } catch (JMSException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    }

    I am experiencing an issue with the @Resource Injection annotation. Can you post what the issue is that you are seeing?
    -steve-

  • JSFWARNING: JSF1033: Resource injection is DISABLED.

    Anyone else have this problem using the JSF 1.2 implementation bundled with Weblogic 10?
    JSFWARNING: JSF1033: Resource injection is DISABLED.
    At start-up I get the warning and dependency injection doesn't work in backing-beans, etc.
    I've checked the various config files for compliance and everything seems to look good.
    Thanks.

    Well according to:
    http://e-docs.bea.com/wls/docs100/webapp/annotateservlet.html
    JSF backing-beans aren't one of the supported types.
    However according to the JEE5 spec they are.
    I guess Weblogic 10 isn't fully JEE5 compliant, even though it's passed certification. :_|

  • Resource Injection in Web Tier (JSP and Servlets)

    Hi All
    I was wondering whether someone will be kind enough enough to clear this up for me as it causing me some confusion. I am using OC4J 10.1.3.4 and Java 5. I have been reading the documentation on OC4J and at one point it says that OC4J does not support resource injection(i.e. annotations) in the web tier and you'll have to use JNDI to access resources such as EJBs from the Web tier(see Sub heading Servlet or JSP Client on http://download.oracle.com/docs/cd/B25221_04/web.1013/b14428/usclient.htm) but at other points in the documentation, it seems to suggest that that resource injection is supported see(http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b28221/undejbs001.htm#CIHFEJAC).
    I am just wondering what the definitive answer is. Does OC4J support resource injection in the web client(in particular, JSP) or not. BTW I am trying to inject an EJB into a JSP client. It doesn't seem to work with resource injection but works OK with JNDI.
    Thanks

    Does any one have any sort of explanation on this?

  • Resource Injection Question -to do with where main is...

    Hi, I've just been doing some jms stuff, and I've found that if I have a class which is just for main, and I send messages in a different class called from main, my resource injection doesn't occur.
    However if the main method is in the class which I send the messages from, resource injection does occur.
    Why is this?? is it something to do with the type of class or something???

    I read that thread and in the SAP library which is quoted, it says, "you can split up the whole dataset for an InfoCube into several, smaller, physically independent and redundancy-free units."
    So what is meant by physically independent in this definition? The way I've described it seems compatible, since data of similar partitions are physically seperate on the disk, though again I'm not sure if its true.
    More inputs would be appreciated... points have and will continue to be awarded.
    Edited by: Benson Wong on Mar 4, 2010 10:38 PM

  • Resource injection in tag handler

    I can't seem to find a straight answer for this anywhere. Using release 9.1 of the Sun Application Server, should resource injection in a tag handler be working? Tak something really simple like this:
    public class TestHandler extends SimpleTagSupport {
        @EJB SomeEJBLocal beanInstance;
        public void doTag() throws JspException {
    } When I try this, beanInstance is null. Is this a configuration issue or does this just not work yet?

    Found the answer myself. When the web module was being ported over, the web.xml was copied as-is. It still had version 2.4 as an attribute to the web-app element. Changing the attributes to match a newly created 2.5 version fixed the problem.

  • EJB Client/Resource Injection

    Hi,
    could anyone explain to me why the field into which an EJB reference in an EJB client can be injected has to be static? I've read the following in the EJB3.0 tutorial (see below), but I don't know what "static context" means exactly. Care to explain, anyone?
    Thanks, Michael
    Creating a Reference to an Enterprise Bean Instance
    "Java EE application clients refer to enterprise bean instances by annotating static fields with the @EJB annotation. The annotated static field represents the enterprise bean's business interface, which will resolve to the session bean instance when the application client container injects the resource references at runtime.
    @EJB
    private static Converter converter;
    The field is static because the client class runs in a static context."

    The question was about why the field needs to be marked static. mappedName is a separate issue. The reason injected fields/methods in Application Clients need to be marked static is because of the Application Client programming model. It has always been the case that for an Application Client component the developer writes a static void main() method as the entry point, much like a regular Java Client. This means that the Application Client container invokes the application code with a static invocation, i.e. there is no instance of the main class. Injection is only useful if it takes place before the application code runs, so to accomplish that without changing the Application Client programming model, the Java EE platform spec requires that injected fields/methods be marked static.
    As for mappedName, it deals with how to map the ejb dependency to the target bean. By default in SUN's implementation, the remote @EJB dependency will map to the global JNDI name formed by taking the fully qualified type of the remote business interface, in this case <packagename>.Converter. That will work as long as the target Remote EJB has that global JNDI name. If the target Remote EJB's global JNDI name were "GlobalJNDIName", then you would need to explicitly assign that to the client's ejb dependency, as this example shows. That can be done either by using the mappedName() attribute or sun-application-client.xml.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SessionBean Resource Injection

    hi,
    there ist a possibility at EJB 2.1 to get Data from ejb-jar.xml over <env-enty> ...
    ist there any possibility or alternative at EJB 3.0 to get Data from descriptors? EJB 3.0 dosn't provide <env-entry> in ejb-jar.xml.
    thanks
    Hasan

    Hi Hasan,
    I'm not sure I understand your question. EJB 3.0 does allow you to define env-entry.
    You also have the option of injecting the value instead of doing a lookup.
    E.g., you would put the following in your ejb-jar.xml within a particular <session>
    or <message-driven> entry.
    <env-entry>
    <env-entry-name>value1</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>Foo</env-entry-value>
    </env-entry>
    Then, in the bean class, you put the following :
    @Resource(name="value1") String value;
    Notice how the name attribute of @Resource matches the env-entry-name
    in the ejb-jar.xml. That means you could also lookup the value in the
    bean's component environment :
    String value = (String) new InitialContext().lookup("java:comp/env/value1");
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • JSF 2.0 Resource injection for @ApplicationScoped ManagedBean. Problem.

    Hi, guys. I've got two ManagedBeans with @ApplicationScoped
    @ManagedBean(name = "config", eager=true)
    @ApplicationScoped
    public class Config {
    and
    @ManagedBean(name = "server")
    @ApplicationScoped
    public class Server {
    @ManagedProperty(value = "#{config}")
    private Config config;
    public Config getConfig() {
    return config;
    public void setConfig(Config config) {
    this.config = config;
    public ServerNavCntrl() {
    log.info("Initiated success. Config instance is " + config);
    The problem is that Server initiated with NULL config value. Why is that? Is that a bug?
    Using jsf 2.0.2 and glassfish 3

    Mmmmm ... try it:
    FacesContext fc = FacesContext.getCurrentInstance();
    MyManagedBean mb = (MyManagedBean) fc.getApplication().getELResolver().getValue(fc.getELContext(), null, "mymanagedbean");
    MyEJBRemote ejb = mb.getMyEJB();MyManagedBean have the EJB inyected, getMyEJB just return the instance.
    Maybe work, however i'm not sure.

  • How do I create resource to be injected with @Resource annotation

    I use @Resource get hold of DataSource or mail session in my session beans, but what am I supposed to do if i want to define my own resource, like org.apache.fop.apps.FopFactory? I only need to configure it and later access from my session beans like a resource, but I am not sure how do I do it. I guess I need to put it in the JNDI but what needs to be done with JBoss5 to do that? Is it java code or XML configuration?
    Thanks for any help!

    I've never really thought of custom resource injection before, but since no experienced developers are answering, here's some info I found:
    [Example 1 (in OpenEJB)|http://openejb.apache.org/3.0/custom-injection.html]
    Here's some code from [Web Tier to Go With Java EE 5: A Look at Resource Injection|http://java.sun.com/developer/technicalArticles/J2EE/injection/]
    private @Resource String welcomeMessage;
    public class HelloWorld extends HttpServlet {
         public void doGet(HttpServletRequest request,
                           HttpServletResponse response)
         throws ServletException, IOException {
             PrintWriter out = response.getWriter();
             out.println(welcomeMessage);
    <env-entry>
        <env-entry-name>welcomeMessage</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-name>
        <env-entry-value>Hello World from env-entry!</env-entry-value>
    </env-entry>You just need to discover where to put <env-entry>, but [this article|http://java.sun.com/developer/EJTechTips/2003/tt1209.html] and the first link will help you there.
    Also, maybe [this thread|http://forums.sun.com/thread.jspa?threadID=5176050] is useful (but I don't think so).

  • Dependency Injection Failing

    Hi,
    I am trying to inject instance of class "SaveCardInfoDAO" into ejb method "insertCardInfo". Following are the code snippets.
    Controller (Stateless session bean in Project1)
         * Exposed Message to insert the Credit Card Info into the database.
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public void insertCardInfo(CreditCardDO ccdo){
         SaveCardInfoDAO saveCardInfo = (SaveCardInfoDAO) ApplicationUtil.getSpringContext().getBean("saveCardInfo");
         //SaveCardInfoDAO saveCardInfo = new SaveCardInfoDAO(ccsDataSource);
              try{
                   saveCardInfo.openConnection(false);
                   saveCardInfo.insertCardInfo(ccdo);
                   System.out.println("Insert Success !!!");
              catch(SQLException e){
                   ejbContext.setRollbackOnly();
                   System.out.println("Insert Failure !!!");
              finally{
                   saveCardInfo.closeConnection();
    ApplicationUtil class (Initializes the Application context) project2.
    public class ApplicationUtil {
         private static final ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
         static{
              init();
         public static void init(){
              DOMConfigurator.configure("resource/ccslogger.xml");
         public static ApplicationContext getSpringContext(){
              return context;
    applicationContext.xml (in project2)
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    <aop:aspectj-autoproxy />
    <bean id="creditCardAdvice" class="com.fedex.ccs.advice.CCSCreditCardInfoAdvice" />
    <bean id="saveCardInfo" class="com.fedex.ccs.dao.SaveCardInfoDAO" />
    <bean id="creditCardDO" class="com.fedex.ccs.domain.CreditCardDO" />
    </beans>
    SaveCardInfoDAO (in project 3)
    public class SaveCardInfoDAO extends CCSBaseDAO {
         private PreparedStatement stmt;
         public void setPreparedStatement() throws SQLException{
              stmt=getConnection().prepareStatement(SQLQueriesBase.CCS_Credit_Card_Info.INSERT_CREDIT_CARD_INFO);
         public PreparedStatement getPreparedStatement(){
              return stmt;
         public SaveCardInfoDAO(){
         public SaveCardInfoDAO(DataSource ccsDataSource){
              super(ccsDataSource);
         * Insert credit card information into the database table.
         * @param ccdo
         * @throws SQLException
         public int insertCardInfo(CreditCardDO ccdo)throws SQLException{
              setPreparedStatement();
              stmt.setObject(1, ccdo.getCreditCardType(), Types.VARCHAR);
              stmt.setObject(2, ccdo.getCreditCardID(), Types.VARCHAR);
              stmt.setObject(3, ccdo.getCreditCardBIN(), Types.VARCHAR);
              stmt.setObject(4, ccdo.getCreditCardExpDt(), Types.VARCHAR);
              stmt.setObject(5, ccdo.getAccountNumber(), Types.VARCHAR);
              int result = stmt.executeUpdate();
              stmt.close();
              return result;
    Project 1 has dependency on project 2 and project 3.
    Project 3 has dendency on Project 2
    This gives me following error.
    javax.ejb.EJBTransactionRolledbackException: EJB Exception: : java.lang.NoClassDefFoundError: com/fedex/ccs/util/ApplicationUtil
         at com.fedex.ccs.ejb.session.Controller.insertCardInfo(Controller.java:44)
    Please help me resolve this issue. Let me know if you need something else.

    Hi, Thanks for the reply.
    I was trying to integrate Spring AOP and AspectJ (for logging) with EJB 3.0 in a wrong way. Now I have got idea as to what is the approach. But still I am getting a new error. The advice class bean mentioned in the spring AOP config file is giving me following error saying that it cannot find the specified advice class. But it can inject the DAO class instance that is in the same project as the Advice class.
    Caused By: java.lang.NoClassDefFoundError: Could not initialize class com.fedex.ccs.advice.CCSCreditCardInfoAdvice
         at sun.reflect.GeneratedConstructorAccessor112.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
         at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
         Truncated. see log file for complete stacktrace
    If in my AOP config xml file I remove the bean definition of Advice class that it works fine and it injects DAO. But there is no logging done. Can you give me an headstart as to what is the appropriate way of integrating Spring AOP and AspectJ with EJB 3.0.
    Thanks and Regards
    Damodar

  • Ways to Get Resources in EJB

    Ways to Get Resources in EJB 3_
    source: http://javahowto.blogspot.com/2006/06/5-ways-to-get-resources-in-ejb-3.html
    Use resource injection with runtime info mapping.
    For example,
    package com.foo.ejb;
    import javax.ejb.Remote;
    @Remote public interface ResourceRemote {
    public void hello();
    package com.foo.ejb;
    import javax.annotation.Resource;
    import javax.ejb.Stateless;
    import javax.sql.DataSource;
    @Stateless
    public class ResourceBean implements ResourceRemote {
    @Resource(name="jdbc/employee")
    private DataSource employeeDataSource;You don't need ejb-jar.xml. For portable applications, you will need appserver-specific deployment plan to map the logical name (jdbc/employee) to the actual DataSource configured in the target runtime environment. For JavaEE SDK 5, Glassfish, and Sun Java System Application Server 9, it's sun-ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN"
    "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
    <sun-ejb-jar>
    <enterprise-beans>
    <ejb>
    <ejb-name>ResourceBean</ejb-name>
    *<jndi-name>ResourceBean</jndi-name>*
    <resource-ref>
      <res-ref-name>jdbc/employee</res-ref-name>
        <jndi-name>jdbc/__default</jndi-name>
    </resource-ref>
    </ejb>
    </enterprise-beans>
    </sun-ejb-jar>
    We have a tag like +<jndi-name>ResourceBean</jndi-name>+  in the above. Do we use this jndi-name ? If so, where ?

    user575089 wrote:
    Do we use this jndi-name ? If so, where ?If you need to look the bean up from JNDI?

  • How am I able to use an injected EJB in a Managed Bean Constructor?

    JSF 1.2
    EJB 3.0
    Glassfish v1
    Summary:
    Managed bean injected EJB is null when referencing EJB var in constructor.
    Details:
    In my managed bean, I have a constructor that tries to reference an injected EJB, such as:
    public class CustomerBean implements Serializable {
    @EJB private CustomerSessionRemote customerSessionRemote;
    public CustomerBean() {
    List<CustomerRow> results = customerSessionRemote.getCustomerList();
    }The call within the constructor to customerSessionRemote is null - I've double checked this in Netbeans 5.5.
    How am I able to use an injected EJB in a Managed Bean Constructor?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    OK, I was reading the article Web Tier to Go With Java EE 5: A Look at Resource Injection and I understand your statement too.
    Is there any way possible to Inject the EJB prior to the bean instance creation at all?
    Maybe, I need to approach it with the old fashion Java EE 1.4 route and using JNDI in the PostConstruct annotated method to reference the EJB in the managed bean.
    This had to been thought out before, I don't understand why a manged bean's life cycle places any injections at the end of the bean creation.
    Also, now that I understand that the @PostConstruct annotated method will be called by the container after the bean has been constructed and before any business methods of the bean are executed.
    I am trying to reference my EJB as part of the creation of the managed bean.
    What happens: the JSF page loads the managed bean and I need to populate a listbox component with data from an EJB.
    When I try to make the call to the EJB in the listbox setter method, the EJB reference is null.
    Now, I'm not for sure if the @PostConstruct annotation is going to work... hmmmm.
    ** Figured it out. ** I just needed to move the EJB logic that was still in the setter of the component I wanted to populate into the annotated PostConstruct method.

  • EntityManagerFactory injection problems

    I am continually getting the following error on the application server:
    Version = Sun Java System Application Server 9.1_01
    Running on an i86 machine with the Sun operating system installed. I do not seem to get this error on the windows version of the AS. This error was not happening, but started appearing for no apparent reason. It will inject the entity manager resource sometimes without a problem, then stop working. It is so irritating that I am thinking of getting rid of the AS altogether as I need a technology which is at least stable enough to give me reliable access to a database!
    Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: AlexDb@Field-Injectable Resource. Class name = com.test.lis
    teners.ContextListener Field name=[email protected]@@@ into class com.test.listeners.ContextListener
    at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
    at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
    at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
    at com.sun.web.server.WebContainerListener.injectInstance(WebContainerListener.java:180)
    at com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:125)
    ... 45 more
    Caused by: java.lang.IllegalArgumentException
    at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
    at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57)
    at java.lang.reflect.Field.set(Field.java:656)
    at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:338)
    ... 49 more

    Hi Frank,
    the doc:
    jsf-1_2-mrel-spec.pdf
    JavaServer™ Faces Specification
    Version 1.2 - Rev A
    Page - 169
    5.4 - Leveraging Java EE 5 Annotations in Managed Beans
    JSF Implementations that are running as a part of Java EE 5 must allow managed bean implementations to use the annotations specified in section 14.5 of the Servlet 2.5
    Specification to allow the container to inject references to container managed resources into
    a managed bean instance before it is made accessible to the JSF application. Only beans
    declared to be in request, session, or application scope are eligble for resource
    injection.
    Following is an example of valid usages of this feature in a managed bean
    public class User extends Object {
    private @EJB ShoppingCart cart;
    private @Resource Inventory inventory;
    private DataSource customerData;
    ....

  • DAO and Struts

    I m new to Struts and i wsh to do a stuff in it....
    I m not clear with the DAOs and Business Delegate model in it and i need a sample code for continuing with wher can i get if anybody culd suggest me a well start point??

    hi
    thanks for ur response,
    Actually i tried the tryme.war from http://javaboutique.internet.com/tutorials/ApacheDAOs/tryme.war
    i hav configured my conf/server.xml as
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase" pathname="conf/tomcat-users.xml" factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
    <Resource name="PointBaseJNDI" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/test" maxActive="40"/>
    <Resource name="jdbc/hrweb" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" password="mysql" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/hrweb" maxActive="4"/>
    <Resource name="jdbc/hrsite" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/hrsite" maxActive="40"/>
    <Resource name="testmysql" type="javax.sql.DataSource" password="admin" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" maxIdle="2" maxWait="5000" username="root" url="jdbc:odbc:tomtest" maxActive="4"/>
    <Resource name="jdbc/dao" type="javax.sql.DataSource" password="mysql" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" username="root" url="jdbc:mysql://localhost:3306/test" maxActive="4"/>
    </GlobalNamingResources>
    <Service name="Catalina">
    <Connector port="8088" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
    <Host appBase="webapps" name="localhost">
    </Host>
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
    </Service>
    </Server>
    also my catalina/localhost/root.xml to be
    <?xml version='1.0' encoding='utf-8'?>
    <Context displayName="Welcome to Tomcat" docBase="ROOT" path="" workDir="work\Catalina\localhost\_">
    <ResourceLink global="jdbc/dao" name="jdbc/daoref" type="javax.sql.sourceParams"/>
    <ResourceLink global="testmysql" name="testmysqlref" type="javax.sql.DataSource"/>
    <ResourceLink global="PointBaseJNDI" name="PointBaseJNDIRef" type="javax.sql.DataSource"/>
    <ResourceLink global="AccessJNDI" name="AccessJNDIRef" type="javax.sql.DataSource"/>
    </Context>
    but when i tried to get run the tryme.war , list.jsp file
    i m getting the follown error...
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Cannot find bean dvds in any scope
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
         org.apache.jsp.list_jsp._jspService(org.apache.jsp.list_jsp:106)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: Cannot find bean dvds in any scope
         org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938)
         org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:277)
         org.apache.jsp.list_jsp._jspService(org.apache.jsp.list_jsp:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    could u please figure out the problem?

Maybe you are looking for

  • How to open and read data from text file in PL/SQL

    We have a project ,need to open a file containing entries of data ,then process those data records one by one to update the database.This operation shoulbe be done in the database enviroment. Is there any hint about the file operation in PL/SQL? How

  • Mac up to date

    Hello. I know that this question may already is answered but anyway... I have an iMac and i am planning to buy a macbook pro in the week. Is there any way that both computers stay up to date simultaneously? I want these automatic program install tags

  • Problem with GET LDB statement

    Hi, I am working on change request which displays the output in ALV GRID. After executing on return its not coming to the selection screen. It shows a screen output generated using WRITE statement, however we have not used any write statement in the

  • Photoshop cs6 photomerge shows error 48

    I can´t i start photomerge in PS cs6 on my macbook. It always shows error 48.

  • Cost component report

    this is the z report we are using for cost component report .when run the report for perticular movement type system taking the total value of the one movement type .But when you give two movement type (ex :601 and 602 ) the ststem giving only one mo