Results 1 to 2 of 2
  1. #1
    mmc01 is offline Member
    Join Date
    Aug 2011
    Rep Power

    Default I can't use Entity Class (JPA) in Netbeans7.0 .

    I tried to use Entity Class (JPA) in Netbeans7.0 but It doesn't work.

    1. I create Enterprise Application name BookApp.

    Create Entity Class

    2. I right click at BookApp-ejb and select Entity Classes fron Database.
    3. In dialog New Entity Class from Database I insert JNDI Name:jdbc/test for connect to test database and select table books. After that ,I click Next for insert Package: entity and click Finish.

    Create Session Bean

    4. I right click at BookApp-ejb and select Session Beans for Entity Classes and click Next.
    5. I click Add All >> and click Next.
    6. I insert Package: sb , create Interface:Local and click Finish.

    Create Web Application

    7. I right click BookApp-war and select HTML insert HTML File Name :findBook and click Finish.
    8. I put this code in HTML file

    Java Code:
    <form action="ShowBook" method="POST">
    <h2>Search Book from ISBN </h2>
    Enter ISBN <input type="text" name="isbn" value="" />
    <input type="submit" value="Find" />
    9. I right click BookApp-war and select Servlet insert File Name: ShowBook, Package: servlets and click Finish.
    10. I right click in editor and select Insert Code… > Call Enterprise Bean…
    11. In dialog Call Enterprise Bean I select BooksFacade and click OK.
    12. I uncomment html and insert this code between out.println("<body>");

    Java Code:
    String isbn = request.getParameter("isbn");
    Books book = booksFacade.find(isbn);
    out.println("Title: " + book.getTitle()+ "<BR>");
    out.println("Author: " + book.getAuthor() + "<BR>");
    out.println("Price: " + book.getPrice() + "<BR>");
    13. I clean and build BookApp.
    14. I run BookApp.
    15. I go to this URL http://localhost:8080/BookApp-war/findBook.html and insert isbn from books table but when I click Find button It show error like this.

    HTTP Status 500 -

    type Exception report


    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.



    I don't know what I mistake. I delete Session Beans and create Session beans again but no create Interface. when I run BookApp it show same error. I'm new for EJB. please help me.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. error in creating the entity class by netbeans
    By javastuden in forum NetBeans
    Replies: 2
    Last Post: 07-22-2011, 02:29 PM
  2. jpa entity update
    By videanuadrian in forum Advanced Java
    Replies: 14
    Last Post: 06-14-2011, 05:18 PM
  3. Replies: 4
    Last Post: 05-13-2011, 11:04 PM

Tags for this Thread

Posting Permissions

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